Grasshopper

algorithmic modeling for Rhino

Hi,
Does anyone know for custom components whether all inputs need to have an entry? Can some be left blank and the component still executes the solve? I want to have the option of using 1 or 5 of the inputs but not have to use all before the component solves.

The idea is that the component executes on toggling a boolean switch.

Any ideas or suggestions?

Thanks.

kermin


Views: 320

Replies to This Discussion

In RegisterInputParams you can do something like:

pManager.Register_StringParam("MyStr", "str", "Your String","Hello World!" ,GH_ParamAccess.item);
pManager[0].Optional = true;
Sweet. That should work.

Does anyone know if we can bring in datatrees at this point to custom components?
After you register the parameter, pick the one you want to change and set the Access type to GH_ParamAccess.tree When a parameter has a tree access level, you must use DA.GetDataTree inside SolveInstance.
That's what I thought. Is there anything special I need to do or is the code below correct?

If this is correct, then I must be doing something else within the code wrong because that is throwing an error.

Thanks again.

Kermin


'Declare parameter type to datatree
pManager.Register_PointParam("Pts", "Pts", "Reaction Points", GH_ParamAccess.tree)


'Set an empty data tree
Dim ReactionPts As New DataTree(Of Point)

'Read data tree from input
If Not (DA.GetDataTree(0, ReactionPts)) Then Return
Try using GH_Structure instead of Data tree...

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service