I’ve used the original parametric.rbplugin from the Sketchup team in two of my plugins, SU Draw Parametric Shapes, and Polyhedra (both hosted on the SketchUcation Plugin Store).
It suffered from two drawbacks, which I’m pleased to say have now been fixed by Steve Baumgartner (@slbaumgartner).
1.Parameter order was not preserved when Editing an already-drawn component, as the parameter key/value pairs were stored in a hash, not an array, and would be returned in an arbitrary order.
2.If I installed both plugins, then I would get duplicate entries in the context menu when right-clicking to edit a drawn shape or polyhedron.
To preserve key/parameter order, each derived classin the calling function now needs to define a new function which passes an array of keys to parametric.rb in the required order. Here’s an example from the Shapes plugin, for a Helix shape:
def keys
['start_radius','end_radius','start_height','end_height','start_angle','rotations','num_segments']
end
To preserve backward compatibility, the revised parametric.rb implements a default keys method which returns nil, if not overridden by the derived class as in the example above.
I’ve updated both my plugins on SketchUcation to use the revised parametric.rb plugin, which will be installed along with the parent program when you update the plugin.
You need to restart SU after updating the plugin.
If you use this script in your own code, CHANGE THE MODULE NAME to use your own initials and calling program name instead of JWM::Shapes.