Thursday, December 1, 2011

RBZs in SketchUp 8M2: Distribute Your Plugin as One File!

Posted by Scott Lininger, SketchUp Engineer

In the latest and greatest SketchUp 8 maintenance release, M2, we added an easier way for users to install your Ruby scripts. In the past, folks had to manually copy your .rb files into their Plugins folder, or you would have to write a custom installer to do it for them.

Now there's a button in SketchUp that'll make this easier. It's found under Preferences > Extensions > Install Extension. Clicking this button will bring up a file browser window where your users can select any .RBZ file from their harddrive, and SketchUp will put them in the right spot plus load them up. No more fumbling around looking for the Plugins folder. No need to restart SketchUp to see your shiny plugin.

But what is an RBZ file?

And how do I make one?


It's simple. RBZ files are nothing more than ZIP files. You can use your favorite ZIP tool (I like 7-zip on Windows) to create the archive, then rename it to have a .RBZ extension. Anything you put inside of this RBZ file, including files and subfolders, will be unpacked into the user's Plugins folder. That's it!

So let's say you had a plugin with the following files in it:

  • SketchUp 8/Plugins/helloworld.rb
  • SketchUp 8/Plugins/helloworld_files/hello.html
  • SketchUp 8/Plugins/helloworld_files/smiley.png
You would create a ZIP file containing the above files. With my ZIP tool, I simply select the helloworld.rb and helloworld_files folder, right click on them, and select "Create ZIP". The resulting file is called helloworld.zip. Right click > rename to helloworld.rbz, and you're golden. HOWEVER, before I do this, it would be even better to change my simple ruby script into a SketchupExtension. That way my users will see your Extension added to the Extensions panel when they do the install, and in the future it's easy for them to turn it off.

Happy distributing!

2 comments:

Thomas Thomassen said...

I'm so glad for this. So many support queries related to people don't manage to install the plugins correctly. (Can't really blame them.)

Thomas Thomassen said...

Would probably be interesting for readers to also know the new API methods.