I’ve watched all of these videos:
Spend an some time with the creator of Grasshopper, David Rutten, to learn one of the key concepts of Grasshopper, data trees. This series covers what data trees…
And I’ve also looked at many more, for example this video:
But I still don’t understand how to manipulate a 1D list that I know relates to a corresponding 2D list. Also, I might be confused how a list of lists differs from a 2D array or a tree…
Here’s what I want to do:
I have a list of points. I want another list, with the exact same layout or structure, that instead contains the
distance to the end of the lines they’re on.
Now, to accomplish this, I have another list of curves. The point list is sorted that there’s a number of points per curve.
I’m at a complete loss, despite watching all of the above and more, at how to accomplish this.
1D-to-affect-2D.gh (43.9 KB)
is this what you want?
the points, line and length are in the same level in the tree, easier to extract later on.
And this will put them on the same branch in a single tree:
btw I do not understand data trees completely.
I prefer using Python nested arrays, then using the tree_helper methods.
i think you just need to graft your 14 end points to the 14 branches of points.
Thank you, this is going to take me a while to digest.
This seems to be a super clean solution, thank you very much!
“Graft” is the key that I was missing. I see what it does, and I get the metaphor, but I don’t fully understand the
how yet, but I will get there.
Can I ask a follow-up question?
I want to place rectangles on all of those points now, with their X-size influenced by the distance we just calculated. Is it correct to just push the list of points into the rectangle, and, just for a simplified example, the list of distances into the X-size, because both lists are formatted the same?
sort of. A rectangle’s X-Size in relation to what plane?
With an ordered list it might be to connect points.
I cut that out of the example file I posted, but it seems like it worked:
The result is really cool, but I can’t show that on this forum!
Nice!! Give this a gander as well, really helpful in understanding how to work with Lists and Trees.