Data Tree Structure 01 (GH)

This post is the first in a series exploring how Grasshopper manages data and how it can be manipulated.

Let’s get started!

What is data?


In Grasshopper by data we mean any sort of information that need to work with. Data can be in the shape of geometry (points, curves, surfaces and …), numbers (integers, floats, domains and …) or other (bool, Date, GUID and …). The data can also come different sources either internally say from Rhino or externally from an excel sheet or even other softwares such as Revit.

 
Plastic Bags.jpg

Item, List, Tree and Plastic Bags:



Data in GH can be categorised into three classes; item, List and Tree. The difference between the three is the quantity of the data and how they’re organised. The simplest of the three is the Item, where there’s a single datum (in this case A). The second one is the List where there is more than one datum (A,B,C). Now what happens when you have multiple Lists of data? On the right hand side you can see that there are three lists of data assembeled.

The easiest way for me to visualise this is to imagine data as a plastic bag or container. If we have a single object in this container, then we have an Item. If there are more than one item in there, then we have a List. And if we have multiple containers within the container then it’s a Tree.

Tip #1: In a Tree structure the number of items in each list does not need to be the same. For instance in the Tree example to the right, the first list has three items in it, and the second list has two items inside.

 
Data - Item.png

Item:



An example of an Item is a point. The example to the right is a Data container with a single point stored inside. To visualise the content of a container we can use a Panel. By connecting the Data container to the panel we can see more detail about the data. In this case we can see the point’s coordinates; x=0, y=750, z=0. Something to watch out here is the shape of the string coming out of the Data container. If the data is an Item, Grasshopper shows this using a single line.

 
Data - List.png

List:



If we have more than one point, the data is not called a List. From the Panel we can see that the data looks very similar to the Item but in this case we have 11 items. What’s also different here is that a List is visualised with a double line.

 
Step 04.jpg

Tree:



A Tree data sturcture can be imagines as multiple Lists. In our case we have a Tree with two branches (0;0 and 0;1) and each branch has 11 items. Trees are visualised as dashed lines in Grasshopper.

Tip #2: Grasshopper counts the data from 0. In this example the last item of the list is number 10, this means that the List contains 11 items.

Next
Next

MetaBall Part 01