- Code: Select all
Object.const_set('SU',Sketchup)
Notes:
- Creates a global alias SU to refer to the Sketchup module.
Examples:
- model = SU.active_model
SU.require('somefile.rbs')
Can be added into the master skx.rb file.
[code] alias Sketchup as SUModerator: Jim
3 posts
• Page 1 of 1
[code] alias Sketchup as SU(code) alias Sketchup as SU
Notes:
Examples:
SU.require('somefile.rbs') Can be added into the master skx.rb file.
Re: [code] alias Sketchup as SUDoes Object.const_set('SU',Sketchup) have any advantage over SU == Sketchup ? Is it that it works regardless of the calling scope?
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
Re: [code] alias Sketchup as SU
Well first of all, you meant: SU = Sketchup It has no difference at the console, because you are already in the Object namespace. But to be precise, and to allow setting a global constant from ANY namespace, you need to call: Object.const_set('Name',object) You could call: Object.instance_eval("Name=object"), but that would be blurring what you are doing, just a bit. Better to use the const_set() method for readability. Last bumped by Dan Rathbun on Fri Dec 21, 2012 3:42 am.
3 posts
• Page 1 of 1
|