generative modeling for Rhino
knowing that grasshopper can´t handle jagged arrays as output, there is an example about how to use datatree to take data from an array and drop them in an "path of paths" ?
DataTree <Line> MyTree = new DataTree <Line>();
List <Line> MYLines= new List <Line>();
List <Point3d> MYPoints = new List <Point3d>(); // points in each line
for ( bla; bla; bla)
GH_Path p = new GH_Path(i);
MyTree.Add(MyLines[i], p) // adding each line in a path
how can I add paths inside each path to include points?
Here is an example of turning a list of curve array into a GH structure (tree).
Hope it be helpful.
bool ArrayToTree(List<Rhino.Geometry.Line> rhArray, ref GH_Structure<GH_Line> ghTree)
int k = 0;
int m = 0;
foreach (Rhino.Geometry.Line row in rhArray)
if (row.Length > 0)
var path = new GH_Path(k++);
m = 0;
foreach (Rhino.Geometry.Line line in row)
ghTree.Insert(new GH_Line(line), path, m++);
nice and clear.
why you use the GH_Structure and GH_Line type to get back data from the ArrayToTree function ?
why not a tree, and Line?
by the way : what are the diferences between both spacenames?
when can we use each?
and where can I found the GH_ spacename?