Basic Principles Explained

From TOI-Pedia

Introduction

LEVEL: BEGINNER
Expected Time: 30 min
Some of the functions you will learn in this tutorial.

Welcome to the first Grasshopper tutorial on the TOI-Pedia. In this tutorial you will learn the basic actions needed to create the scripts of the beginner tutorials. First you will need to know how to add nodes and geometry to you Grasshopper canvas. Next, some basic functions will be discussed that are important to understand before you continue learning Grasshopper.

During Grasshopper tutorials, several images will display how you should create the script. You may notice that the input and output names of the Grasshopper components are full names, not just one character, which may be the case when you first open Grasshopper. If you want a similar display, take a look at the Display tab and turn on "Draw Full Names".

Adding Nodes to the Canvas

Create a point with the Geometry tab.

Generally speaking, there are two ways to add nodes to the canvas of Grasshopper. First you can select a node by clicking on one of the pull down menus at the top. For example: if you want to add a point to the canvas of Grasshopper, click on geometry and select point:

  • Create a point parameter Params » Geometry » Point

Now you have added a point parameter to the canvas. By right clicking on the point in the canvas, you can select which point in Rhino you want to add to this parameter.

Set one point from Rhino.
  • Set a Rhino point on the Grasshopper parameter RMB on node » Set one Point

The Rhino viewport is now visible. Select the point you want to connect to the Grasshopper parameter.

Create a Grasshopper component by double-clicking on the canvas

A second method of creating a Grasshopper node is by double clicking on the canvas. This method is used most often by designers who are familiar with the Grasshopper interface. However it does mean that you have to know what node you are looking for.

  • Create a node by double clicking on the canvasDouble click on canvas » Type your function


Find the tab this function belongs to by CTRL + ALT.

If you want to know to which tab a node belongs to, hold ctrl+alt and click on the node. This can be useful when you are looking for a function that does something similar, but with a slightly different operation.

  • Find a component in the toolbar CTRL + ALT » Select Node


Inputs

Four different numeric inputs.

One has access to so called "numeric inputs". For numeric inputs the user can select from a predefined range of numbers. The most used numeric input is the "number slider". The slider can be set to any range of numbers, with a predefined precision and whole, odd or even numbers. For this tutorial it is advised to check out the following numeric inputs:


  • Number slider: Params » Input tab » Number Slider
  • Digit scroller: Params » Input tab » Digit Scroller
  • Control knob: Params » Input tab » Control knob
  • MD Slider: Params » Input tab » MD Slider

The ranges of the different numeric inputs can be changed by double clicking on the input.

  • Try changing the slider or scroller to get another output.


Connect a panel to see the output of the numeric input.

To be able to see the output of the values you have to connect a panel to it. This can be done by drawing a connection line between the output of the numeric input and the input of the panel.

  • Add a panel to the canvas Params » Input » Panel

The panel is one of the most used components of Grasshopper. With the panel you are able to see what geometry/points/numbers etc. are generated by a function, or a set of functions.

Disconnect by holding CTRL and draw the connection again.

You can disconnect two nodes by holding CTRL and draw the connection again. Another method is right clicking on the input/output of one of the nodes and select disconnect.

  • Disconnect a wire RMB one of the functions » Disconnect » Disconnect function

Sequences

In addition to numeric inputs, you can also generate a sequence of numbers. If you connect a panel to such a function, you will not only see one output, but a list of outputs. Lists are the main way information is transferred between functions. Therefore it is important that you understand the way a node generates an output.

Three different sequences

For the "beginner tutorials" of the TOI-Pedia, you have to be familiar with three sequence functions:

Series: The most basic way to build a number sequence. Specify the start (S), Size (N) and the amount of values (C) with a numeric input. For this example, connect three different number sliders.

  • Create a Series component Sets » Sequence » Series


Range: The range works by setting a domain (D) and the amount (N) of subdivisions into which the domain will be split. Notice the different names of domain types.

  • Construct a domain Maths » Domain » Construct Domain
  • Create a Range of numbers Sets » Sequence » Range


A range node can also be generated witch just a number slider as input to the domain. In this, your domain will automatically start at the value 0.

  • Repeat the data Sets » Sequence » Repeat Data

