Grasshopper

algorithmic modeling for Rhino

Hi all,

 

For custom components is there a way to specify a default value for the Geometry or Generic Parameters, just as in the boolean parameter, i.e.

 

pManager.Register_BooleanParam("Param", "P", "Example Param", true, GH_ParamAccess.list);

 

That'd be really handy otherwise, I suppose the only way is to create a custom parameter type. In this case, is there a way to tell grasshopper to treat input from that parameter as a list or tree? I am aware of the DA.Iteration property and accessing the VolatileData field of the parameter, only I was wondering if there was something more "elegant"..

Many thanks.

 

Yannis

 

Views: 1633

Replies to This Discussion

Hi Yannis,

yes, both Generic and Geometry derive from GH_PersistentParam which can store internal data. There are however no overloads for adding this data in the Register_XXXXParameter methods. You'll need to get the parameter afterwards, cast it and assign data yourself. So inside RegisterInputParams, type something like:

Dim param As Param_GenericObject = TryCast(pManager(0), Param_GenericObject)
If (param IsNot Nothing) Then
  param.AddPersistentData(blech)
End If

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Brilliant, huge thanks!

Yannis

Hi..can you share the coding? ..am needing it for my college work..

 

Hey David,

Is there an updated method for doing this in C#?  

Thanks,

Marc

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