2 issues; inheritance & require ?
-
I just did a new install of SU an a Netbook to check if a ruby I'm writing will work correctly.
=begin # Name ; tool =end require 'sketchup.rb' require 'linetool.rb' class WallSectionTool < LineTool
I found linetool.rb was not by default in the plugins dir rather in the Examples dir hence my ruby would not run. It did run when I moved linetool.rb to the plugins dir.
Which makes me wonder if inheritance in Ruby of the Linetool is still a valid option?commenting out, I thought would cause my script not to run .... but it did!...why?
#require 'sketchup.rb' #require 'linetool.rb'
-
Perhaps other code already required them ?
require 'linetool.rb'
could be also
require 'examples/linetool.rb'
??? -
Yes don't move files from the "Examples" dir.
The reason you did not need the
require()
statements, in the second case, was that Sketchup loads ALL files in the "Plugins" dir at startup.The Examples are ONLY loaded, if the user checks the option, in Window > Preferences > Extensions.
OK ? so... Those files are "examples".. NOT Library files.
- The
LineTool
class does not belong at the toplevel !!1. Cut and paste the code into your OWN module, and modify / rename the class name.
-
like: class
Tomot::LineTool
1. then inherit from YOUR copy -
like:
class Tomot::WallSectionTool < Tomot::LineTool
- The
-
@tig said:
Perhaps other code already required them ?
require 'linetool.rb'
could be also
require 'examples/linetool.rb'
???I was looking at some example code for a ruby written by RickW dated 2005 called parking .rb, perhaps back then linetool.rb was residing in the plugins dir however your require 'examples/linetool.rb' works!
There is also something quite insidious in the Windows 7 OS, its the VirtualStore dir, which keeps files that are never uninstalled by the uninstall program process, also the latest save version remains there, while the unaltered version remains in c:\ProgramFiles\ Google\GoogleSketchUp8\Plugins
You will find the virtual store dir: c:\UsersYour name\AppData\Local\VirtualStore
Its only after the uninstall and deleting any left over files in both of these dir's that you have done a complete uninstall. -
Yes... the security on Win 6+ if a pain!
Even a User cannot see his own AppData folders without going thru several confusing nested dialogs.
THIS ISSUE is why users should be smart, and install their plugins to a directory that THEY control.
I have my plugins in:
"C:/Users/#{ENV['USERNAME']}/Documents/Google Sketchup/Common/Plugins"
or
"C:/Users/#{ENV['USERNAME']}/Documents/Google Sketchup/Sketchup ${Sketchup.version.to_i}/Plugins"
see this code post: [Code] !autoload.rb loads "!_autoload" folders - v1.1.0
-
@dan rathbun said:
Cut and paste the code into your OWN module, and modify / rename the class name.
-
like: class
Tomot::LineTool
[*]then inherit from YOUR copy -
like:
class Tomot::WallSectionTool < Tomot::LineTool
[/list]
The Module stuff is still on my do list! Yes I did the reverse, I felt since there was no additional information I wanted to convey to the user, using the inheritance of the linetool.rb was adequate, hence I cut all linetool stuff out of my script.
-
-
I have not played around with that for a few years now: and I don't know if its still possible under Win 7 OS. I used to install each program I used to another totally independent HDD. such as drive e:/sketchup.
I would never use the default offered by the installer. It was also a lot faster to make a bootable backup HDD, while all my programs and data still ran from my HDD drive e: and could not be accessed by a hacker.
Unfortunately some addons today wont run anywhere else than from c:\Program Files -
@tomot said:
Unfortunately some addons today wont run anywhere else than from c:\Program Files
That's not your fault.. it's the fault of the plugin author.
If they are not scrambled, you can tweak them... if they are, you can try to ask the author to fix the plugin.
-
@tomot said:
The Module stuff is still on my do list!
Really... it's not that hard.. and you will be much better off having all you code running within your protected namespace.
-
@dan rathbun said:
@tomot said:
Unfortunately some addons today wont run anywhere else than from c:\Program Files
That's not your fault.. it's the fault of the plugin author.
If they are not scrambled, you can tweak them... if they are, you can try to ask the author to fix the plugin.
A friend of mine recently said " if I want an appliance I'll buy a MAC if I want a computer I'll buy a PC. I think Microsoft is heading down the same road as Apple. A pay for everything, the user wants, freeway!
So I saved $350.00 by NOT having Apple install a new HDD, on my wife's iMac, I did it my way!
Advertisement