In Grasshopper you can retrieve branches from data trees with Tree Branch. This works with a single branch and also with a set of branches.
For a good introduction on Grasshopper’s Data Trees read this page from TU Delft.
New to Grasshopper? I suggest you read this article in the first place.
Need more learning resources? Check this out.
Disclaimer
As you will see in my screenshots most components carry a title above them displaying their name. This is because I use a plugin called Bifocals.
Also you’ll see my Grasshopper tab titles abbreviated because there’s not enough horizontal space. I will mention the titles in full in my script though.
Branch and Path mean the same thing. That’s Grasshopper data tree jargon. Put in other words, branch equals path.
Create a Triangular Grid
Let’s take a Triangular grid pattern as an example:
List Item
Let’s assume you want to retrieve one of the triangles. When you connect a List Item to TriGrid’s output you’ll see that it provides a whole set of triangles instead:
A Panel reveals that indeed List Item extracts not 1 element (= 1 triangle) but 1 out of each branch of our TriGrid data tree:
(The number of items in each branch differs according to TriGrid’s input.)
As you see, List Item by itself doesn’t work here.
Tree Branch
We want to single out 1 branch of our tree. To do this, we choose Tree Branch:
Connected to TriGrid’s output is demands for a P (ath) input:
Double-click on the canvas, write “0;0;0” and hit Return:
Feed this panel into Tree Branch’s P input:
As you see Tree Branch retrieves 1 branch (in my example the first of them).
When you connect your List item to B output you will have extracted exactly 1 triangle:
Extract Set of Branches
To retrieve more than one branch, double-click your text panel feeding Tree Branch’s P input and simply add more paths:
Don’t forget to turn your panel in Multiline Data mode your panel should look like this:
For a good introduction on Grasshopper’s Data Trees read this page from TU Delft.
New to Grasshopper? I suggest you read this article in the first place.
Need more learning resources? Check this out.
Leave a Reply
You must be logged in to post a comment.