Hi,
I’m trying to create a Grasshopper plugin with C#, where I want to create a data tree with different branches. I have a List<> of Point3d[] where I want every element in the list to be a separate branch, and the array of Point3d should fill up every branch. But I can not figure out how to add a new branch to the data tree.
This is the code that I have:
List<Point3d[]> points = new List<Point3d[]>();
Grasshopper.DataTree<Point3d> points2 = new Grasshopper.DataTree<Point3d>();
Grasshopper.Kernel.Data.GH_Path tempPath = new Grasshopper.Kernel.Data.GH_Path();
// intersections if of type List<Curve>
for (int i = 0; i < intersections.Count; i++)
{
// Here is some code to modify the curves that is removed for this exemple
// Divide every curve and put them in temp
Point3d[] temp = null;
intersections[i].DivideByCount(numberOfDivisions, true, out temp);
// How do I create a new branch?!
points2.AddRange(temp, tempPath);
}
How do I do this? Any suggestions?
Alternatively I could partition a list that holds all of the points, but I can not figure out to do that either…
Thanks!