Fixing the SketchUp Involute Gear Plugin

Long ago, there was a simple plugin for SketchUp that would make Involute Gears quickly and easily. Called 'gear.3.rb' I used it on countless simple mechanical projects.

The SketchUp Involute Gear Plugin in operation after some quick repairs to its Ruby script

The SketchUp Involute Gear Plugin in operation after some quick repairs to its Ruby script

Recently I wanted to revisit one of those projects, and found that the original download site for the plugin was gone. So I dug the script out of one of my old SketchUp installs and discovered that it won't load into SketchUp 2015. It looks like there is an error in how the plugin adds itself to the menu system. 

After adding the script to my sketchup plugins folder, it failed to load do to a missing 'GetString' Method in the script. 

I pulled the Ruby script open in TextWrangler, and found the UI section.  It looks like the code is using and out of date function to add itself to a UI menu that doesn't exist in newer versions of SketchUp...  

The Offending Section of the Ruby Script that was keeping the Gear.3.rb plugin from loading into Sketchup 2015

A quick search of the SketchUp Ruby resources led me to the documentation of the Menu Class. It looks like the class was simplified at some point, and this plugin never got rewritten to use the new tools. 

Screenshot from the documentation of the updated Menu Class in the Sketchup Ruby Documentation

The Fix to get gear.3.rb working again seemed straightforward. Rework the UI.menu items in the plugin's Ruby script to match the strucure of the updated commands. To keep things simple, i'm just going to add the two commands from the Involute Gear plugin to SketchUp 2015's 'Tools' menu, and add a menu separator to make them easier to find.  Based on the Ruby documentation, the changes were straightforward.   

The Modified UI section of the gear.3.rb plugin's Ruby Script

Nothing left now but to Save the script, reload SketchUp, and check the Tools menu...

The Two commands from the gears.s.rb script added to SketchUp 2015's Tools menu, with there own menu separator.

Holy Shit... It worked.  

Did I mention I have never written or modified a Ruby script before in my life?  

You can download the repaired SketchUp Involute Gear Plugin gears.3a.rb here.  You'll need to follow these instructions to get it installed.

A big thanks to Doug Herrmann, the original author of this plugin.  I don't know where he is now or why his site is gone, but I'm happy I've found a way to keep the tool he created running.