Appendix D
Creating Your Own Plugins
The following is a basic template to get you started with writing your own plugins for SketchUp. Even if you don’t want to publish your plugin, it might be useful sometimes to “install” a script you created in SketchUp using this convenient method.
RBZ Plugin File Structure
The RBZ file format was introduced in Maintenance Release 2 of Version 8. Packaging a plugin this way allows users to easily install it from SketchUp’s Preferences dialog.
To enable use of the RBZ-installer functionality, all files that make up a plugin must be packaged in one single compressed file (note that the RBZ file format is simply a renamed ZIP file). The following is a minimal sample file structure. You can add as many other files and folders as necessary for your plugin. The entire contents of the compressed file (including the folder structure) is copied into SketchUp’s Plugins folder on installation and the plugin is made available immediately.
my_plugin.rbz (compressed file)
|
|— my_plugin_loader.rb
|
|— my_plugin (directory)
|
|— my_plugin.rb
Plugin Template Structure
It is a good idea to (1) use SketchUp’s extension system (so that plugins can be turned on and off by the user) and (2) wrap ...