Class: SketchupExtension
- Inherits:
-
Object
- Object
- SketchupExtension
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) ⇒ SketchupExtension
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) ⇒ SketchupExtension
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.
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.
↑ #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.
↑ #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. 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.
↑ #version ⇒ String
The version method returns the version which appears beneath an extension inside the Extensions Manager dialog.