Class: SketchupExtension
- Inherits:
-
Object
- Object
- SketchupExtension
- Defined in:
- SketchUp/sketchupextension.rb
Overview
The SketchupExtension class contains methods allowing you to create and manipulate SketchUp extensions. Extensions are Ruby scripts that can be loaded and unloaded using the Extension manager (Extensions panel of the Preferences dialog box). Generally you should register your ruby scripts as an extension to give SketchUp users the ability to disable it through the user interface.
The idea here is to take the ruby script that actually creates your functionality and place it in a folder somewhere outside of the /Plugins folder, most commonly a subdirectory like /Plugins/MyExtension. Then you create a new ruby script inside the /Plugins directory that will set up the extension entry and load your original script if the user has your extension turned on.
Here is an example extension loading script. For this example, the following code would be saved in /Plugins/StairTools.rb, and the actual plugin itself would live in /Plugins/StairTools/core.rb.
You can find two example extensions that ship with SketchUp, su_dynamiccomponents.rb and su_sandboxtools.rb, under the /Plugins/ folder.
Instance Method Summary collapse
-
#check ⇒ Boolean
Loads the extension, meaning the underlying ruby script is immediately interpreted.
-
#copyright ⇒ String
The copyright method returns the copyright string which appears beneath an extension inside the Extensions Manager dialog.
-
#copyright=(copyright) ⇒ String
The copyright= method sets the copyright string which appears beneath an extension inside the Extensions Manager dialog.
-
#creator ⇒ String
The creator method returns the creator string which appears beneath an extension inside the Extensions Manager dialog.
-
#creator=(creator) ⇒ String
The creator= method sets the creator string which appears beneath an extension inside the Extensions Manager dialog.
-
#description ⇒ String
The description method returns the long description which appears beneath an extension inside the Extensions Manager dialog.
-
#description=(description) ⇒ String
The description= method sets the long description which appears beneath an extension inside the Extensions Manager dialog.
-
#extension_path ⇒ String
The extension_path method returns the file system path to the extension’s outer rb file.
-
#id ⇒ String
The id method returns the Extension Warehouse ID string.
-
#initialize(title, path) ⇒ Sketchup::Extension
constructor
The new method is used to create a new SketchupExtension object.
-
#load_on_start? ⇒ Boolean
Returns whether the extension is set to load when SketchUp starts up.
-
#loaded? ⇒ Boolean
Returns whether the extension is currently loaded, meaning the actual ruby script that implements the extension has been evaluated.
-
#name ⇒ String
The name method returns the name which appears for an extension inside the Extensions Manager dialog.
-
#name=(name) ⇒ String
The name= method sets the name which appears for an extension inside the Extensions Manager dialog.
-
#registered? ⇒ Boolean
Returns whether the extension has been registered via Sketchup.register_extension.
-
#uncheck ⇒ Boolean
Unloads the extension.
-
#version ⇒ String
The version method returns the version which appears beneath an extension inside the Extensions Manager dialog.
-
#version=(version) ⇒ String
The version method sets the version which appears beneath an extension inside the Extensions Manager dialog.
-
#version_id ⇒ String
The version_id method returns the Extension Warehouse Version ID string.
Constructor Details
#initialize(title, path) ⇒ Sketchup::Extension
It is recommended to omit the file extension provided in the path argument. SketchUp will resolve the file extension to .rbe, .rbs or .rb.
The new method is used to create a new SketchupExtension object. Note that once the extension object is created, it will not appear in the Extension Manager dialog until your register it with the Sketchup.register_extension method.
210 211 |
# File 'SketchUp/sketchupextension.rb', line 210 def initialize(title, path) end |
Instance Method Details
#check ⇒ Boolean
Loads the extension, meaning the underlying ruby script is immediately interpreted. This is the equivalent of checking the extension’s checkbox in the Preferences > Extensions list.
57 58 |
# File 'SketchUp/sketchupextension.rb', line 57 def check end |
#copyright ⇒ String
The copyright method returns the copyright string which appears beneath an extension inside the Extensions Manager dialog.
73 74 |
# File 'SketchUp/sketchupextension.rb', line 73 def copyright end |
#copyright=(copyright) ⇒ String
The copyright= method sets the copyright string which appears beneath an extension inside the Extensions Manager dialog.
92 93 |
# File 'SketchUp/sketchupextension.rb', line 92 def copyright=(copyright) end |
#creator ⇒ String
The creator method returns the creator string which appears beneath an extension inside the Extensions Manager dialog.
108 109 |
# File 'SketchUp/sketchupextension.rb', line 108 def creator end |
#creator=(creator) ⇒ String
The creator= method sets the creator string which appears beneath an extension inside the Extensions Manager dialog.
127 128 |
# File 'SketchUp/sketchupextension.rb', line 127 def creator=(creator) end |
#description ⇒ String
The description method returns the long description which appears beneath an extension inside the Extensions Manager dialog.
143 144 |
# File 'SketchUp/sketchupextension.rb', line 143 def description end |
#description=(description) ⇒ String
The description= method sets the long description which appears beneath an extension inside the Extensions Manager dialog.
162 163 |
# File 'SketchUp/sketchupextension.rb', line 162 def description=(description) end |
#extension_path ⇒ String
The extension_path method returns the file system path to the extension’s outer rb file.
171 172 |
# File 'SketchUp/sketchupextension.rb', line 171 def extension_path end |
#id ⇒ String
The id method returns the Extension Warehouse ID string.
179 180 |
# File 'SketchUp/sketchupextension.rb', line 179 def id end |
#load_on_start? ⇒ Boolean
Returns whether the extension is set to load when SketchUp starts up.
226 227 |
# File 'SketchUp/sketchupextension.rb', line 226 def load_on_start? end |
#loaded? ⇒ Boolean
Returns whether the extension is currently loaded, meaning the actual ruby script that implements the extension has been evaluated.
243 244 |
# File 'SketchUp/sketchupextension.rb', line 243 def loaded? end |
#name ⇒ String
The name method returns the name which appears for an extension inside the Extensions Manager dialog.
258 259 |
# File 'SketchUp/sketchupextension.rb', line 258 def name end |
#name=(name) ⇒ String
The name= method sets the name which appears for an extension inside the Extensions Manager dialog.
276 277 |
# File 'SketchUp/sketchupextension.rb', line 276 def name=(name) end |
#registered? ⇒ Boolean
Returns whether the extension has been registered via Sketchup.register_extension.
293 294 |
# File 'SketchUp/sketchupextension.rb', line 293 def registered? end |
#uncheck ⇒ Boolean
Unloads the extension. This is the equivalent of unchecking the extension’s checkbox in the Preferences > Extensions list.
Note that technically the extension is not “unloaded” in the sense that it stops running during the current SketchUp session, but the next time the user restarts SketchUp, the extension will not be active.
313 314 |
# File 'SketchUp/sketchupextension.rb', line 313 def uncheck end |
#version ⇒ String
The version method returns the version which appears beneath an extension inside the Extensions Manager dialog.
329 330 |
# File 'SketchUp/sketchupextension.rb', line 329 def version end |
#version=(version) ⇒ String
The version method sets the version which appears beneath an extension inside the Extensions Manager dialog.
348 349 |
# File 'SketchUp/sketchupextension.rb', line 348 def version=(version) end |
#version_id ⇒ String
The version_id method returns the Extension Warehouse Version ID string.
356 357 |
# File 'SketchUp/sketchupextension.rb', line 356 def version_id end |