How to create a Data Tree?

I have a list of closed curves in Csharp:

List<Curve> listCurves = {c1, c2, c3};

I have a point p_i, a vector v_i, a distance d_i and a name n_i associated with each curve c_i.

List<Point> listPoints = {p1, p2, p3};
List<Vector3d> listVectors = {v1, v2, v3};
List<double> listDistances = {d1, d2, d3};
List<string> listNames = {n1, n2, n3};

In Grasshopper, I want to use the Contour component (in order to create a set of equally spaced lines within each curve):

Now, I have two problems:

  1. The first problem is that, if I pass each curve, point, distance and vector to Contour Component, it works perfectly (by using List Item). But if I pass the whole listCurves, listPoints and listVectors directly to Contour component, it gives incorrect output. I suppose that I have to create a data tree for the inputs?

image

  1. In the end, contour components created a data tree of lines for each curves, how can I organise my listNames in order for each line has the curve name? How can I create a data tree of listNames that is compatible with the data tree of line given by contour components?

Thanks,

Graft Contour inputs?

Did you see this thread? Create data tree with c# There is a Datatree Class that you can use in C#.

Another is here: http://james-ramsden.com/data-trees-and-c-in-grasshopper/

In Grasshopper itself you can Graph on branches.

Hi, I tried to graft contour inputs but it did not work. How can I split the output into three branches as the input (one branch for one curve)?

{0;0;x;x;x;x} -> {0;0}
{0;1;x;x;x;x} -> {0;1}
{0;2;x;x;x;x} -> {0;2}

image

Okay, so I managed to get it to work by using Trim Tree and then Match Tree (for listNames). But I have a strange problem when using the Trim by Region components, as you can see there are some lines that were not trimmed (by the horizontal curve). How can I solve this? Is this a bug?

image