This article explains how to use Tree Branch to extract branch data.


On the Grasshopper, it is represented by either of the two above.
Extracting branches
Tree Branch can be used to extract the branch of a data structure.

In this case, Entwine combines data with four numbers into three branches.
This branches will be used to explain the process.

Components used: (1) Entwine (2) Tree Branch
Connect the data in the branch data to the Tree Branch(T).
In this case, the Entwine(R) is connected.
Connect the letters and numbers of the branch itself to the Tree Branch(P).
In the case of the above image, the first branch is {0;0}, so {0;0} is connected.
Then, the data in the branch of {0;0} is extracted and output.
In this case, the numbers 0, 1, 2, and 3 in {0;0} were output.

Now I changed the input branch from {0;0} to {0;1}.
This time, data from the {0;1} branch was extracted.
As you can see, by specifying the branch in the Tree Branch, you can extract only the data in a specific branch.

Multiple branches can also be specified.
In this case, we specified two branches, {0;0} and {0;1}.
Then, the data in the {0;0} and {0;1} branches could be extracted together.
For the simplest branches, the branch can be specified numerically.
In the case of the simplest branches, such as {0} and {1}, the branch can be specified numerically.

In this case, right-click the Entwine(R) and set it to Simplify.

Then a mark like “Y” appears on the Entwine(R).
This completes the setting to Simplify.

If you look at the branch in this state, you will see that it is the simplest branch.
In such a branch, you can also specify the branch by connecting the numbers to the Tree Branch(P).

At first, we specified a number of 0’s with the Number Slider.
Then the data in the {0} hierarchy is extracted and output.

Next, a number of 1 is specified in the Number Slider.
Then, data in the {1} hierarchy was extracted and output.
As you can see, the simplest branches can be specified numerically.
When specifying a complex branch with numerical values
Although it is a bit forced, by using Text Join, even complex branches can be specified numerically.

Additional Components: (1) Text Join
In this case, we will create a branch such as {0;0} or {0;1}.
Prepare “{0;”, “number” and “} ] respectively and connect them to the Text Join(T) in turn.
Then, the prepared letters and numbers are merged.
Then, {0; number} is created, and by changing the number of the Number Slider, the branch can be specified with any number.
Finally, the the Text Join(R) is connected to the Tree Branch(P).
In this case, a branch of {0;0} is created, so the branch data of {0;0} is extracted.

This time, by setting the number to 1, the branch created is {0;1}, and the data in the {0;1} branch is extracted.
List of Grasshopper articles using Tree Branch component↓
Comment