UNSW Making

Grasshopper Basics

Getting Started with Grasshopper in Rhino

Grasshopper is a visual programming language and environment that runs within the Rhinoceros 3D computer-aided design application. Grasshopper is predominantly used for parametric modelling for design, architecture, structural analysis and fabrication.

In the Design Futures Lab we use Grasshopper to create scripts to run some of our digital fabrication equipment. This learn module is to give you a basic understanding of the Grasshopper environment so you can better use the scripts provided.

Introduction

Rhinoceros or Rhino as it is commonly called is primarily a NURBS modelling tool used for industrial design (vehicle design, jewellery design, product design) and architectural form finding.

The word “NURBS” stands for Non-Uniform Rational B-Splines. NURBS are a mathematical model commonly used in computer graphics for generating and representing curves and surfaces. NURBS offers great flexibility and precision for handling both analytic (surfaces defined by common mathematical formulae) and modelled shapes and for this reason they are industry standard for both modelling and manufacturing.

The alternative to the NURBS type geometry definition is called MESH Modelling. Meshes represent a surface using polygons: high accuracy modelling requires a large number of polygons, so the mesh models can become very large. Therefore, meshes are used more for visual modelling rather than fabricated ones.

NURBS v mesh


Grasshopper is a visual programming language and environment that runs within the Rhinoceros 3D computer-aided design application. Grasshopper is predominantly used for parametric modelling for design, architecture, structural analysis and fabrication.

Parametric design is a process based on algorithmic thinking that uses parameters and rules together to create designs. The parameters and rules can be used to manipulate and change the form in real time.

In grasshopper is important to note that you will most commonly be working with NURB surfaces and NURB curves.

NURB curves are defined by degree, control points, and knots.

Degree: The degree is a positive whole number. This number is usually 1, 2, 3 or 5, but can be any positive whole number. The degree of the curve determines the range of influence the control points have on a curve; where the higher the degree, the larger the range. NURBS lines and polylines are usually degree 1, NURBS circles are degree 2, and most free-form curves are degree 3 or 5.

Control Points: The control points are a list of at least degree+1 points. One of the easiest ways to change the shape of a NURBS curve is to move its control points.

Weight: Control points have an associated number called a weight . Weights are usually positive numbers. When a curve’s control points all have the same weight (usually 1), the curve is called non-rational, otherwise the curve is called rational. Most NURBS curves are non-rational. A few NURBS curves, such as circles and ellipses, are always rational.

Knots: Knots are a list of (degree+N-1) numbers, where N is the number of control points.

Edit Points: Points on the curve evaluated at knot averages. Edit points are like control points except they are always located on the curve and moving one edit point generally changes the shape of the entire curve (moving one control point only changes the shape of the curve locally). Edit points are useful when you need a point on the interior of a curve to pass exactly through a certain location.

Endpoint curve knots



Let's have a look at a video by The Different Design on youtube who are an educational and research platform interested in all things parametric design.

This video shows you the basics of parametric design in Grasshopper with this quick tutorial introducing the Grasshopper interface, Grasshopper components and creating your first parametric algorithm.

The Rhino and Grasshopper Interface


If you have Rhino 6 and onwards you will be able to access grasshopper by selecting the Grasshopper icon from your main tool bar in rhino. Otherwise you can simply type GRASSHOPPER in the command bar.

main tool bar


This will bring up the a basic interface for grasshopper. We have the main toolbar when you can save and load files, undo/redo, change the display settings and user interface etc. We then have the toolbar for parameters and components that are organised into different categories. There are a range of subtabs organising components into similar groups.

Toolbar


There is also the Canvas where the grasshopper definitions is created.

Canvas

To start building your definition you can either searching for parameters, functions or components through the drop-down menu. Otherwise, you can hit the space bar which will bring up a search box on your canvas, from here you can type key words to start your definition and look for different components. Try searching for rectangle, circle, line, curve and see all the different options that come up!

Search function

Category Tabs


Params

Parameters in grasshoppers can be considered empty “Containers” which store data which can be inclusive of, numbers, colours, points, geometries such as curves, surfaces, BREPS, meshes. They can reference information modelled in Rhino or can store data from grasshopper.

Params



Maths

The Maths tab gives you access to a range of mathematical functions. This image shows the most common maths functions that are used widely throughout grasshopper scripting. If there is not a component with the maths function you need you can use the expression tool that allows you to create your own equations, statements, or functions. All these functions allow manipulate geometry and use algorithmic design.

MATHS



Sets (Lists and Data Trees)

Sets are ways to create, modify, combined and separate lists or data that is carried from component to component in grasshopper. In the image to the right, we can see some of the most used list and data tree tools. Data management is key to a successful grasshopper script especially if you are working with a lot of data, or a lot of geometry. When storing data in a list, it’s helpful to know the position of each item in that list so that we can begin to access or manipulate certain items. The position of an item in the list is called its index number seen on the left.

