Professional Documents
Culture Documents
Contents
[1 2 3 4 ]
1 Introduction
2 Data tree structure
3 How Tree data is handled in components
3.1 Components working on branches from a single input
3.2 Components using multiple inputs
4 Tree Editing
4.1 Flatten Tree
4.2 Graft Tree
4.3 Simplify Tree
4.4 Flip Matrix
4.5 Shift Path
4.6 Clean Tree
4.7 Path mapper
5 Tree Editing continued
5.1 Explode Tree
5.2 Merge
5.3 Relative Item
5.4 Stream Filter
5.5 Stream Gate
5.6 Tree Branch
5.7 Tree Item
6 Working with Tree Branches
6.1 Branch Compare
6.2 Create Branch
6.3 Decompose Branch
6.4 Prune Tree
6.5 Replace Branch
6.6 Split Tree
Introduction
Grasshopper uses, in contrast to a programming environment, no object names to define an object. This may sound
trivial but it one of the most fundamental differences from a traditional modelling environment. In Grasshopper the
object or objects are placed in a list. The different lists of data are organized in a data tree structure where every
branch and data content of the branch have an index number. Accessing the object is therefore more problematic
then in a scripting environment. Grasshopper has various tools to remedy this problem. These tools supports the
editing and selecting the content of the lists and editing the data tree structure. Knowledge of these techniques are
essential for the effective use of Grasshopper.
http://wiki.bk.tudelft.nl/toi-pedia/Grasshopper_Data_Tree_Editing 1/15
8/8/2018 Grasshopper Data Tree Editing - TOI-Pedia
Tree Editing
For an effective use of multiple data lists it is necessary
to make sure that the data is at the same branch level at Branch
the different trees. If this is not the case you will have
to edit the tree structure. There are a wide range of
options for editing the data tree. This already indicates
that there are a wide range of problems you can
encounter with the data structures. Understanding how
to edit them is crucial for effective use of Grasshopper.
The Sets-Tree-Graft Tree option is also one which is used to restructure the data tree structure by adding a branch
to each data item. Grafting is often used in combination with the Flatten Tree option. First the original data branch
structure is deleted and then the data items in the root of the tree will each be placed onto a new branch. This can
be useful for creating a branch structure which is similar to another data tree.
Example: We have a surface and two points. We want to "hang" the surface from the two points by a set of lines. If
we generate a surface couple it to a Params-Geometry-Brep component and then extract a set of points from the
surface with the Surface-Util-Divide Surface option. Connect a slider to the U and V input. For the points we use
http://wiki.bk.tudelft.nl/toi-pedia/Grasshopper_Data_Tree_Editing 4/15
8/8/2018 Grasshopper Data Tree Editing - TOI-Pedia
Simplify Tree
Flip Matrix
Shift Path
The Sets-Tree-Shift Path option looks a bit like a controlled Flatten option. It gives you the possibility to move the
data one or more branches lower or to collapse the data into a single branch similar like the Flatten option however
now placed on a single branch
http://wiki.bk.tudelft.nl/toi-pedia/Grasshopper_Data_Tree_Editing 5/15
8/8/2018 Grasshopper Data Tree Editing - TOI-Pedia
Clean Tree
Path mapper
If we want to place all the data of various branches , say 10 branches {0;0;0},{0;0;1} etc with on each
branch 10 data items, at the same level onto 1 branch which is defined by the user we can for example place
at the source {0;0;0} and at the target { 0;0;0;0} . The result is that all the data items are placed on the
{0;0;0;0} branch.
If we however we want only the branch names to be changed and the data items remain on the branches we
can use an option called Path_index this will give you the option of extracting the amount of branches from
the source and translate the same amount to the target branches. In this case the whole structure with items
and branches is moved to the target branches.
This manipulation of the items of the branch is also possible when we want to have all the first items of all
the branches on a single branch. Say you want to generate a line between all the first items of a branch. In
this case we can use the Path_index on the source {0;0;0}(path_index) and target {0;0;0;path_index}. The
path_index generates the numbers from 0 to 9 The items are selected with index 0 on all the branches and
placed on a target branch {0;0;0;0}
Path_count There is also an option to make a link between the number of items or branches and the index
number of the target branch. For example when the source branch is defined as {0;0;0} and the target branch
as {0;0;0;path_count} the final branch name will be in our case {0;0;0;10} because there are ten branches in
our example.
A similar option is available with the Item_count option. This will define a number based on the amount of
items in a branch.
http://wiki.bk.tudelft.nl/toi-pedia/Grasshopper_Data_Tree_Editing 6/15
8/8/2018 Grasshopper Data Tree Editing - TOI-Pedia
Explode Tree
Merge
Relative Item
Relative Item - The Sets-Tree-Relative Item enables you to extract 2 lists from a single list. The output of the
component is dictated by the Relative Offset input. The offset has two components . The branch offset and the item
offset. When the branch offset is defined as {0;0;0} in the example list where we have 10 branches and 10 items on
the branches nothing happens. The output of A and B are the same and contain the same information as the original
list. There is no offset , because the input list also starts with {0,0,0}. If however we define the offset as {0;0;5} the
Lists of A and B are still the same however they are limited to the first 5 branches of the input list. The rest is
ignored. If we however also offset the items of the branches the lists will change from each other.
With a setting of {0;0;9}(6) representing the branch offset and the item offset the lists of A and B will consist
of 1 branch with in the A List the first 4 items of the first branch and in the B list the last 4 items of the last
original branch.
http://wiki.bk.tudelft.nl/toi-pedia/Grasshopper_Data_Tree_Editing 7/15
8/8/2018 Grasshopper Data Tree Editing - TOI-Pedia
Stream Filter
Stream Gate
Tree Branch
The Sets-Tree-Tree Branch looks a lot like the List Item option in the Lists part of the Sets Tab. It enables you to
extract the data of one or more branches. When 1 branch is defined the output list will contain only the data of that
input branch. If however you define multiple branches, the list will generate new branches where the selected data
items are placed on.
Tree Item
The Sets-Tree-Tree Item differs from Tree Branch because there is an extra input option for selecting specific items
on the branch of the data tree.
http://wiki.bk.tudelft.nl/toi-pedia/Grasshopper_Data_Tree_Editing 8/15
8/8/2018 Grasshopper Data Tree Editing - TOI-Pedia
Branch Compare
10
<10
>10
<=10
>=10
[10-20]
Create Branch
Path Mapper
Decompose Branch
The Sets-Tree-Decompose branch is the reverse of the Create branch option. It will de-construct the index of the
branch into a set of numbers.
Prune Tree
Replace Branch
Split Tree
http://wiki.bk.tudelft.nl/toi-pedia/Grasshopper_Data_Tree_Editing 10/15
8/8/2018 Grasshopper Data Tree Editing - TOI-Pedia
Stream filter
Stream Gate
Tree Branch
http://wiki.bk.tudelft.nl/toi-pedia/Grasshopper_Data_Tree_Editing 11/15
8/8/2018 Grasshopper Data Tree Editing - TOI-Pedia
Tree Item
Branch compare
Create branch
http://wiki.bk.tudelft.nl/toi-pedia/Grasshopper_Data_Tree_Editing 12/15
8/8/2018 Grasshopper Data Tree Editing - TOI-Pedia
Decompose branch
Prune Tree
http://wiki.bk.tudelft.nl/toi-pedia/Grasshopper_Data_Tree_Editing 13/15
8/8/2018 Grasshopper Data Tree Editing - TOI-Pedia
Replace Branch
http://wiki.bk.tudelft.nl/toi-pedia/Grasshopper_Data_Tree_Editing 14/15
8/8/2018 Grasshopper Data Tree Editing - TOI-Pedia
Split Tree
http://wiki.bk.tudelft.nl/toi-pedia/Grasshopper_Data_Tree_Editing 15/15