Grasshopper

algorithmic modeling for Rhino

So I'm making a component that has a lot of different functionality in it, and I want one of the parameters to allow you to select which function to use.  (To be more specific, it's for modifying selections: grow, shrink, loop, ring, etc.)

I'd love to be able to specify an enum parameter, but I don't think that's possible.

Has anyone run into this before?  How did you solve it?

My current approach is probably going to be accepting either a string or an integer and switching on that.

Views: 1165

Replies to This Discussion

You can using integers. I'll copy the relevant text from another thread:

Param_Integer allows you to specify named values. You can use this to provide a list of constants to the user:

Dim param As Param_Integer = getanintegerparameterfromsomewhere()

param.AddNamedValue("Option 1", 0)

param.AddNamedValue("Option 2", 1)

param.AddNamedValue("Option 3", 2)

It's probably best to put this code in the RegisterInputParameters method.

And the thread: http://www.grasshopper3d.com/forum/topics/default-input-menu-for-cu...

The input will have a menu with options like this:

Since it's an integer parameter the user can also change between options by connecting integers to the input.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service