Data Types in Grasshopper

Bradenkoh
All Things Computational
4 min readJan 31, 2022

--

Hi there,

Welcome back. Today’s edition of the Newsletter is going to be all about Data Types in Grasshopper.

If you know anything about programming and computers, the idea that data comes in different types won’t be new to you. This might be a basic concept but one that I think still needs to be explained before we move on to more complex topics in Grasshopper.

Essentially, data is handled differently by the computer depending on its type. Data isn’t just 1 and 0s like they make out in the movie and it isn’t just gibberish either. It actually comes in many forms. Text, numbers, videos, pictures, etc. Each different type has to be handled differently to get the best used out of each type. For example, you can’t tell a computer to perform arithmetic like + and - on words, it just won’t know what to do.

Data Types in Grasshopper

The majority of data types that are used in Grasshopper fall into three categories. Two of which, we use within our day-to-day lives. These are numbers and text. However, computers take it a step further and break up these two categories into their own sub-category.

Take the numbers category for example. Within the umbrella of numbers, double is a subset data type that solely deals with numbers that have decimal points. While intare data types that deal with round numbers.

The third category is one that is more unique to Grasshopper and that is basegeometry. Because Grasshopper primarily deals with geometry information, the makers of Grasshopper felt it necessary to create data types for different types of geometry.

The best way to show this is to visually view the different data types in Grasshopper itself.

Figure 1: Blank Grasshopper / Rhino File

To view the different data types in Grasshopper, we can use Data Containers which can be found under the params tabs and under the Primitive and the geometry group.

Figure 2: Grasshopper Primitives

But my favorite way is either to double-click or hit the spacebar on the canvas to search for the containers that I want.

Figure 3: Grasshopper Canvas Search

For example, if I now bring up a point and a curve container in the canvas

Figure 4: Point and Curve Container in Grasshopper Canvas

Then draw a line and a point in Rhino using the Line and point command

Figure 5: Point and Line in the Rhino Environment

Reference that geometry in Grasshopper

Figure 6: Referencing a Curve in Grasshopper

You can see that Grasshopper has been able to reference those different types of data.

But, if you try and feed this curve into the point data container, Grasshopper will complain about it.

Figure 7: Converting Curve into a point Error

This means that the data you pass into the different containers must be of a similar type. A curvecannot be converted into point because they are different types of data with different information.

Final Thoughts

I know this seems like a lot to take in, especially if you are not familiar with the concept of different data types. It can be overwhelming to think about all the different data types at once but my advice is to not worry about it for now.

Because the more you use Grasshopper, the more this will become intuitive. Soon, understanding different data types will become second nature.

Sp, try playing around with a couple of data containers and types but don’t stress if you can’t remember or don’t understand them.

In the next edition, we will start by looking at how points work. If you are interested in learning more, stick around and subscribe.

Thanks for reading.

Braden

P.S. I also have a Youtube channel and made a video explaining this edition of this Newsletter

Originally published at https://allthingscomputational.substack.com on January 31, 2022.

--

--

Bradenkoh
All Things Computational

Engineer. Programmer. Computational Designer. Currently in Sydney.