Plugin Framework


SketchApp's plugin framework attempts to make plugins easier and safer to create, manage, etc. It is implemented by files in the _Framework file tree. More generally, it is based on (and supports) the SketchApps file layout. Finally, it has an ever-growing Wish List.

Primary Files

The framework consists, primarily, of several Ruby library files:

| etc/Ruby/
| | load_sketchapps.rb      # SketchApps loader (dist. copy)
| | sa_config.rb            # configuration file (dist. copy)
| lib/Ruby/
| | pf_browser_dialog.rb    # Browser_Dialog support
| | pf_common.rb            # common code for plugin framework
| | pf_dialog.rb            # {Browser_,Web}Dialog support
| | pf_erb_view.rb          # support ERb views, templates, etc.
| | pf_gen_js.rb            # generate JavaScript (and CSS) code
| | pf_logger.rb            # logging code for plugin framework
| | pf_main.rb              # main code for plugin framework
| | pf_model.rb             # harvest (etc) SketchUp Model data


At initialization time, SketchUp reads and executes a copy of the load_sketchapps.rb file (in SketchUp's plugins directory). load_sketchapps.rb scans the user's SketchApps (and possibly SketchApps_dev) directories, looking for plugins.

Stub code for each plugin is executed, registering the plugin's desired menu items, tools, etc. When this is done, load_sketchapps.rb sets up the actual sub-menus, menu items, toolbars, tools, etc.

When and if the user invokes a plugin (eg, via a menu item), the plugin's main method is instantiated and executed. It then performs some setup activities (eg, loading libraries) and begins performing its duties. For more details, see Plugin Loading.

Dialog Framework

Any SketchUp plugin that uses WebDialogs in a serious way will require substantial amounts of HTML, CSS, and JavaScript code. There are also some capabilities (eg, browser-based dialogs) which SketchUp's WebDialog class does not provide.

The SketchApps Dialog Framework, inspired by web application frameworks such as Ruby on Rails, is my way of addressing these issues.

This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r9 - 06 Jul 2012, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email