Data is often referred to as a tree in grasshopper. A Data Tree is a hierarchical structure for storing data in nested lists. These nested sub-lists work in the same way as folder structures on your computer in that accessing indexed items require moving through paths that are informed by their generation of parent lists and their own sub-index. Some of the functions seen here (image below) such as flatten, graft, simplify can generally be used by right clicking on the inputs or outputs of any component – that’s how important they are! I suggest watching the linked video to get a better understand of the role they play.

Sets List and Data Tress

There is more information about how to use lists and data trees below.




Vectors

A vector is an object that has both a magnitude and a direction. In grasshopper by default, we cannot visualise a vector, we need to create an anchor point for it first. Vectors are crucial to moving, scaling, extrusion and modifying our geometries. The vector tab in grasshopper also includes all the plane functions. In mathematics, a plane is a flat, two-dimensional surface that extends indefinitely. Planes created in grasshopper are 3D and have an XYZ coordinate and a RX RY RZ rotational value. We can use planes as bases to draw geometry, project geometry too, or to orient objects. - This image is a range of vector and plane tools that are commonly used in grasshopper. As you can see vectors as outputs alone are previewed off always.

Vectors

Curves

Curves are fundamental elements used to represent and manipulate geometry. Grasshopper provides a range of components that can be used to create, analyse, and modify curves. Here are some key curve components commonly used in Grasshopper. By combining and manipulating these components, you can create complex geometry and perform various operations on curves within the Grasshopper environment.

Vectors


Plugins for Grasshopper


How to install and the most useful ones!

Grasshopper plugins are additional software modules or extensions that can be installed to enhance its functionality and provide additional tools, components and capabilities. These plugins are created by third-party developers and one of the advantages of Grasshopper is that they can be integrated seamlessly into the grasshopper environment.

This video explains how to install plugins into Grasshopper

Here are some plugins that are great for beginners or those interested in experimenting further. Most plugins can be downloaded for free from the Food4Rhino website— https://www.food4rhino.com/en.

Bifocals- Bifocals is a great plugin for beginners, as it displays both names and icons of components on the Grasshopper canvas. This makes it easier to identify the unique input and output requirements of specific components.

Weaverbird- Weaverbird brings mesh editing, subdivision and mesh transformations to Rhino and Grasshopper users.

Lunchbox - LunchBox is a plug-in for Grasshopper for exploring mathematical shapes, paneling, structures, and workflow.  It has also introduced new components for general machine learning implementations such as regression analysis, clustering, and networks. Note: Lunchbox is only supported on windows, however I managed to download an older zip file version that installed fine on a mac.

Pufferfish - This plugin is a set of 330 components which focuses on Tweens, Blends, Morphs, Averages, Transformations, & Interpolations - essentially Shape Changing. Pufferfish mainly uses parameters and factors for inputs for more custom control over operations like tweens and grids as opposed to grasshoppers usual division count inputs.

Some plugins like the Weaverbird above will have an execution file that will automatically load them into Grasshopper. However most will need to installed manually

When you have downloaded the plug-ins you normally need to right click on the downloaded files in explorer. Check the properties tab and make sure the files are 'UNBLOCK', make sure you check all of them just in case – otherwise the plugins won’t work. This step usually doesn't need to be performed for a Mac.

The plugins then need to be copied into the Components folder found at this file location C:\Users\[YOURUSERNAME]\AppData\Roaming\Grasshopper\Libraries

Or alternative the folder can be found in grasshopper at by clicking on the file tab > special folders > Components folder.

Make sure to restart both rhino and grasshopper to install them properly They will appear as a tab on your grasshopper canvas.

Plugin

Object Colour


Components, parameters, and functions can all change colour based on whether it is functioning correctly or not.

Light grey - Represents a working component with no issues, if it is geometry, it will also be visible in Rhino.

Dark grey - Represent a hidden component (not visible in rhino), although this still means what even function is completely is still completely active within the grasshopper script and working.

Orange - Orange represents a warning signal, this could be a missing input, such as forgetting to reference a point from rhino, leaving the parameter empty or having a mismatching data. In some cases, the component will still be functioning but is close to failing and should be investigated. If you click on the orange balloon it will give you a hint of what is wrong.

Red – Red represents when a component or function is not working as it is supposed to (an error has occurred). Typically, what occurs here is the wrong type of geometry or data has been plugged into the wrong input. In the image below a surface has been plugged into the point container which is the wrong input type. There is a range of errors that can occur, so make sure to check the balloon for assistance.

Categories: Communications
Tags: Grasshopper