10 Lessons to Jump-Start in Grasshopper3D
Updated: Jul 13, 2022
Intro
Grasshopper (GH) can be very confusing to someone who is familiar with 3D modelling but is not used to scripting or working with algorithms. To avoid having a rough start with this program one has to approach this with a different mentality and priority system than what most people become accustomed to. It helps to think of every step or "definition", as a command component accompanied by the input parameters. You have to think about constructing geometry from very primitive information and develop it through different components. In this tutorial I'll cover simple ones such as "move," "line," and "ruled surface" in order to cover the basics of the GH interface and everything else you need to know to start experimenting with the program. If you follow the steps in this tutorial you should end up with something like this:
This font indicates that this text is an instruction to follow in your own window..
This font indicates this text is an explanation about the program itself.
Getting Started
To begin using the program, download and install GH using the instructions from this link if you have not done so already. Open the version of Rhino you have installed and type Grasshopper into the command line and press enter. Set up a split screen between Rhino and GH like it is shown below, unless you are able to use two monitors.
You will be working mostly in GH and will only check on your project progress in the Rhino window.
1. Program Structure
These "blocks" with text are referred to as "components," a string of several components is referred to as a "script". The center stripe of each component contains the name or description of the component. The items on the left are the input requirements for that component. The items on the right are the output or results of the component.
.
To get started, double click anywhere on the canvas (the grid) to search for the component names shown below (Construct point and Move).
Note that components may have slightly different names depending on your GH version, however the symbols will be the same. Construct point may appear as Point XYZ. The point component you are looking for will have x, y, and z coordinate inputs.
Click once over the semi-circles next to the component titles to create a "wire," click over a different component to connect the "wire." Note that inputs can only connect to outputs, and vice versa.
Holding shift can connect several outputs to a single input.
Right clicking the Input or Output titles to disconnect wires by selecting it in the drop down menu.
2. Data Format
Hover the mouse over the input to provide yourself with the parameter or data you must connect.
Since Construct Point component has coordinates as inputs and a point as a result, it is self-explanatory, so I will explain the Move component in a way that applies to every component.
In this case, we see that the top input for the "move" component is titled "geometry." Simple enough.
Hover over the Motion input this time to see the what the component is asking for.
Note that most components have predetermined values for certain inputs. The predetermined values for Construct Point are all zero, placing it at the origin.
The bottom input for Motion requires "Translation Vector ," which could sound confusing if you are seeing it for the first time. However, notice that the defined value underneath contains: (0.0, 0.0, 10.0), which along with the fact that the new point is above the original indicates that the input is in x,y,z form; moving 10 units in the Z-axis.
3. Component Search
What I have done here is simply introduced a Unit Z by typing it into the component search. This designates an axis to a numerical value, and by typing the number 5 into the component search and hitting enter I have created a number slider with the value of 5 (Don't search for number slider at this point, just an integer). The components have then been organized and connected in a way that the operation is clear and the wires do not overlap.
Typically, when you search for a component the closest results appear in order from bottom to top. When typing an integer, only Number Slider appears at which point you may hit enter to create the component.
Some people like to line up all number sliders vertically along the left side of the canvas in order to edit all values in one place, but how you organize your scripts is up to you.
Something that made me lose patience very quickly with other online tutorials was seeing new components pop out of the blue. For this reason I chose to show the full component names, so that by double clicking anywhere in the canvas, you can search any component and select from a list of results.
.
To further demonstrate the importance of checking the values carried into the component inputs, I have changed from the Z-axis to the X-axis. You do this simply by searching for Unit X. Notice that the value 5 can now be seen in the x placement of the x,y,z format:
4. Menu
To find something specific through the menu, you first need to answer to questions: What and How? In this case, the "what" is a curve and the "how" leads to the primitive category, in which line is located as shown.
The Analysis category is found under almost every "Tab" (the what), and typically deconstructs the geometry in question into different data.
The Primitive category is also very common, and contains basic operations.
Other Tabs have different categories, make sure to investigate to familiarize yourself with what sort of things you can do.
Click once on the component and a second time on the canvas places the component anywhere you wish. In the following image you can see I have connected the Move as my Starting Point and the Construct Point as the End Point:
In the next image I selected the Move component and the motion data and copied it (Ctrl+C and Ctrl+V/ Cmd+C and Cmd+V) to the right in order to move the curve I just created. Notice I also switched the X-Unit to a Z-Unit:
Remember that right clicking the Input or Output titles would allow you to disconnect wires by selecting it in the drop down menu.
5.Grouping
Grouping can be used to further visually organize your scripts. In order to group, select the components you wish to group. Notice the ones I have selected are shown in green.
Press Space Bar while the mouse hovers anywhere over the canvas to open a small Menu, I have highlighted the Group icon in the image-
After you click the Group icon, the group will manifest itself as a purple box.
Since the group overlaps another component that does not belong in the group (show above), I wish to change the shape of the colored area. Clicking twice on the purple region changes its display:
Right clicking the colored region of the group brings up some more preferences, such as color:
This way, I can identify any kind of components or scripts that I wish to group easily. In this case, I have grouped all the move components and their respective motion inputs.
Connect the Line to the newly created Move for the following-
There are many ways to create Surfaces from Curves. In this case, the Primitive category contains mostly 3D geometry, however the Freeform category contains many surface components generated from curves. Hovering the mouse over the components in the Menu shows the component name, as well as a short description which typically clues the result and the necessary input data.
Once you get more comfortable with the program, you should be able to create the necessary input data from the Analysis categories if they are not already present in your script.
Connect the Lines to the Ruled Surface component in any order creates the following Surface:
6. Creating a Series
Unlike a number slider, a Series has several numerical outputs. This means that any geometry can be modified by more than one numerical value or parameter. To begin, I have created another Move component with a Unit-Y plugged into Motion:
The series is then connected to the Unit-Y to determine the values of the Move component:
The series requires three different inputs. Start determines the first value of the series. Step determines how much is added onto the Start value (20 + 5 = 25). Count determines how many values we wish to create, and ultimately, how many times the geometry is repeated (observe below):
Here we can see that the first Moved surface is 20 units away from the original, and that there are a total of 10 surfaces, each with 5 units of separation.
7. Number Sliders
Double-click the number slider where it says "Number Slider" in order to edit its parameters.
If your script isn't too heavy, "sliding" the values can give you immediate results of the changes occurring to the geometry.
For this particular Number Slider, which pertains to the Step input of the Series from the previous step, I have altered its Title, Rounding, Minimum Value, and Numeric Value.
1. Name- makes it easily identifiable
2. Rounding- Adds decimals to the value
3. Minimum Value- the lowest value on the slider.
Remember to click the (+) sign to change it to a (-) sign.
4. Numeric Value- its active value
Notice that by altering the Step input to a negative number, the surfaces are now moved in the opposite direction on the Y-Axis.
The number slider now allows many more possible values when altering the properties.
8. Geometry Color and View
To change the display options of Grasshopper geometry, there are several options on the right side of the GH window as pointed out below..
Altering the viewport properties in the Rhino settings can change the display of Rhino geometry and background, which can be useful for composing diagrammatic images in Photoshop. Altering the display of GH geometry can add to your diagrams.
The symbol circled below changes the opacity and color of the visible and selected geometry. Notice I have changed the color from the default Red to a less opaque white.
9. Rhino Exchange
There are ways to interlace Rhino geometry with GH script as well as "materializing" GH geometry to be edited in Rhino. To alter Rhino geometry in GH, search for the Curve component. The GH components that have a black background with a white symbol can be assigned Rhino geometry.
The collection of assignable components are located at the left-most tab named Params. Under geometry, look for Curve.
After placing the Curve component in the canvas, create a curve in Rhino onto which the entire script will be applied from the point in which the curve was created.
To create the curve shown below, I used the curve tool in Rhino shown here on the right-
Once the curve in Rhino is selected to be put into GH, right click the Curve component that was created earlier, and click on "Set One Curve." Notice you could also create several curves in Rhino, select them all, and click on "Set Multiple Curves" instead.
The new curves component is then connected to the components to which Line used to be connected; the Move and Ruled Surface components.
If done correctly, the result should look something like this-
To export the geometry to be used in Rhino, right click the component with the resulting geometry (the last Move component) and click "Bake..."
There are several options for the geometry including which layer to export it to, grouping all the geometry together, and display options such as "shaded" and "rendered."
Above, the "Baked" geometry is now existing in Rhino and overlapping with the GH geometry from which is was exported.
10. Saving Scripts
When you have created a script that you feel would be useful in the future, save it as its own file. I have a folder with several different scripts that can be applied to different geometries and different situations. Make sure to always maintain decent organization within your scripts in order to use them in the future. Older scripts can be imported by Copy-Paste.
Have Fun!
Leave comments below of what you think and what you would like to see next!