February 24, 2016

# Got Data? Make Sure You Know How to Use it

A free tutorial from the Black Spectacles Organization and Working with Data in Grasshopper course.

In this Black Spectacles FREE tutorial, you will learn how to utilize important data within Grasshopper's interface using data trees. This tutorial is part of the Black Spectacles course on Organization and Working with Data in Grasshopper in which you will learn how to utilize Grasshopper in the early stages of your design process to build, modify, and export a model structure.

View the entire course here:
Organization and Working with Data in Grasshopper

The Data Trees Tutorial

Step 1: Deciphering data wires

Throughout your work in Grasshopper, you will see various types of wires or lines. The type of line gives you an idea of the structure of the data that is flowing through it. A single line means there is a single data item flowing through it, and a double line is telling you that there is more than one bit of information coming across. Finally, you will see a double dashed line, which means that there are multiple lists of data items being transferred.

Step 2: Data Trees

The way Grasshopper organizes information is through what’s called Data Trees. To better illustrate this, use the “Parameter Viewer,” which you can find under the “Utility” menu. Click on the viewer, and place it on your canvas.

The reason they are called data trees is that it breaks data into what it refers to as “Branches,” which you can see in the viewer. In this particular case, there are 4 branches, each with 11 values within it. So each of these 4 rows are defined as a branch, and the red pegs are the 11 values within each branch.

If you go back to how your grid is defined, you will see that there’s a 3 as the “X” value and 10 as the “Y” value, but your data tree says 4 and 11. This is because those initial values are the number of cells you have, which is the space in-between the points. So you have 3 cells between your 4 points.

Step 3: Clean up your data

You will see in your data tree you have leading 0’s for each branch like: (0; 0; 0). An easy way to clean that up is to right-click on the “P” on your main component. All of the functions you will see here (with the exception of “Expression”) have something to do with how the data is sorted into branches.

In this case, you will choose “Simplify” which will get rid of those leading zeroes. So if there is just one branch, with no sub-branches, it should have a single integer in the curly brackets like you see in this example. If sub-branches do exist, you will see a semi-colon followed by additional numbers.

Step 4: Create a Series

As you can see from your data tree, the 4 branches are labeled as Branch 0, Branch 1, Branch 2, and Branch 3. The branch that begins from your origin point, where you started the grid, is Branch 0, and the far line would be Branch 3.

So with this particular example, you are creating an Eames house model, which you can see in the below image The way this house is built is there are two primary grid lines along the perimeter of the house – which are branches 0 and 3, and two intermediary grid lines in-between. So we actually want to parse out some of value points, or columns, within branches 1 and 2.

To do that, you are going to use some functions within the “Sets” toolbox. The first component you are going to select in the Sets toolbox is “Series.” This will allow you to develop a 0 through 3 data input component.

Hover over the “S” in your Series data component and make sure the first number is the series is set at 0. Next, hover over the “N” which is the Step Size, which should be set at 1 as you are just dealing with integers. Finally, hover over the “C” which is the Count or the amount of values you have. You want to base that amount of values on how many rows of columns you have. So take the knob with the “3” on it and plug it into the C value.

Now the “C” in your Series data component should say 3 in reference to the cell outlines. But you actually need it to be 4. This number is always going to be 1 + the actual amount of cells you have. So right-click on the “C,” and under “Expression,” go to “Expression Editor.”  Expressions are basically a way of writing algebraic equations, in this case it’s going to be quite simple because you just want to add 1 value to the input source. And that input source is going to be defined as X. So type in X+1 and click “Commit Changes.” Now your “C” value is 4.

Step 5: Data Path

And the final step is to convert the series to paths. A Data Path contains a collection of data tree paths. And a Path is nothing more than a list of integers. It's denoted using curly brackets and semi-colons: {A;B;...}.

Under the “Params” menu, go to the “Primitive” section and select “Data Paths.” Plug the path into the Series “S,” and it will convert that into the data path notation, and so it’s comparable to the “Data with 4 Branches.”

View the video for this tutorial here:

February 24, 2016