• Login
sketchucation logo sketchucation
  • Login
ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

Updated parametric.rb ruby script

Scheduled Pinned Locked Moved Plugins
1 Posts 1 Posters 812 Views 1 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    johnwmcc
    last edited by 25 Mar 2019, 16:22

    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.

    1 Reply Last reply Reply Quote 0
    • 1 / 1
    1 / 1
    • First post
      1/1
      Last post
    Buy SketchPlus
    Buy SUbD
    Buy WrapR
    Buy eBook
    Buy Modelur
    Buy Vertex Tools
    Buy SketchCuisine
    Buy FormFonts

    Advertisement