algorithmic modeling for Rhino
Tags:
'replace object with your specific type....
Dim myInputDataTree as New DataTree(of Object)
Dim myFlattenedList as New List(of Object)
DA.GetDataTree(someIndex, myInputDataTree)
myFlattenedList = myInputDataTree.AllData()
Dim data As GH_Structure(Of GH_Line) = Nothing
If (Not DA.GetDataTree(0, data)) Then Return
I found this tread very useful, thank you. For anyone interested in flattening input data in C#, I found that the following works:
<code> GH_Structure<GH_String> in_IDtree = new GH_Structure<GH_String>();
if(! DA.GetDataTree<GH_String>(0,out in_IDtree)) return;
List<GH_String> inIDList = new List<GH_String>(in_IDtree.FlattenData());</code>
I might add one thing here, could be useful for someone.
If you want to "enforce" flattening refer above, but if you want to leave flattening at the discretion of the user, but set the default to be flattened when the component is added to the canvas, add a line of code like below to the register input method:
pManager[0].DataMapping = GH_DataMapping.flatten;
Cheers,
Jon
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by