Repeat Data: with repeat data the input (D) is repeated until the set number of items (L) is satisfied. The data input, can also be a previously generated list of information that will be repeated.
After reading this chapter you might ask yourself why you would be interested in generating lists of numbers. For designing architecture, are we not supposed to focus on geometry and surfaces? Yes, in a certain way you should focus on geometry. However, Grasshopper is a visual way of building scripts to generate geometry. For example, a list of numbers could lead to a list of points, which then leads to a curve you use for your design.

Generating lists with information, and having the ability to change it easily leading to different geometry is the essence of parametric design.

List Actions

All functions to edit a list. Take a look!

After you created a list with values in Grasshopper, it is important to learn about list actions. Let's say you have created a list of 100 points and now you want to change the height of one of the points. This means you have to be able to edit the list. We call this: list editing.

When you start learning Grasshopper, it is recommended to take a look at the list section in the sets tab. Here you find all the functions you can use to alter your data.

  • Take a look at the list commands: Sets » List


Three list editing functions, check what happens when you change the numeric inputs of the sliders.

In this tutorial you will learn three list options that are important for the "beginner tutorials".

List Item: The list item extracts one item from the list. Take note of the indices in the input list (number in font of the value in the first panel). The indices start at 0. This means, that if you want to retrieve the first number with the list item function, add the number 0 to the Index (I).

  • Create a List Item Sets » List » List Item


List length: this function returns the length of a list with values. Note that the last number in the list always is 1 lower than the list length. This is because of the fact that the list start at index 0.

  • Calculate the length of a list Sets » List » List Length


Shift length: shift list moves the items in the list by the shift value (S). A positive (S) moves the items up in the list and a negative (S) down.

  • Shift a list Sets » List » Shift List
If you want to learn more list editing functions, take a look at the following page: Grasshopper Basic List Actions

Random and Jitter

Random and jitter in a Grasshopper script

One of the nice aspects using the computer to create a design, is that you can use pseudo-random numbers to change it. This can be useful, for example, if you want to populate a surface or plane with objects on random locations. If you would like to do this yourself, take a look at Random Points on Surface. In this chapter you will learn two nodes that are used most often.

Random: This function creates one or a range of pseudo-random numbers in a range (R). The first input is a domain, similar to the Range component we discussed in the sequence chapter. Next, the function asks for an amount of Random numbers (N) between that domain. Finally you have the possibility to add a seed to the function. The seed is, what we call, the internal state of you computer. This state determines what the outcome of the function will be. By right-clicking on the random node, you can change the output to whole numbers, which are called integers in programming language.

  • Generate a list of random numbers Sets » Sequence » Random
  • Set the random generator to integers RMB on Random function » Integer Numbers

Jitter: The jitter function is able to shuffle a list (L). This list can contain any type of data. The node also asks for a jitter value between 0.0 (no shuffle) and 1.0 (complete shuffle). Finally, you can again define a state by changing the seed.

  • Create a jitter Sets » Sequence » Jitter

Baking

As you may notice, geometry from Grasshopper is always red or green. Green indicates that the object is selected in Grasshopper. If you want to be able to move or change the object in Rhino, we have to bake it.

Baked version of your geometry

Right click on the final node and click on bake. This function will create the geometry in Rhino. Disable the preview of the nodes to make sure you don't see the transparent Grasshopper version.

  • Bake the geometry RMB on final script node » Bake

Practice files

In the following links you will find downloadable Grasshopper files that will explain you the basic use of the various components and principles you will probably need while constructing your own definitions. In each file you will find various annotated examples related to the topics below.

Basic Inputs An overview of the various inputs available in Grasshopper [ Download File ]

Basic List Actions An overview of Basic List Actions available in Grasshopper [ Download File ]

Sequences An overview of methods to generate numeric and character sequences (1,2,3 .. 10) in Grasshopper [ Download File ]

Random and Jitter An overview of methods to generate random values and shuffle items in Grasshopper [ Download File ]

This is the end of the first Grasshopper tutorial. You now have enough knowledge to continue with the second tutorial.

Personal tools
Actions
Navigation
Tools