Professional Documents
Culture Documents
Grasshopper is a graphical algorithm editor tightly integrated with Rhinos 3-D modeling tools, allowing
designers to build form generators from the simple to the awe-inspiring.
WELCOME
You have just opened the third edition of the Grasshopper Primer. This primer was originally written by Andrew O.
Payne of Lift Architects for Rhino4 and Grasshopper version 0.6.0007 which, at the time of its release, was a giant
upgrade to the already robust Grasshopper platform. We now find ourselves at another critical shift in Grasshopper
development, so a much needed update to the existing primer was in order. We are thrilled to add this updated, and
now web -b ased, primer to the many amazing contributions put forth by Grasshopper community members.
With an already excellent foundation from which to build, our team at Mode Lab went to work designing and
developing the look and feel of the third edition. This revision provides a comprehensive guide to the most current
Grasshopper build, version 0.90076, highlighting what we feel are some of the most exciting feature updates. The
revised text, graphics, and working examples are intended to teach visual programming to the absolute beginner,
as well as provide a quick introduction to Generative Design workflows for the seasoned veteran. It is our goal that
this primer will serve as a field guide to new and existing users looking to navigate the ins and outs of using
Grasshopper in their creative practice.
This primer introduces you to the fundamental concepts and essential skill-building workflows to effectively use
Grasshopper. Foundations is the first volume in a forthcoming collection of Grasshopper primers. Here's what you
can expect to learn from the primer:
Introduction - What is Grasshopper and how is it being used?
Hello Grasshopper - Make your first definition
Anatomy of a Grasshopper Definition - What makes up a definition?
Building Blocks of Algorithms - Start simple and build complexity
Designing with Lists - What's a list and how do I manage them?
Designing with Data Trees - What's a data structure and what do they mean for my process?
About
If you would like to contribute to this project, check out the github project wiki to get started
(https://github.com/modelab/grasshopper-primer/wiki).
ACKNOWLEDGEMENTS
A special thanks to David Rutten for the endless inspiration and invaluable work pioneering Grasshopper. We
would also like to thank Andrew O. Payne for providing the assets from which this work initiated. Lastly, many
thanks to Bob McNeel and everyone at Robert McNeel & Associates for their generous support over the years.
REQUIRED SOFTWARE
Rhino5
Rhino 5.0 is the market leader in industrial design modeling software. Highly complicated shapes can be directly
modeled or acquired through 3D digitizers. With its powerful NURBS based engine Rhino 5.0 can create, edit,
analyze, and translate curves, surfaces, and solids. There are no limits on complexity, degree, or size.
http://www.rhino3d.com/download/rhino/5/latest
Grasshopper
For designers who are exploring new shapes using generative algorithms, Grasshopper is a graphical algorithm
editor tightly integrated with Rhinos 3D modeling tools. Unlike RhinoScript or Python, Grasshopper requires no
knowledge of the abstract syntax of scripting, but still allows designers to build form generators from the simple to
the awe inspiring.
http://www.grasshopper3d.com/page/download-1
About
FORUMS
The Grasshopper forum is very active and offers a wonderful resource for posting questions/answers and finding
help on just about anything. The forum has categories for general discussion, errors & bugs, samples & examples,
and FAQ.
http://www.grasshopper3d.com/forum
The Common Questions section of the Grasshopper site contains answers to many questions you may have, as
well as helpful links:
http://www.grasshopper3d.com/notes/index/allNotes
For more general questions pertaining to Rhino3D be sure to check out the McNeel Forum powered by Discourse.
http://discourse.mcneel.com/
LICENSING INFORMATION
The Grasshopper Primer is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0
Unported license. The full text of this license is available here: http://creativecommons.org/licenses/by-ncsa/3.0/us/legalcode
About
Table of Contents
0. About
0.1. Grasshopper - an Overview
0.2. Grasshopper in Action
1. Foundations
1.1. Hello Grasshopper!
1.1.1. Installing and Launching Grasshopper
1.1.2. The Grasshopper UI
1.1.3. Talking to Rhino
1.2. Anatomy of a Grasshopper Definition
1.2.1. Grasshopper Object Types
1.2.2. Grasshopper Component Parts
1.2.3. Data Types
1.2.4. Wiring Components
1.2.5. The Grasshopper Definition
1.3. Building Blocks of Algorithms
1.3.1. Points Planes & Vectors
1.3.2. Working With Attractors
1.3.3. Mathematics, Expressions & Conditionals
1.3.4. Domains & Color
1.3.5. Booleans and Logical Operators
1.4. Designing with Lists
1.4.1. Curve Geometry
1.4.2. What is a List?
1.4.3. Data Stream Matching
1.4.4. Creating Lists
1.4.5. List Visualization
1.4.6. List Management
1.4.7. Working with Lists
1.5. Designing with Data Trees
1.5.1. Surface Geometry
1.5.2. What is a Data Tree?
1.5.3. Creating Data Trees
1.5.4. Working with Data Trees
1.6. Getting Started with Meshes
1.6.1. What is a Mesh?
1.6.2. Understanding Topology
1.6.3. Creating Meshes
1.6.4. Mesh Operations
1.6.5. Mesh Interactions
1.6.6. Working with Mesh Geometry
2. Extensions
2.1. Element*
2.1.1. Introduction
2.1.2. Half Edge Data
2.1.3. Components
2.1.4. Exercise
2.1.5. Architectural Case Study
4
3. Appendix
3.1. Index
3.2. Example Files
3.3. Resources
3.4. About This Primer
Grasshopper - an Overview
Grasshopper is a visual programming editor developed by David Rutten at Robert McNeel & Associates. As a
plug-in for Rhino3D, Grasshopper is integrated with the robust and versatile modeling environment used by
creative professionals across a diverse range of fields, including architecture, engineering, product design,
and more. In tandem, Grasshopper and Rhino offer us the opportunity to define precise parametric control over
models, the capability to explore generative design workflows, and a platform to develop higher-level
programming logic all within an intuitive, graphical interface.
The origins of Grasshopper can be traced to the functionality of Rhino3d Version 4s Record History button. This
built-in feature enabled users to store modeling procedures implicitly in the background as you go. If you lofted four
curves with the recording on and then edited the control points of one of these curves, the surface geometry would
update. Back in 2008, David posed the question: what if you could have more explicit control over this history? and
the precursor to Grasshopper, Explicit History, was born. This exposed the history tree to editing in detail and
empowered the user to develop logical sequences beyond the existing capabilities of Rhino3Ds built in features.
Six years later, Grasshopper is now a robust visual programming editor that can be extended by suites of externally
developed add-ons. Furthermore, it has fundamentally altered the workflows of professionals across multiple
industries and fostered an active global community of users.
This primer focuses on Foundations, offering the core knowledge you need to dive into regular use of Grasshopper
and several on-ramps to how you might go further within your own creative practice. Before diving into the
descriptions, diagrams, and examples supplied hereafter, lets discuss what visual programming is, the basics of
the Grasshopper interface and terminology, as well as the live characteristics of the viewport feedback and user
experience.
Visual Programming is a paradigm of computer programming within which the user manipulates logic elements
graphically instead of textually. Some of the most well-known textual programming languages such as C#, Visual
Basic, Processing and more close to home for Rhino Python and Rhinoscript require us to write code that is
bound by language-specific syntax. In contrast, visual programming allows us to connect functional blocks into a
sequence of actions where the only syntax required is that the inputs of the blocks receive the data of the
appropriate type, and ideally, that is organized according to the desired result see the sections on Data Stream
Matching and Designing with Data Trees. This characteristic of visual programming avoids the barrier to entry
commonly found in trying to learn a new language, even a spoken one, as well as foregrounds the interface, which
for designers locates Grasshopper within more familiar territory.
Grasshopper - an Overview
This image show the process for drawing a sine curve in python and in Grashopper.
To access Grasshopper and its visual programming capabilities, we need to download and install the program
from the Grasshopper3D.com website. Once installed, we can open the plug-in by typing Grasshopper into the
Rhino Command Line. The first time we do so in a new session of Rhino, we will be presented with the
Grasshopper loading prompt followed by the Grasshopper editor window. We can now add functional blocks called
components to the canvas, connect them with wires, and save the entire definition in the .ghx file format.
Grasshopper - an Overview
THINGS TO REMEMBER
Grasshopper is a graphical algorithm editor that is integrated with Rhino3Ds modeling tools.
Algorithms are step by step procedures designed to perform an operation.
You use Grasshopper to design algorithms that then automate tasks in Rhino3D.
An easy way to get started if you are unclear how to perform a specific operation in Grasshopper would be to try
manually and incrementally creating an algorithm using Rhino commands.
As you begin first exploring Grasshopper or further building your skills, you have joined the global Grasshopper
community, one that is full of active members from many fields, with diverse experience levels. The forum at
Grasshopper3D. com is a useful resource for posing questions, sharing findings, and gaining knowledge. This is
a community that we have held dear as weve written this primer and watched Grasshopper develop over the years.
Welcome!
Grasshopper - an Overview
Grasshopper in Action
Follow the Grasshopper in Action board on Pinterest.
Grasshopper in Action
1. FOUNDATIONS
A strong foundation is built to last. This volume of the Primer introduces the
key concepts and features of parametric modeling with Grasshopper.
Foundations
10
Hello Grasshopper!
11
1.1.1.1. DOWNLOADING
To download the Grasshopper plug-in, visit the Grasshopper web site. Click on the Download tab at the top of the
page, and when prompted on the next screen, enter your email address. Now, right click on the download link, and
choose Save Target As from the menu. Select a location on your hard drive (note: the file cannot be loaded over a
network connection, so the file must be saved locally to your computers hard drive) and save the executable file to
that address.
1.1.1.2. INSTALLING
Select Run from the download dialog box follow the installer instructions. (note: you must have Rhino 5 already
installed on your computer for the plug-in to install properly).
12
1.1.1.3. LAUNCHING
To Launch Grasshopper, type Grasshopper into the Rhino Command line. When you launch Grasshopper, the first
thing you will see is a new window floating in front of Rhino. Within this window you can create node-based
programs to automate various types of functionality in Rhino. Best practice is to arrange the windows so that they
do not overlap and Grasshopper does not obstruct the Rhino viewports.
Type Grasshopper into the Rhino command line to launch the Grasshopper plugin.
13
Split the screen so that Grasshopper does not obstruct the Rhino Viewports. You can do this by dragging
each window to opposite sides of the screen, or by holding the Wondows key and pressing the left or right
arrows.
14
15
8. The status bar tells you what version of Grasshopper is currently installed on your machine. If a newer
version is available, a pop-up menu will appear in your tray providing instructions on how to download
the latest version.
The Grasshopper UI
16
The Preferences dialog allows you to set many of Grasshoppers application settings.
The Grasshopper UI
17
Insert File: You can use this option to insert an existing file into the current document as loose components.
Group File: This method will insert a file into an existing document, but will group all of the objects together.
Cluster File: Similar to the group function, this method will insert a file into an existing document, but will create a
cluster object for the entire group of objects.
Examine File: Allows you to open a file in a locked state, meaning you can look around a particular file but you cant
make any changes to the definition.
Grasshopper also has an Autosave feature which will be triggered periodically based on specific user actions. A list
of Autosave preferences can be found under the File menu on the Main Menu Bar. When the active instance of
Rhino is closed, a pop-up dialog box will appear asking whether or not you want to save any Grasshopper files that
were open when Rhino was shut down.
Autosave only works if the file has already been saved at least once.
18
data types or Curves for all curve related tools). To add a component to the canvas, you can either click on the
objects in the drop-down menu or you can drag the component directly from the menu onto the canvas.
Drag + Drop a component from the palette to add a component to the canvas.
Since there can be many more components in each sub-category than will fit into the palette, a limited number of
icons are displayed on each panel. The height of the component palette and the width of the Grasshopper window
can be adjusted to display more or fewer components per sub-category. To see a menu of all of the components in
a given sub-category, simply click on the black bar at the bottom of each sub-category panel. This will open a
dropdown menu which provides access to all components in that sub-category.
1. Catgory tab
2. Sub-category panel.
3. Click the black bar to open the sub-category panel menu.
4. Hover your mouse over a component for a short description.
5. Drop-down menu.
The Grasshopper UI
19
The canvas is the primary workspace for creating Grasshopper definitions. It is here where you interact with the
elements of your visual program. You can start working in the canvas by placing components and connecting wires.
1.1.2.6. GROUPING
Grouping components together on the canvas can be especially useful for readability and comprehensibility.
Grouping allows you the ability to quickly select and move multiple components around the canvas. You can create
a group by typing Ctrl+G with the desired components selected. An alternate method can be found by using the
Group Selection button under the Edit Menu on the Main Menu Bar. Custom parameters for group color,
transparency, name, and outline type can be defined by right-clicking on any group object.
You can also define a group using a meta-ball algorithm by using the Blob Outline profile.
Two groups are nested inside one another. The color (light blue) has been changed on the outer group to
help visually identify one group from the other. Groups are drawn behind the components within them and,
in cases such as this, there is a depth order to the two groups. To change this, go to Edit > Arrange in the
The Grasshopper UI
20
1.1.1.7. WIDGETS
There are a few widgets that are available in Grasshopper that can help you perform useful actions. You can toggle
any of these widgets on/off under the Display menu of the Main Menu bar. Below well look at a few of the most
frequently used widgets.
The Align Widget One useful UI widget which can help you keep your canvas clean is the Align widget. You can
access the Align widget by selecting multiple components at the same time and clicking on one of the options
found in the dashed outline that surrounds your selected components. You can align left, vertical center, right, or top,
horizontal center, bottom, or distribute components equally through this interface. When first starting out, you may
find that these tools sometimes get in the way (it is possible to make the mistake of collapsing several
components on top of each other). However, with a little practice these tools can be invaluable as you begin to
structure graphs which are readable and comprehensible.
1. Align right.
2. Distribute vertically.
The Profiler Widget The profiler lists worst-case runtimes for parameters and components, allowing you to track
down bottlenecks in networks and to compare different components in terms of performance. Note that this widget
is turned off by default.
The Profiler widget gives you visual feedback as to which components in your definition could be causing
longer computational times.
The Grasshopper UI
21
The Markov Widget This widget uses Markov chains to predict which component you may want to use next based
on your behavior in the past. A Markov chain is a process that consists of a finite number of states (or levels) and
some known probabilities. It can take some time for this widget to become accustomed to a particular user, but
over time you should begin to notice that this widget will begin to suggest components that you may want to use
next. The Markov Widget can suggest up to five possible components depending on your recent activity. You can
right-click on the Markov widget (the default location is the bottom left-hand corner of the canvas) to dock it into one
of the other corners of the canvas or to hide it completely.
Double-click anywhere on the canvas to invoke a key word search for a particular component found in the
Component Panels.
22
By right-clicking anywhere on the canvas or pressing the F3 key, you can invoke the Find feature. Start by
typing in the name of the component that you are looking for.
The Grasshopper UI
23
The Find feature can be quite helpful to locate a particular component on the canvas. Right-click anywhere on
the canvas to launch the Find dialog box.
A small arrow will also be displayed next to each item in the list which points to its corresponding component
on the canvas. Try moving the Find dialog box around on the canvas and watch the arrows rotate in to keep
track of their components. Clicking on the Find result will try to place the component (on the canvas) next to
the Find dialog box.
The Grasshopper UI
24
The Radial UI menu allows you to quickly access frequently used menu items.
The Grasshopper UI
25
1. Preview Settings: If a Grasshopper component generates some form of geometry, then a preview of this
geometry will be visible in the viewport by default. You can disable the preview on a perobject basis by
right-clicking each component and de-activating the preview feature, or globally change the preview state
by using one of these three buttons.
2. Wire-frame preview.
3. Turn off preview.
4. Shaded preview (default).
5. Preview Selected Objects: With this button toggled, Grasshopper will only display geometry that is part
of selected components, even if those components have a preview=off state.
6. Document Preview Settings: Grasshopper has a default color scheme for selected (semi-transparent
green) and unselected (semi-transparent red) geometry. It is possible to override this color scheme with
the Document Preview Settings dialog.
7. Preview Mesh Quality: For optimization purposes, these settings allow you to control the quality of the
mesh/surface display of the geometry rendered in Rhino. Higher quality settings will cause longer
calculation times, whereas lower settings will display less accurate preview geometry. It should be noted
that the geometry still maintains a high-degree of resolution when baked into the Rhino document
these settings merely effect the display performance and quality.
The sketch tool allows changes to the line weight, line type, and color. By right-clicking on the selected sketch
The Grasshopper UI
26
object you can choose to simplify your line to create a smoother effect. Right-click on your sketch object and
select Load from Rhino. When prompted, select any 2D shape in your Rhino scene. Once you have
selected your referenced shape, hit Enter, and your previous sketch line will be reconfigured to your Rhino
reference shape.
Note: Your sketch object may have moved from its original location once you have loaded a shape from
Rhino. Grasshopper places your sketch object relative to the origin of the canvas (upper left hand corner) and
the world xy plane origin in Rhino.
Grasshopper has a default color scheme for selected (semi-transparent green) and unselected (semitransparent red) geometry. It is possible to override this color scheme with the Document Preview Settings
dialog.
The Grasshopper UI
27
Talking to Rhino
28
Talking to Rhino
29
Talking to Rhino
30
Talking to Rhino
31
Change the units and tolerances in the Rhino Document Properties menu.
Talking to Rhino
32
In order to get a UI element (eg. slider, toggle, button, etc.) to show up in the Remote Control Panel, we have
to first publish it.
The RCP UI can also be customized allowing you to control where objects appear in the interface, the names and
colors of different groups. To modify the layout of the RCP you first have to switch from Working Mode (the default
RCP view) to Edit Mode. You can enter the Editing Mode by clicking on the green pencil in the upper right hand
corner of the RCP. Once in Editing Mode, you can create new UI groups, rearrange elements within groups, add
labels, change colors and more. To delete a UI element, simply drag the element outside the border of the RCP.
You cannot change the individual values of the parameters if you are in Editing Mode. Instead, you will have to click
on the green pencil icon to switch back to the standard Working Mode.
The Remote Control Panel has two modes: Edit Mode (left) which allows you to reorganize the look and feel
of the RCP, and Working Mode where you can modify the actual values of the UI elements.
The Remote Control Panel in Edit Mode has an orange background.
Talking to Rhino
33
1. Project Folder.
2. Rhino file.
3. Grasshopper file.
1.1.3.8. TEMPLATES
Creating and specifiying a template file in your Grasshopper preferences is convenient way to set up every new
Grasshopper definition you create. The template can include Grasshopper components as well as panels and
sketch objects for labeling.
Talking to Rhino
34
Talking to Rhino
35
1. In File/Preferences, load the file you just created under Template File. Your template will now be used
each time you create a new file.
Talking to Rhino
36
37
1.2.1.1. PARAMETERS
Parameters store the data - numbers, colors, geometry, and more - that we send through the graph in our definition.
Parameters are container objects which are usually shown as small rectangular boxes with a single input and
single output. We also know that these are parameters because of the shape of their icon. All parameter objects
have a hexagonal border around their icon.
Geometry parameters can reference geometry from Rhino, or inherit geometry from other components. The point
and curve objects are both geometry parameters.
Input parameters are dynamic interface objects that allow you to interact with your definition. The number slider and
the graph mapper are both input parameters.
1.2.1.2. COMPONENTS
Components perform actions based on the inputs they receive. There are manytypes of components for different
tasks.
38
A component is always a more involved object, since we have to understand and then coordinate what its inputs
and outputs are. Like parameters, a component with warnings is displayed as orange. Remember, warnings arent
necessarily bad, it usually just means that Grasshopper is alerting you to a potential problem in your definition.
A component which contains neither warnings nor errors is shown in light gray.
A component whose preview has been disabled is shown in a slightly darker gray. There are two ways to disable a
components preview. First, simply right-click on the component and toggle the preview button. To disable the
preview for multiple components at the same time, first select the desired components and then toggle the disable
preview icon (blindfolded man) by right clicking anywhere on the canvas.
A component that has been disabled is shown in a dull gray. To disable a component you may right-click on the
component and toggle the disable button, or you may select the desired components, right click anywhere on the
canvas and select Disable. Disabled components stop sending data to downstream components.
A component which has been selected will be shown in a light green color. If the selected component has
generated some geometry within the Rhino scene, this will also turn green to give you some visual feedback.
A component which contains at least 1 error is displayed in red. The error can come either from the component
Grasshopper Object Types
39
40
41
Circle CNR and Circle 3pt have the same label, but different icons.
One feature that can help you familiarize yourself with the location of components in the palettes is holding down
Ctrl + Alt and clicking on an existing component on the canvas. This will reveal its location in the palette.
42
43
1. Header of the tooltip shows the icon for the input type, the name of the Component, the label for the input,
and the input type again in text format.
2. The flain language description of what the input is for the Component.
3. Any values defined for the input - either locally or from its connected wire.
4. The header of the output tooltip provides the same detail os for inputs, but for the corresponding output.
5. The result of the component's action.
44
45
allows you add or remove Inputs or Outputs to that component. The Addition component allows you to add inputs,
representing additional items for the addition operation.
46
Once you have defined all the points you can press Enter and they will become part of the Parameters persistent
data record. This means the Parameter is now no longer empty and it turns from orange to grey. (Notice that the
information balloon in the upper right corner also disappears as there are no more warnings). At this point you can
use the points stored in this Parameter for any subsequent input in your definition.
1. The parameter is orange, indicating it contains no persistent records (and it failed to collect volatile data)
and thus has no effect on the outcome of the solution. Right click on any parameter to set its persistent
data.
2. Once the parameter contains some persistent data, the component will turn from orange to grey.
Data Types
47
3. The tooltip for the point parameter shows the persistent data (a collection of referenced points) that is
stored.
Data Types
48
1. Drag the slider grip to change the value - each time you do this, Grasshopper will recompute the
solution.
2. Right click the slider component to change the name, type, and values.
3. Editable text field for the slider name.
4. Select the type of number for the slider to use.
5. Edite the range of values.
6. Double click the name portion of the slider component to open the Slider Editor.
Graph mapper The Graph Mapper is a two-dimensional interface with which we can modify numerical values by
plotting the input along the Graphs X Axis and outputting the corresponding value along the Y Axis at the X value
intersection of the Graph. It is extremely useful for modulating a set of values within an institutive, grip-based
interface.
Data Types
49
1. Move the grips to edit the graph - each time you do this, Grasshopper will recompute the solution.
2. Right click the graph mapper compenent to select the graph type.
Data Types
50
1. Right click the Value List component and select an option from the menu.
2. Double click the Value List component to open the editor and add or change values.
3. In Dropdown List mode, click the arrow to select one of the values. The solution will recompute each
time you change the value.
4. In Check List mode, click next to each value to check it. The component will output all the values that are
checked.
5. In Value Sequence and Value Cycle modes, click the left and right facing arrows to cycle through the
values.
Data Types
51
Data Types
52
1. The Divide Curve component - divides a curve into equal length segments.
2. Curve parameter - right click and select Set One Curve to reference Rhino Geometry.
Left click and drag the wire from the output (1.) of one object to the input (2.) of another.
1. If you hold down CONTROL, the cursor will become red, and the targeted source will be removed from
the source list.
2. By default, a new connection will erase existing connections. Hold the SHIFT button while dragging
connection wires to difne multiple sources. The cursor will turn green to indicate the addition behavior.
Wiring Components
53
1. You can also disconnect wires through the context popup menu - right click the grip of the input or output
and select disconnect.
2. If there are multiple connections, select the one you want to disconnect from the list.
3. When you hover over an item, the wire will be highlighted in red.
1. Empty Item An orange wire type indicates that no information has been transferred. This parameter
has generated a warning message because it contains no data, and thus no information is being sent
across the wire.
2. The Merge component is an alternative to conecting more than one source to a single input.
3. List If the information flowing out of a component contains a list of information, the wire type will be
shown as a grey double line.
4. Single Item The data flowing out of any parameter that contains a single item will be shown with a solid
grey line.
Wiring Components
54
5. Tree Information transferred between components which contain a data structure will be shown in a
grey double-line-dash wire type.
1. Hidden Display When hidden display is selected, the wire will be completely invisible. The data is
transferred wirelessly from the source to the input parameter. If you select the source or target
component, a green wire will appear to show you which components are connected to each other. Once
you deselect the component, the wire will disappear.
2. Default Display The default wire display will draw all connections (if fancy wires is turned on).
3. Faint Display The faint wire display will draw the wire connection as a very thin, semi-transparent line.
Faint and Hidden wire displays can be very helpful if you have many source wires coming into a single
input.
Wiring Components
55
56
57
58
1.3.1.1 POINTS
Points in 3D space have three coordinates, usually referred to as [x,y,z]. Points in 2D space have only two
coordinates which are either called [x,y] or [u,v] depending on what kind of two dimensional space were talking
about. 2D parameter space is bound to a finite surface. It is still continuous, I.e. hypothetically there are an infinite
amount of points on the surface, but the maximum distance between any of these points is very much limited. 2D
parameter coordinates are only valid if they do not exceed a certain range. In the example drawing, the range has
been set between 0.0 and 1.0 for both [u] and [v] directions, but it could be any finite domain. A point with
Points Planes & Vectors
59
coordinates [1.5, 0.6] would be somewhere outside the surface and thus invalid.
Since the surface which defines this particular parameter space resides in regular 3D world space, we can always
translate a parametric coordinate into a 3D world coordinate. The point [0.2, 0.5] on the surface for example is the
same as point [1.8, 2.0, 4.1] in world coordinates. Once we transform or deform the surface, the 3D coordinates
which correspond with [0.2, 0.5] will change.
If this is a hard concept to grasp, it might help to think of yourself and your position in space. We tend to use local
coordinate systems to describe our whereabouts; Im sitting in the third seat on the seventh row in the movie
theatre, Im in the back seat. If the car youre in is on the road, your position in global coordinates is changing all
the time, even though you remain in the same back seat coordinate.
1.3.1.2. VECTORS
A vector is a geometric quantity describing Direction and Magnitude. Vectors are abstract; ie. they represent a
quantity, not a geometrical element.
Vectors are indistinguishable from points. That is, they are both lists of three numbers so theres absolutely no way
of telling whether a certain list represents a point or a vector. There is a practical difference though; points are
absolute, vectors are relative. When we treat a list of three doubles as a point it represents a certain coordinate in
space, when we treat it as a vector it represents a certain direction. A vector is an arrow in space which always
starts at the world origin (0.0, 0.0, 0.0) and ends at the specified coordinate.
60
1.3.1.3. PLANES
Planes are Flat and extend infinitely in two directions, defining a local coordinate system. Planes are not genuine
objects in Rhino, they are used to define a coordinate system in 3D world space. In fact, its best to think of planes
as vectors, they are merely mathematical constructs.
61
62
1. Attractor point
2. Vectors
3. Circles orient towards attractor based on their normals
In the image above, vectors are drawn between an attractor point and the center point of each circle. These vectors
are used to define the orientation of the circles so they are always facing the attractor point. This same attractor
could be used to change other parameters of the circles. For example, circles that are closest to the attractor could
be scaled larger by using the length of each vector to scale the radius of each circle.
63
In this example, we will use an attractor point to orient a grid of circles, based on the vectors between the center
points of the circles and the attractor point. Each circle will orient such that it is normal to (facing) the attractor point.
01.
02.
Vector/Grid/Hexagonal - Drag and drop the Hexagonal Grid component onto the
canvas
03.
04.
05.
06.
Connect the Number Slider (Cell Radius) to the Size (S) input of the Hexagon Grid
component
07.
Connect the Number Slider (# of Cells) to the Extent X (Ex) input and the Extent Y (Ey)
input of the Hexagon Grid component
08.
Curve/Primitive/Circle CNR - Drag and drop a Circle CNR component onto the
canvas
09.
Connect the Points (P) output of the Hexagon Grid to the Center (C) input of the
Circle CNR component
10.
Connect the Number Slider (Cell Radius) to the Radius (R) input of the Circle CNR
component.
64
11.
Vector/Vector/Vector 2Pt - Drag and Drop the Vector 2Pt component onto the
canvas
12.
Connect the Points output (P) of the Hexagonal Grid component to the Base Point (A)
input of the Vector 2Pt component.
13.
Params/Geometry/Point Drag and Drop the Point component onto the canvas
14.
Right-Click the Point component and select set one point. In the model space select
where you would like the attractor point to be
15.
Connect the Point component to the Tip Point (B) input of the Vector 2Pt component
16.
Connect the Vector (V) output of the Vector 2Pt to the Normal (N) input of the Circle
CNR component.
17.
Curve/Util/Offset Drag and Drop the Offset Component onto the canvas.
18.
19.
20.
Connect the Number Slider (Offset Distance) to the Distance (D) input of the Offset
component
65
21.
22.
Connect the Curves (C) output of the Offset component to the Edges (E) input of the
Boundary Surfaces
66
67
1. Domains are used to define a range of values (formerly known as intervals) between two numbers. The
components under the Domain tab allow you to create or decompose different domain types.
2. In mathematics, a matrix is an array of numbers organized in rows and columns. This subcategory
contains a series of utility tools to construct and modify matrices.
3. Operators are used to perform mathematical operations such as Addition, Subtraction, Multiplication, etc.
Conditional operators allow you to determine whether a set of numbers are larger than, less than, or
similar to another set of numbers.
4. Polynomials are one of the most important concepts in algebra and throughout mathematics and
science. You can use the components found in this subcategory to compute factorials, logarithms, or to
raise a number to the nth power.
5. The script subcategory contains single and multi-variable expressions as well as the VB.NET and C#
scripting components.
6. These components allow you to solve trigonometric functions such as Sine,Cosine, Tangent, etc.
7. The time subcategory has a number of components which allow you to construct instances of dates and
times.
8. The utility subcategory is a grab bag of useful components that canbe used in various mathematical
equations. Check here if youre trying find the maximum or minimum values between two lists of
68
1.3.3.2. OPERATORS
As was previously mentioned, Operators are a set of components that use algebraic functions with two numeric
input values, which result in one output value.
Most of the time, you will use the Math Operators to perform arithmetical actions on a set of numbers. However,
these operators can also be used on various data types, including points and vectors.
69
boolean value is True if the object is a curve, or False if the object is not a curve. The second part of the statement
performs an action dependent on the outcome of the conditional statement; in this case, if the object is a curve then
delete it. This conditional statement is called an If statement. There are four conditional operators (found under the
Math/ Operators subcategory) that evaluate a condition and return a boolean value.
The Equality component takes two lists and compares the first item of List A and compares it to the first item of List
B. If the two values are the same, then a True boolean value is created; conversely if the two values are not equal,
then a False boolean value is created. The component cycles through the lists according to the set data matching
algorithm (default is set to Longest List). There are two outputs for this component. The first returns a list of
boolean values that shows which of the values in the list were equal to one another. The second output returns a
list that shows which values were not equal to one another - or a list that is inverted from the first output.
The Similarity component evaluates two lists of data and tests for similarity between two numbers. It is almost
identical to the way the Equality component compares the two lists, with one exception: it has a percentage input
that defines the ratio of list A that list B is allowed to deviate before inequality is assumed. The Similarity component
also has an output that determines the absolute value distance between the two input lists.
The Larger Than component will take two lists of data and determine if the first item of List A is greater than the first
item of List B. The two outputs allow you to determine if you would like to evaluate the two lists according to a
greater than (>) or greater than and equal to (>=) condition.
The Smaller Than component performs the opposite action of the Larger Than component. The Smaller Than
component determines if list A is less than list B and returns a list of boolean values. Similarly, the two outputs let
you determine if you would like to evaluate each list according to a less than (<) or less than and equal to (<=)
condition.
Mathematics, Expressions & Conditionals
70
1. Line
y(t) = 0
2. Sine Curve
y(t) = sin(t)
3. Helix
x(t) = cos(t)
y(t) = sin(t)
z(t) = b(t)
4. Spiral
x(t) = t*cos(t)
y(t) = t*cos(t)
71
In this example, we will use Grasshopper to construct various trigonometric curves using trigonometry function
components found in the Math tab:
01.
02.
03.
Right click the Point parameter and click Set One Point select a point in the Rhino
viewport
04.
05.
Params/Input/Number Slider Drag and drop the Number Slider component onto
the canvas
06.
07.
Transform/Array/Linear Array Drag and drop the Linear Array component onto
the canvas
08.
Connect the output of the Point parameter to the Geometry (G) input of the Linear
Array component
09.
Connect the Unit Vector (V) output of the Unit X component to the Direction (D) input
of the Linear Array component
You should see a line of 20 points along the x axis in Rhino. Adjust the slider to
change the number of points in the array.
10.
Connect the Number Slider output to the Count (N) input of the Linear Array
Component
11.
12.
Connect the Geometry (G) output of the Linear Array component to the Vertices (V)
input of the Interpolate Curve component
72
We have just created a line by connecting an array of points with a curve. Lets try using some of
Grasshoppers Trigonometry components to alter this curve:
13.
14.
Vector/Point/Construct Point - Drag and drop a Construct Point component onto the
canvas
15.
16.
Disconnect the wire from the Vertices (V) input of the Interpolate Curve component.
You can disconnect wires by holding down control and dragging, or by rightclicking the input and selecting Disconnect
17.
Connect the Geometry (G) output of the Linear Array component to the Point (P)
input of the Deconstruct component
18.
Connect the Point X (X) output of the Deconstruct component to the X coordinate (X)
input of the Construct Point Component
19.
Connect a second wire from the Point X (X) output of the Deconstruct Component to
the Value (x) input of the Sine component
20.
21.
Connect the Result (y) output of the Sine component to the Y coordinate (Y) input of
the Construct Point component
We have now reconstructed our points with the same X values, modifying the Y
values with a sine curve.
Connect the Point (Pt) output of the Construct Point component to the Vertices (V)
input of the Interpolate component
</li>
You should now see a sine wave curve along the X axis in Rhino
22.
23.
Connect a third wire from the Point X (X) output of the Deconstruct Component to the
Value (x) input of the Cosine component
73
24.
Connect the Result (y) output of the Cosine component to the Z coordinate (Z) input
of the Construct Point component
</li>
We have now created a 3D helix
25.
26.
Connect wires from the Point X (X) output of the Deconstruct component to the (A)
input of each Multiplication component
27.
Connect the Result (y) output of the Sine component to the (B) input of the first
Multiplication component
28.
Connect the Result (y) output of the Cosine component to the (B) input of the second
Multiplication component
29.
Disconnect the wire from the Y Coordinate (Y) input of the Construct Point
component
30.
Connect the Result (R) output of the first Multiplication component to the X
Coordinate (X) input of the Construct Point component
31.
Connect the Result (R) output of the second Multiplication component to the Z
Coordinate (Z) input of the Construct Point component
74
1.3.3.5. EXPRESSIONS
Example files that accompany this section: http://grasshopperprimer.com/appendix/A-2/1_gh-files.html
The Expression component (and its brother the Evaluate component) are very flexible tools; that is to say that they
can be used for a variety of different applications. We can use an Expression (or Evaluate component) to solve
mathematical algorithms and return numeric data as the output.
In the following example, we will look at mathematical spirals found in nature and how we can use a few Functions
components to create similar patterns in Grasshopper. We will build on our trigonometric curves definition as a
starting point.
01.
Open your Trigonometric curves Grasshopper definition from the previous example
02.
03.
Params/Input/Number Slider Drag and drop a Number Slider onto the canvas
04.
05.
Connect the Number Slider to the Factor (F) input of the Unit X component.
This slider allows you to adjust the distance between the points in the array.
06.
75
07.
Double-click the first Expression component to open the Expression Editor and
change the expression to: x*sin(x)
08.
Double-click the second Expression component to open the Expression Editor and
change the expression to: x*cos(x)
Double click the Expression component to open the Grasshopper Expression Editor
09.
Connect two wires from the Point X (X) output of the Deconstruct component to the
Variable x (x) input of each Expression component
10.
Connect the Result (R) output of the first Expression component to the X coordinate
(X) input of the Construct Point component
11.
Connect the Result (R) output of the second Expression component to the Y
coordinate (Y) input of the Construct Point component
We have replaced the Trigonometry functions and multiplication operators with
the expression components for a more efficient definition.
12.
13.
Params/Input/Number Slider Drag and drop a Number Slider onto the canvas
14.
15.
Connect the Number Slider to the Radius (R) input of the Voronoi component
16.
Connect the Point (Pt) output of the Construct Point component to the Points (P)
input of the Voronoi component
76
You can create different Voronoi patterns by manipulating the Factor, Count, and Radius sliders. Below are three
examples:
77
78
In the color wheel, hue corresponds to the angle. Grasshopper has taken this 0-360 domainand remapped it
between zero and one.
By dividing the Hue domain (0.0 to 1.0) by the number of segments desired, we can assign a hue value to each
segment to create a color wheel.
79
In this example, we will use Grasshoppers domain and color components to create a color wheel with a variable
amount of segments.
01.
02.
03.
04.
05.
06.
Connect the Point Parameter (Base Point) to the Plane (P) input of the Polygon
component
07.
Params/Input/Number Sliders Drag and drop two Number Sliders onto the canvas
08.
09.
10.
11.
Connect the Number Slider (Radius) to the Radius (R) input of the Polygon
component
When you connect a number slider to a component in will automatically
change its name to the name of input that it is connecting to.
Connect the Number Slider (Segments) to the Segments (S) input of the Polygon
component
80
12.
13.
Connect the Polygon (P) output of the Polygon component to the Curve (C) input of
the Explode component
14.
Surface/Freeform/Extrude Point Drag and drop the Extrude Point component onto
the canvas
15.
Connect the Segments (S) output of the Explode component to the Base (B) input of
the Extrude Point
16.
Connect the Point Parameter (Base Point) to the Extrusion Tip (P) of the Extrude
Point component
17.
18.
Connect the Extrusion (E) output of the Extrude Point component to the Deconstruct
Brep (B) component
19.
20.
Connect the Number Slider (Segments) to the Count (C) input of the Divide Domain
component
81
21.
22.
Connect the Segments (S) output of the Divide Domain component to the Domain (I)
input of the Deconstruct Domain component
23.
24.
Connect the Start (S) output of the Deconstruct Domain component to the Hue (H)
input of the Colour HSL components
25.
26.
Right click on the Geometry (G) input of the Custom Preview component and select
Flatten
See 1-4 Designing with Data Trees for details about flattening
27.
Connect the Faces (F) output of the Deconstruct Brep component to the Geometry
(G) input of the Custom Preview component
28.
Connect the Colour (C) output of the Colour HSL component to the Shade (S) input of
the Custom Preview component
For different color effects, try connecting the Deconstruct Domain component to the saturation (S) or Luminance (L)
inputs of the Colour HSL component.
82
83
84
1.3.5.1. BOOLEANS
Numeric variables can store a whole range of different numbers. Boolean variables can only store two values
referred to as Yes or No, True or False, 1 or 0. Obviously we never use booleans to perform calculations because of
their limited range. We use booleans to evaluate conditions.
Boolean Parameter
In Grasshopper, booleans can be used in several ways. The boolean parameter is a container for one or multiple
boolean values, while the Boolean Toggle allows you to quickly change between single true and false values as
inputs.
Boolean Toggle - double click the boolean value to toggle between true and false
Grasshopper also has objects that test conditions and output boolean values. For example, the Includes
component allows you to test a numeric value to see if it is included in a domain.
The Includes component is testing whether the number 6.8 is included in the domain from 0 to 10. It returns
a boolean value of True.
85
The Not operator is a bit of an oddity among operators, because it doesnt require two values. Instead, it simply
inverts the one on the right. Imagine we have a script which checks for the existence of a bunch of Block definitions
in Rhino. If a block definition does not exist, we want to inform the user and abort the script.
Every circular region contains all values that belong to a set; the top circle for example marks off set {A}. Every value
Booleans and Logical Operators
86
inside that circle evaluates True for {A} and every value not in that circle evaluates False for {A}. By coloring the
regions we can mimic boolean evaluation in programming code:
87
88
1. Line
2. Polyline
3. Circle
4. Ellipse
5. Arc
6. NURBS Curve
7. Polycurve
1. End Point
2. Edit Point
3. Control Point
89
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
curves 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.
NURBS curve knots as a result of varying degree:
A D1 NURBS curve behaves the same as a polyline. A D1 curve has a knot for every control point.
D2 NURBS curves are typically only used to approximate arcs and circles. The spline intersects with the
control polygon halfway each segment.
D3 is the most common type of NURBS curve and is the default in Rhino. You are probably very familiar with
the visual progression of the spline, even though the knots appear to be in odd locations.
Curve Geometry
90
Grasshopper has a set of tools to express Rhinos more advanced curve types like nurbs curves and poly curves.
These tools can be found in the Curve/Splines tab.
Nurbs Curve (Curve/Spline/Nurbs curve): The Nurbs Curve component constructs a NURBS curve from control
points. The V input defines these points, which can be described implicitly by selecting points from within the Rhino
scene, or by inheriting volatile data from other components. The Nurbs Curve-D input sets the degree of the curve.
Interpolate Curve (Curve/Spline/Interpolate): Interpolated curves behave slightly differently than NURBS curves. The
V-input is for the component is similar to the NURBS component, in that it asks for a specific set of points to create
the curve. However, with the Interpolated Curve method, the resultant curve will actually pass through these points,
regardless of the curve degree. In the NURBS curve component, we could only achieve this when the curve degree
was set to one. Also, like the NURBS curve component, the D input defines the degree of the resultant curve.
However, with this method, it only takes odd numbered values for the degree input. Again, the P-input determines if
the curve is Periodic. You will begin to see a bit of a pattern in the outputs for many of the curve components, in that,
the C, L, and D outputs generally specify the resultant curve, the length, and the curve domain respectively.
Kinky Curve (Curve/Spline/Kinky Curve): The kinky curve component allows you the ability to control a specific angle
threshold, A, where the curve will transition from a kinked line, to a smooth, interpolated curve. It should be noted
that the A-input requires an input in radians.
Polyline (Curve/Spline/Polyline): A polyline is a collection of line segments connecting two or more points, the
Curve Geometry
91
resultant line will always pass through its control points; similar to an Interpolated Curve. Like the curve types
mentioned above, the V-input of the Polyline component specifies a set of points that will define the boundaries of
each line segment that make up the polyline. The C-input of the component defines whether or not the polyline is
an open or closed curve. If the first point location does not coincide with the last point location, a line segment will
be created to close the loop. The output for the Polyline component is different than that of the previous examples,
in that the only resultant is the curve itself.
Curve Geometry
92
1. List Item
2. Index
The only thing that might seem odd at first is that the first index number of a list is always 0; not 1. So, when we talk
about the first item of a list, we actually mean the item that corresponds to index number 0.
For example, if we were to count the number of fingers we have on our right hand, chances are that you would have
counted from 1 to 5. However, if this list has been stored in an array, then our list would have counted from 0 to 4.
Note, that we still have 5 items in the list; its just that the array is using a zero-based counting system. The items
being stored in the list dont just have to be numbers. They can be any data type that Grasshopper supports, such
as points, curves, surfaces, meshes, etc.
Often times the easiest way to take a look at the type of data stored in a list is to connect a Text Panel
(Params/Input/Panel) to the output of a particular component. By default, the Text Panel automatically shows all
index numbers to the left side of the panel and displays the data items on the right side of the panel. The index
numbers will become a crucial element when we begin working with our lists. You can turn the index numbers on
and off by right-clicking on the Text Panel and clicking on the Draw Indices item in the sub-menu. For now, lets
leave the entry numbers turned on for all of our text panels.
What is a List?
93
What is a List?
94
As you can see there are different ways in which we can draw lines between these sets of points. New to
Grasshopper 0.9 are three components for data matching, found under the Sets/List panel: Shortest List, Longest
List, and Cross Reference. These new components allow for greater flexibility within the three basic data matching
algorithms. Right clicking each component allows you to select a data matching option from the menu.
The simplest way is to connect the inputs one-on-one until one of the streams runs dry. This is called the Shortest
List algorithm:
Select a matching algorithm option from the component menu by right-clicking the component.
The Longest List algorithm keeps connecting inputs until all streams run dry. This is the default behavior for
Data Stream Matching
95
components:
This is potentially dangerous since the amount of output can be humongous. The problem becomes more intricate
as more input parameters are involved and when the volatile data inheritance starts to multiply data, but the logic
remains the same.
Lets look more closely at the Shortest List component:
Here we have two input lists {A,B,C,D,E} and {X,Y,Z}. Using the Trim End option, the last two items in the first list are
disregarded., so that the lists are of equal length.
Using the Trim Start option, the first two items in the first list are disregarded, so that the lists are of equal length.
96
The Interpolate option skips the second and fourth items in the first list. Now lets look at the Cross Reference
component:
Here we have two input lists {A,B,C} and {X,Y,Z}. Normally Grasshopper would iterate over these lists and only
consider the combinations {A,X}, {B,Y} and {C,Z}. There are however six more combinations that are not typically
considered, to wit: {A,Y}, {A,Z}, {B,X}, {B,Z}, {C,X} and {C,Y}. As you can see the output of the Cross Reference
component is such that all nine permutations are indeed present.
We can denote the behaviour of data cross referencing using a table. The rows represent the first list of items, the
columns the second. If we create all possible permutations, the table will have a dot in every single cell, as every
cell represents a unique combination of two source list indices.
Sometimes however you dont want all possible permutations. Sometimes you wish to exclude certain areas
because they would result in meaningless or invalid computations. A common exclusion principle is to ignore all
cells that are on the diagonal of the table. The image above shows a holistic matching, whereas the diagonal
option (available from the Cross Reference]component menu has gaps for {0,0}, {1,1}, {2,2} and {3,3}. If we apply
this to our {A,B,C}, {X,Y,Z} example, we should expect to not see the combinations for {A,X}, {B,Y} and {C,Z}:
The rule that is applied to diagonal matching is: Skip all permutations where all items have the same list index.
Coincident matching is the same as diagonal matching in the case of two input lists, but the rule is subtly
Data Stream Matching
97
different: Skip all permutations where any two items have the same list index.
The four remaining matching algorithms are all variations on the same theme. Lower triangle matching applies
the rule: Skip all permutations where the index of an item is less than the index of the item in the next list, resulting
in an empty triangle but with items on the diagonal.
Lower triangle (strict) matching goes one step further and also eliminates the items on the diagonal:
Upper Triangle and Upper Triangle (strict) are mirror images of the previous two algorithms, resulting in empty
triangles on the other side of the diagonal line.
98
1. Right click the number component to open the Number collection Manager.
2. Click the Add Item icon to add a number to the list.
3. Double click the number to change its value.
Another method is to manually enter the list items into a panel. Make sure that Multiline Data is deselected.
Creating Lists
99
1.4.4.2. RANGE
The Range component, found under Sets/Sequence/Range, creates a list of evenly spaced numbers between a
low and a high value called the Domain. A domain (also sometimes referred to as an interval) is every possible
number between two numeric extremes.
A Range component divides a numeric domain into even segments and returns a list of values.
1. Number of Steps = 10
2. Domain goes from 0 to 1
3. Total number of points = 11
In the example below, the numeric domain has been defined as every possible number between 0 and 20. The
Range component takes that domain and divides it up by the number of steps (in this case 10). So, we have 10
even spaced segments. The Range component returns a list of values. Because it keeps the first and the last
values in the list, the output of a Range component is always one more than the number of steps. In the example
above, we created 10 steps, so the Range component returns 11 values.
Create a list using the Range component by specifying a Domain and number of steps.
You may have noticed something a little quirky about the setup we just made. We know that a domain is always
defined by two values (a high and low value). Yet, in our definition we simply connected a single value to the domain
input. In order to avoid errors, Grasshopper makes an assumption that you are trying to define a domain between
zero and some other number (our slider value). In order to create a range between two numbers that doesnt start
at zero, we must use the Construct Domain component to specify the domain.
Creating Lists
100
To create a Range from a domain that does not start at zero, use the Construct Domain component.
1.4.4.3. SERIES
The Series component is similar to the Range component, in that, it also creates a list of numbers. However a
Series component is different because it creates a set of discreet numbers based on a start value, step size, and
the number of values in the series.
The Series component creates a list based on a start value, step value, and the number of values in the list.
1.4.4.4. RANDOM
The Random Component (Sets/Sequence/Random) can be used to generate a list of pseudo random numbers.
They are referred to as pseudo random because the number sequence is unique but stable for each seed value.
Thus, you can generate an entirely new set of random numbers by changing the seed value (S-input). The domain,
as in the previous example, is a defined interval between two numeric extremes.
Creating Lists
101
Lets look at some components that can help us understand the data.
You can visualize the order of a set of points using the Point List component.
List Visualization
102
You can visualize any string information in the viewport using the Text Tag component. In this setup, we have
decided to display the value of each point on top of each point locaiton. We could have assigned any text to
display.
The Text Tag 3d component works very similarly to the Text Tag component. They differ, in that, when Text Tag 3d
objects are baked into the scene, they become Text objects in Rhino. The scale of the Text Tag 3d font can also be
controlled via an input (which is inaccessible in the Text Tag component).
You can use a Text Tag 3d component to visualize information like a Text object in Rhino.
1.4.5.3. COLOR
One of the other things we can do to visualize the list data is to assign color to the geometry. Grasshopper has
limited rendering capabilities, but we can control simple Open GL settings like color, specular color, transparency,
etc. The L0 value represents the low end (left side) of the gradient, whereas the L1 value represents the upper end
(right side). These values correspond to the start and end of our domain. The t-values are the elements in the list
that will get mapped somewhere within the L0 and L1 range. The output of the gradient is a list of RGB color values
which correspond to each point in our list. Right-click on the Gradient to set one of the gradient presets, or define
your own using the color node points.
List Visualization
103
1. Points
2. Point list
3. Text Tag
4. Text Tag 3D
5. Custom color preview
List Visualization
104
105
number. Likewise, if we change the offset to +1, all values of the list will move up by one entry number. If Wrap input
equals True, then items that fall off the ends are re-appended to the beginning or end of the list. In this example, we
have a shift offset value set to +1, so that our list moves up by one entry number. Now, we have a decision to make
on how we would like to treat the first value. If we set the Wrap value to False, the first entry will be shifted up and out
of the list, essentially removing this value from the data set (so, the list length is one less than it was before).
However, if we set the wrap value to True, the first entry will be moved to the bottom of the list
1.4.6.6. WEAVE
The Weave component (Sets/Lists/Weave) merges two or more lists together based on a specified weave pattern
(P input).When the pattern and the streams do not match perfectly, this component can either insert nulls into the
output streams or it can ignore streams which have already been depleted.
List Management
106
List Management
107
1. Mapping pattern
2. Mapped geometry
01.
02.
108
03.
04.
05.
06.
Right-Click the first Geometry Parameter and select set one Geometry. Set the first
Geometry that you are referencing.
07.
Right-Click the second Geometry Parameter and select set one Geometry. Set the
second Geometry that you are referencing.
It is possible to reference multiple geometries in a single parameter, but for
simplicity were are using two separate parameter components.
08.
Params/Geometry/Curve Drag and drop two Curve parameters onto the canvas.
09.
Right-Click the first Curve Parameter and select set one Curve. Set the first square
that you are referencing.
10.
Right-Click the second Curve Parameter and select set one Curve. Set the second
square that you are referencing.
Be sure that the geometry and the square that you are referencing correspond.
11.
12.
13.
14.
15.
16.
Connect the first Number Slider to the Size X (Sx) input of the Rectangular Grid
component.
109
17.
Connect the second Number Slider to the Size Y (Sy) input of the Rectangular Grid
component.
18.
Connect the third Number Slider to the Extent X (Ex) input and the Extent Y (Ey) input
of the Rectangular Grid component.
19.
Sets/Tree/Merge Drag and drop two Merge components onto the canvas.
20.
Connect the first Geometry parameter to Data Stream 1 (D1) input of the first Merge
component.
21.
Connect the second Geometry parameter to Data Stream 2 (D2) input of the first
Merge component.
22.
Connect the first Curve parameter to Data Stream 1 (D1) input of the second Merge
component.
23.
Connect the second Curve parameter to Data Stream 1 (D2) input of the second
Merge component.
24.
Right-click the Cells (C) output of the Rectangular Grid component and select
Flatten.
25.
Sets/List/List Length Drag and drop a List Length component onto the canvas.
26.
Connect the Cells (C) output of the Rectangular Grid component to the List (L) input
of the List Length component.
27.
Sets/Sequence/Repeat Data Drag and drop a Repeat Data component onto the
canvas.
110
28.
Connect the Length (L) output of the List Length component to the Length (L) input of
the Repeat Data component.
29.
30.
This is the pattern in which the geometries are being distributed. 0 is calling
out the first referenced Geometry and 1 is calling out the second referenced
Geometry. Changing the number sequence will change the pattern, as will
changing the extents of the grid.
31.
Connect the Panel to the Data (D) input of the Repeat Data component.
32.
33.
Connect the Result (R) output of the first Merge component to the List (L) input of the
first List Itemcomponent.
34.
Connect the Result (R) output of the second Merge component to the List (L) input of
the second List Item component.
35.
Connect the Data (D) output of the Repeat Data component to the Index (i) input of
the first and second List Item components.
36.
37.
Connect the Cells (C) output of the Rectangular Grid component to the Target (T)
input of the Rectangular Mapping component.
38.
Connect the items (I) output of the first List Item component to the Geometry (G)
input of the Rectangular Mapping component.
39.
Connect the items (I) output of the second List Item component to the Source (S)
input of the Rectangular Mapping component.
111
Changing the input geometry and the pattern will change the final tile pattern.
112
113
114
You can think of NURBS surfaces as a grid of NURBS curves that go in two directions. The shape of a
NURBS surface is defined by a number of control points and the degree of that surface in the u and v
directions. NURBS surfaces are efficient for storing and representing free-form surfaces with a high degree
of accuracy.
Surface Domain A surface domain is defined as the range of (u,v) parameters that evaluate into a 3-D point on that
surface. The domain in each dimension (u or v) is usually described as two real numbers (u_min to u_max) and
(v_min to v_max) Changing a surface domain is referred to as reparameterizing the surface.
Surface Geometry
115
In Grasshopper, it is often useful to reparameterize NURBS surfaces so that the u and v domains both range from 0
to 1. This allows us to easily evaluate and operate on the surface.
Evaluating parameters at equal intervals in the 2-D parameter rectangle does not necessarily translate into
equal intervals in 3-D space.
Surface evaluation Evaluating a surface at a parameter that is within the surface domain results in a point that is
on the surface. Keep in mind that the middle of the domain (mid-u, mid-v) might not necessarily evaluate to the
middle point of the 3D surface. Also, evaluating u- and v-values that are outside the surface domain will not give a
useful result.
Normal Vectors and Tangent Planes The tangent plane to a surface at a given point is the plane that touches the
surface at that point. The z-direction of the tangent plane represents the normal direction of the surface at that point.
Grasshopper handles NURBS surfaces similarly to the way that Rhino does because it is built on the same core of
operations needed to generate the surface. However, because Grasshopper is displaying the surface on top of the
Rhino viewport (which is why you cant really select any of the geometry created through Grasshopper in the
viewport until you bake the results into the scene) some of the mesh settings are slightly lower in order to keep the
speed of the Grasshopper results fairly high. You may notice some faceting in your surface meshes, but this is to
be expected and is only a result of Grasshoppers drawing settings. Any baked geometry will still use the higher
mesh settings.
Surface Geometry
116
You can think of projecting as geometry casting a shadow onto a surface, and mapping as geometry being
stretched over a surface.
1. Mapped geometry defined by uv coordinates
2. Projecting geometry onto a surface
Just as 2d geometry can be projected onto the uv space of a surface, 3d geometry that is contained by a box can be
mapped to a corresponding twisted box on a surface patch. This operation is called box morphing and is useful for
populating curved surfaces with three dimensional geometric components.
To array twisted boxes on a surface, the surface domain must be divided to create a grid of surface patches. The
twisted boxes are created by drawing normal vectors at the corners of each patch to the desired height and creating
a box defined by the end points of those vectors and the corner points of the patch.
117
02.
03.
04.
Right click the Surface Parameter and select Set One Surface select a surface to
reference in the Rhino viewport
05.
Right click the Geometry parameter and select Set One Geometry select the your
Rhino geometry
Surface Geometry
118
06.
07.
08.
Double click the first Number Slider and set the following:
Rounding: Integer
Lower Limit: 0
Upper Limit: 10
Value: 5
09.
Set the same values on the second and third Number Sliders
10.
Connect the output of the Surface parameter to the Domain (I) input of the Divide
Domain2 component
11.
Connect the first Number Slider to the U Count (U) input of the Divide Domain2
component
12.
Connect the second Number Slider to the V Count (V) input of the Divide Domain2
component
13.
14.
Connect the output of the Surface parameter to the Surface (S) input of the Surface
Box component
15.
Connect the Segements (S) output of the Divide Domain2 component to the Domain
(D) input of the Surface Box component
You should see a grid of twisted boxes populating your referenced surface. Change the U and V count sliders
to change the number of boxes, and use the height slider to adjust their height.
16.
Connect the third Number Slider to the Height (H) input of the Surface Box
component
17.
18.
Transform/Morph/Box Morph Drag and drop the Box Morph component onto the
canvas
19.
Connect the output of the Geometry parameter to the Content (C) input of the
Bounding Box component
Surface Geometry
119
20.
Connect the output of the Geometry parameter to the Geometry (G) input of the Box
Morph component
21.
Connect the Box (B) output of the Bounding Box component to the Reference (R)
input of the Box Morph component
22.
Connect the Twisted Box (B) output of the Surface Box component to the Target (T)
input of the Box Morph component
Surface Geometry
120
Surface Geometry
121
In the image above, there is a single master branch (you could call this a trunk, but since its possible to have
multiple master branches, it might be a bit of a misnomer) at path {0}. This path contains no data, but does have 6
sub-branches. Each of these sub-branches inherit the index of the parent branch {0} and add their own sub-index
(0, 1, 2, 3, 4, and 5 respectively). It would be wrong to call this an index, because that implies just a single number.
It is probably better to refer to this as a path, since it resembles a folder-structure on the disk. At each of these
sub-branches, we encounter some data. Each data item is thus part of one (and only one) branch in the tree, and
each item has an index that specifies its location within the branch. Each branch has a path that specifies its
location within the tree.
The image below illustrates the difference between a list and a data tree. On the left, an array of four columns of six
points each is all contained in one list. The first column numbered 0-5, the second 6-11, and so on. On the right is
the same array of points contained in a data tree. The data tree is a list of four columns, and each column is a list of
six points. The index of each point is (column number, row number). This is a much more useful way of organizing
this data, because you can easily access and operate on all the points in a given row or column, delete every
second row of points, connect alternating points, etc.
122
123
1. Path
2. List of 11 items
Tree Statistics The Tree Statistics component (Sets/Tree/Tree Statistics) Returns some statistics of the Data Tree
including:
P - All the paths of the tree
L - The length of each branch in the tree
C - Number of paths and branches in the tree
If we connect the Points output of the same Divide Curve component, we can display the paths, lengths, and the
count in panels. This component is helpful because it separates the statistics into three outputs, allowing you to
view only the one that is relevant.
Both the Param Viewer and the Tree Statistics component are helpful for visualizing changes in the structure of the
Data Tree. In the next section, we will look at some operations that can be performed to change this structure.
124
1.5.3.1. FLATTEN
Flattening removes all levels of a Data Tree, resulting in a single List. Using the Flatten component
(Sets/Tree/Flatten) on the P output of our Divide Curve component, we can use the Param Viewer to visualize the
new data structure.
In the Param Viewer, we can see that we now only have 1 branch containing a list of 48 points.
In the Param Viewer, we can see that what was data with 8 branches of 6 items each, we now have 8
branches with 6 sub-branches containing 1 item each.
125
In the Param Viewer, we still have 8 branches of 6 items each, but the first branch has been removed.
In the Param Viewer, we can see that what was data with 8 branches of 6 items each, we now have 6
branches with 8 items each.
The Flatten, Graft, and Simplify operations can be applied to the component input or output itself, rather than
feeding the data through a separate component. Just right-click the desired input or output and select Flatten, Graft,
or Simplify from the menu. The component will display an icon to indicate that the tree is being modified. Keep in
mind Grasshoppers program flow. If you flatten a component input, the data will be flattened before the component
operation is performed. If you flatten a component output, the data will be flattened after the component performs its
action.
126
1. Flattened output P
2. Grafted output P
3. Simplified output P
127
128
1. Array curves
2. Dispatch curves into lists A and B, divide curves
3. Cull points, weave, and revolve
01.
02.
Curve/Primitive/Line SDL Drag and drop the Line SDL component onto the canvas
03.
Vector/Point/Construct Point Drag and drop the Construct Point component onto
the canvas
04.
Connect the Point (Pt) output of the Construct Point component to the Start (S) Input
of the Line SDL component
05.
Vector/Vector/Unit Y Drag and drop the vector Unit Y component onto the canvas
The factor of Unit Vector components is 1.0 by default.
129
05.
06.
Connect the Unit Y component to the Direction (D) input of the Line SDL component
07.
Params/Input/Number Slider Drag and drop the Number Slider component onto
the canvas
08.
09.
Connect the Number Slider to the Length (L) input of the Line SDL component
10.
Transform/Array/Linear Array Drag and drop the Linear Array component onto
the canvas
11.
Connect the Line (L) output of the Line SDL component to the Geometry (G) input of
the Linear Array component
12.
Vector/Vector/Unit X Drag and drop the vector Unit X component onto the canvas
13.
Params/Input/Number Slider Drag and drop two Number Slider components onto
the canvas
14.
15.
16.
Connect the Number Slider (Offset Distance) to the Factor (F) input of the Unit X
component
17.
Connect the Vector (V) output of the Unit X component to the Direction (D) input of the
Linear Array component
130
18.
Connect the Number Slider (# of Offsets) to the Count (N) input of the Linear Array
component
You should now see an array of lines in the Rhino viewport. The three sliders allow you to change the length
of the lines, their distance from each other, and the number of lines in the array.
19.
Sets/Lists/Dispatch Drag and drop the Dispatch component onto the canvas
20.
Connect the Geometry (G) output of the Linear Array component to the List (L) input
of the Dispatch component
21.
Params/Input/Panel Drag and drop the Panel component onto the canvas
22.
Double-click the Panel, deselect Multiline Data, Wrap Items and Special Codes, and
enter the following:
true
false
23.
Connect the Panel to the Pattern (P) input of the Dispatch component
24.
Curve/Division/Divide Curve Drag and drop two Divide Curve components onto the
canvas
25.
Connect the List A (A) output of the Dispatch component to the Curve (C) input of the
first Divide Curve component
26.
Connect the List B (B) output of the Dispatch component to the Curve (C) input of the
second Divide Curve component
27.
Params/Input/Number Slider Drag and drop the Number Slider component onto
the canvas
28.
131
29.
Connect the Number Slider (Divisions) to the Count (N) input of both Divide Curve
components.
1. The Dispatch component sends every second curve in the array to a separate list.
2. The Divide Curve component divides the curves into the number of segments specified by the slider.
Adjust the slider to change the number of points.
30.
Sets/Sequence/Cull Pattern Drag and drop two Cull Pattern components onto the
canvas
31.
Connect the Points (P) output of the first Divide Curve component to the List (L) input
of the first Cull Pattern component
32.
Connect the Points (P) output of the second Divide Curve component to the List (L)
input of the second Cull Pattern component
33.
Params/Input/Panel Drag and drop a second Panel component onto the canvas
34.
Double-click the second Panel and deselect: Multiline Data, Wrap Items, and Special
Codes. Then enter the following:
1
1
0
0
We are using 1 and 0 in place of true and false. These are the two syntaxes
that Grasshopper accepts for boolean values.
35.
Connect the second Panel to the Pattern (P) input of the first Cull Pattern component
36.
Connect the second Panel to the Pattern (P) input of the second ull Pattern
component
37.
Right-click on the Pattern (P) input of the second Cull Pattern component and select
Invert
This will invert the **Cull Pattern**, a useful trick to keep definitions short.
132
38.
Sets/List/Weave Drag and drop the Weave component onto the canvas
39.
Connect the second Panel to the Pattern (P) input of the Weave component
40.
Right-click the Pattern (P) input of the Weave component and select reverse
41.
Connect the List (L) output of the first Cull Pattern component to the Stream 0 (0)
input of the Weave component
42.
Connect the List (L) output of the second Cull Pattern component to the Stream 0 (0)
input of the Weave component
43.
Curve/Spline/Nurbs Curve Drag and drop the Nurbs Curve component onto the
canvas
44.
Connect the Weave (W) output of the Weave component to the Vertices (V) input of
the Nurbs Curve component.
45.
46.
Connect the Curve output of the Nurbs Curve component to the Profile Curve (P)
input of both Revolution components.
47.
Right Click on Axis (A) input of both Revolution components and select Graft.
48.
Connect the List A (A) output of the Dispatch component to the Axis (A) input of the
first Revolution component
Connect the List B (B) output of the Dispatch component to the Axis (A) input of the
133
49.
134
135
02.
Params/Geometry/Curve Drag and drop three curve parameters onto the canvas
03.
Right-click the first Curve parameter and select Set one curve. Select the first rail
Working with Data Trees
136
Right-click the second Curve parameter and select Set one curve. Select the
second rail curve in the Rhino viewport
06.
Right-click the third Curve parameter and select Set one curve. Select the section
curve in the Rhino viewport
07.
Connect the outputs of the Curve parameters to the Rail 1 (R1), Rail 2 (R2), and
Sections (S) inputs of the Sweep2 respectively
08.
09.
Connect the Brep (S) output of the Sweep2 component to the input of the Surface
parameter
10.
11.
12.
13.
Double click the first Number Sliders and set the following:
Rounding: Integer
Lower Limit: 1
Upper Limit: 40
Value: 20
14.
15.
Connect the output of the reparameterized Surface parameter to the Domain (I) input
of the Divide Domain2 component
16.
Connect the first Number Sliders to the U Count (U) input of the Divide Domain2
component
17.
Connect the second Number Sliders to the V Count (V) input of the Divide Domain2
component
18.
Surface/Util/Isotrim Drag and drop the Isotrim component onto the canvas
19.
Connect the Segments (S) output of the Divide Domain2 component to the Domain
(D) input of the Isotrim component
137
20.
Connect the output of the Surface parameter to the Surface (S) input of the Isotrim
component
We have now divided out surface into smaller, equally sized, surfaces. Adjust the U and V Count sliders to
change the number of divisions. Lets add a Graph Mapper to give the segments variable size.
21.
22.
23.
24.
25.
26.
27.
Connect the U min (U0) and U max (U1) outputs of the Deconstruct Domain2
component to the Data 1 (D1) and Data 2 (D2) inputs of the Merge component
28.
Connect the Result (R) output of the Merge component to the input of the Graph
Mapper
29.
Right-click the Graph Mapper and select Bezier under Graph Types
30.
Connect a second wire from the U max (U1) output of the Deconstruct Domain2
component to the List (L) input of the List Length component
31.
Connect the Graph Mapper output to the List (L) input of the Split List
32.
Connect the Length (L) output of the List Length component to the Index (i) input of
the Split List component
33.
Connect the List A (A) output of the Split List component to the U min (U0) input of the
Construct Domain2 component
138
34.
Connect the List B (B) output of the Split List component to the U max (U1) input of
the Construct Domain2 component
35.
Connect the V min (V0) output of the Deconstruct Domain2 component to the V min
(V1) input of the Construct Domain2 component
36.
Connect the V max (V1) output of the Deconstruct Domain2 component to the V max
(V1) input of the Construct Domain2 component
37.
Connect the 2D Domain (I2) output of the Construct Domain2 component to the
Domain (D) input of the Isotrim component, replacing the existing connection
We have just deconstructed the domains of each surface segment, remapped the U values using a Graph
Mapper, and reconstructed the domains. Adjust the grips of the Graph Mapper to change the distribution of
the surface segments. Lets use Data Trees to manipulate the surface divisions.
38.
39.
40.
41.
42.
Connect the Surface (S) output of the Isotrim component to the Brep (B) input of the
Deconstruct Brep component
The Deconstruct Brep component deconstructs a Brep into Faces, Edges, and
Vertices. This is helpful if you want to operate on a specific constituent of the
surface.
Connect the Vertices (V) output of the Deconstruct Brep component to the Data (D)
input of the Flip Matrix component
We just changed the Data tree structure from one list of four vertices that
define each surface, to four lists, each containing one vertex of each surface.
43.
Connect the Data (D) output of the Flip Matrix component to the Data (D) input of the
Explode Tree component
44.
45.
Right-click the Data (D) input of the Explode Tree component and select simplify
139
Each output of the Explode Tree component contains a list of one vertex of each surface. In other words, one
list with all the top right corners, one list with all the bottom right corners, one list of top left corners, and one
list of bottom left corners.
46.
Curve/Primitive/Line Drag and drop two Line components onto the canvas
47.
Connect the Branch 0 {0} output of the Explode Tree component to the Start Point (A)
input of the first Line component
48.
Connect the Branch 1 {1} output of the Explode Tree component to the Start Point (A)
input of the second Line component
49.
Connect the Branch 2 {2} output of the Explode Tree component to the End Point (B)
input of the first Line component
50.
Connect the Branch 3 {3} output of the Explode Tree component to the End Point (B)
input of the second Line component
We have now connected the corner points of each surface diagonally with lines.
51.
Curve/Util/Join Curves Drag and drop the Join Curves component to the canvas
52.
53.
54.
Connect the Line (L) outputs of each Line component to the Curves (C) input of the
Join Curves component
Hold down the Shift key to connect multiple wires to a single input
140
55.
Connect the Curves (C) output of the Join Curves component to the Curve (C) input
of the Control Points component
56.
Connect the Points (P) output of the Control Points component to the Vertices (V)
input of the Interpolate component
We have now joined our lines into polylines and reconstructed them as NURBS curves by interpolating their
control points. In the Rhino viewport, you might notice that the shorter curves are still straight lines. This is
because you cannot make a degree three NURBS curve with fewer than four control points. Lets manipulate
the data tree to eliminate lists of control points with less than four items.
57.
Sets/Tree/Prune Tree Drag and drop the Prune Tree component onto the canvas
58.
59.
Connect the Points (P) output of the Control Points component to the Tree (T) input of
the Prune Tree component
If you connect one Param Viewer to the Points (P) output of the Control Points
component, and another to the Tree (T) output of the Prune Tree component,
you can see that the number of branches has been reduced.
60.
61.
Connect the output of the Panel to the Minimum (N0) input of the Prune Tree
component
62.
Connect the Tree (T) output of the Prune Tree component to the Vertices (V) input of
the Interpolate component
63.
Surface/Freeform/Extrude Drag and drop the Extrude component onto the canvas
Vector/Vector/Unit Y Drag a Unit Y component onto the canvas
64.
65.
66.
You may need to use a Unit X vector, depending on the orientation of your referenced
geometry in Rhino
Params/Input/Number Slider Drag a Number Slider onto the canvas
Double click the Number Slider and set the following:
Rounding: Integer
Lower Limit: 1
Upper Limit: 5
Value: 3
141
67.
Connect the Curve (C) output of the Interpolate component to the Base (B) input of
the Extrude component
68.
Connect the Number Slider output to the Factor (F) input of the Unit Y component
69.
Connect the Unit Vector (V) output of the Unit Y component to the Direction (D) input
of the Extrude component
You should now see a diagonal grid of strips or fins in the Rhino Viewport. Adjust the Factor slider to chnage
the depth of the fins
142
143
144
145
1. Mesh vertices
2. Mesh edges
3. Mesh faces
1. A list of vertices.
2. Faces with groupings of vertices
What is a Mesh?
146
Vertices
The vertices of a mesh are simply a list of points. Recall that a list in Grasshopper is a collection of objects. Each
object in the list has an index which describes that objects position in a list. The index of the vertices is very
important when constructing a mesh, or getting information about the structure of a mesh.
147
Panel to the output of these components, we can see that a triangular face is represented as T{A;B;C}, and a quad
face as Q{A;B;C;D}. Faces with more than 4 sides are not allowed. To make a 5-sided mesh element, the mesh
must be broken into two or more faces.
What is a Mesh?
148
1. The Construct Mesh component takes a list of vertices and a list of faces as input. The Color input is
optional, and is left blank for now
2. A panel shows that we have created a mesh with 5 vertices and 2 faces
3. The resulting mesh (the vertices have been labeled with their indices)
By default, Grasshopper does not preview the edges of mesh geometry. To preview the edges as well as the
surfaces, you can turn on mesh edge preview by using the shortcut Ctrl-M, or by going to the Display menu and
selecting 'Preview Mesh Edges'.
What is a Mesh?
149
It is extremely important to pay attention to the order of the indices when constructing a mesh face. The face will be
constructed by connecting the vertices listed in order, so the quad faces Q{0,1,2,3} and Q{1,0,2,3} are very different,
despite using the same four vertices. Incorrect vertex ordering can lead to problems such as holes, non-manifold
mesh geometry, or non-orientable surfaces. Such mesh geometry is usually not correctly rendered, and not able to
be 3D printed. These issues are discussed in more detail in the Understanding Topology section.
What is a Mesh?
150
In addition to faces and vertices, there is other information about a mesh that we will want to use. In a Face-Vertex
based mesh, data such as edges and normals are calculated implicitly based on the given faces and vertices. This
section describes ways to query this information.
Edges
The edges of a mesh are lines connecting any two consecutive vertices in a face. Notice that some edges are
shared between multiple faces, while other edges are only adjacent to one face. The number of faces an edge is
adjacent to is called the valence of that edge.
Grasshopper groups edges into three categories based on the valence:
1. E1 - 'Naked Edges' have a valence of 1. They make up the external boundary of a mesh.
2. E2 - 'Interior Edges' have a valence of 2.
3. E3 - 'Non-Manifold Edges' have a valence of 3 or greater. Meshes that contain such structure are called "NonManifold", and are discussed in the next section.
What is a Mesh?
151
1. The Mesh Edges component outputs three sets of edges. This mesh has 5 naked edges, 1 interior
edge, and zero non-manifold edges
2. The E3 output is empty, because this mesh does not have any non-manifold edges, resulting in an
orange wire.
3. The Face Boundaries component outputs one polyline for each face
Face Normals
A normal vector is a vector with a magnitude of one that is perpendicular to a surface. In the case of triangular faces,
we know that any three points must be planar, so the normal will be perpendicular to that plane, but how do we
know which direction ('up' or 'down') the normal will be pointing? Once again, the order of the indicies is crucial
here. Mesh faces in Grasshopper are defined counter-clockwise, so a face with indices {0,1,2} will be 'flipped' as
compared to the indicies {1,0,2}. Another way to visualize this is to use the Right-Hand-Rule.
1. The Face Normals component will return a list of center points and normal vectors for each face
2. Face normals according to vertex sequence
3. "Right-Hand-Rule" for determining normal direction
Grasshopper also allows quad faces, in which case the 4 points will not always be planar. For these faces, the
center point will be simply the average of the coordinates of the 4 vertices (in the case of a non-planar quad, note
that this point is not necessarily on the mesh). To calculate the normal of a quad face, we need to first trianglulate
the quad by splitting it into two planar triangles. The normal of the overall face is then the average of the two
normals, weighted according to the area of the two triangles.
Vertex Normals
What is a Mesh?
152
In addition to the face normals, it is also possible to calculate normals for each vertex of a mesh. For a vertex that is
only used in a single face, the normal at the vertex will point in the same direction as the face normal. If a vertex has
multiple adjacent faces, the vertex normal is calculated by taking the average of the faces.
While less intuitive than face normals, vertex normals are important for smooth visualization of meshes. You might
notice that even when mesh is composed of planar faces, such a mesh can still appear smooth and rounded when
shaded in Rhino. Using the vertex normals allows this smooth visualization.
1. Normals set according to the face normal results in discrete polygonal shading
2. Adjancent face normals are averaged together to create vertex normals, resulting in smooth shading
across faces
153
of three colors, we can color each vertex in the triangle separately. These colors are used for visualitizations, with
each face rendered as an interpolation of the vertex colors. For example, the image below shows a triangular face
with vertex colors of Red, Green, and Blue.
1. Red, green, and blue are assigned to the three vertices of a mesh
2. The resulting mesh interpolates the colors of the vertices
1.6.1.4 Exercise
Example files that accompany this section: http://grasshopperprimer.com/appendix/A-2/1_gh-files.html
01.
02.
Mesh/Primitive/Mesh Quad - Drag and drop a Mesh Quad component onto the canvas
03.
Mesh/Primitive/Construct Mesh - Drag and drop a Construct Mesh component onto the
canvas
04.
Connect the Face (F) output of the Mesh Quad component to the Faces (F) input of the
Construct Mesh component
Mesh Quad and Construct Mesh have default values which create a single mesh face. Next, we will replace
the default values with our own vertices and faces.
What is a Mesh?
154
05.
06.
07.
08.
09.
10.
You can also copy the original **Panel** by clicking and dragging, then tapping the
Alt key before releasing the click
Connect the Panels to the inputs of the Mesh Quad in the following order:
0-A
1-B
2-C
3-D
Mesh/Primitive/Mesh Triangle - Drag and drop a Mesh Triangle component onto the
canvas
Connect the Panels to the inputs of the Mesh Triangle component in the following order:
1-A
2-B
4-C
11.
12.
Connect the Face (F) output of the Mesh Quad component to the Data1 (D1) input of the
Merge component, and the Face (F) output of the Mesh Triangle component to the Data2
(D2) input of the Merge component
13.
Connect the Result (R) output of the Merge component to the Faces (F) input of the
Construct Mesh component
The default Vertices (V) list of Construct Mesh only has 4 points, but our Mesh Triangle component uses an
index of 4, which would correspond to the fifth point in a list. Since there are not enough vertices, the
Construct Mesh component gives an error. To fix it, we will provide our own list of points.
14.
What is a Mesh?
155
Right-click the Panel component and de-select the 'Multiline Data' option
15.
16.
By default, a panel has 'Multiline Data' enabled. By disabling it, each line in the panel
will be read as a separate item within a list.
Double-click the Panel component to edit it, and enter the following points:
{0,0,0}
{1,0,0}
{1,1,0}
{0,1,0}
{2,0,0}
Make sure you use the correct notation. To define a point in a **Panel**, you have to
use curly brackets: '{' and '}' with commas between the x, y, and z values
17.
Connect the Panel component to the Vertices (V) input of the Construct Mesh component
19.
20.
21.
Alternatively, copy the existing **Panel** that we used for the points, which already
has 'Multiline Data' disabled
Double-click the Panel component to edit it, and enter the following:
Q{0,1,2,3}
T{1,2,4}
Connect the Panel to the Faces (F) input of the Construct Mesh component
What is a Mesh?
156
22.
Params/Input/Colour Swatch - Drag and drop a Colour Swatch component onto the
canvas
23.
Click the colored section of the component (the default is White) to open the color selection
panel
24.
Use the sliders to set the G and B values to zero. The swatch should now be Red
25.
Params/Input/Colour Swatch - Drag and drop two more Colour Swatch components onto
the canvas and set their colors to Blue and Green
26.
27.
Connect the three Color Swatch components into the D1, D2, and D3 inputs of the Merge
component.
28.
Connect the Result (R) output of the Merge component to the Colours (C) input of the
Construct Mesh component
We have 5 vertices, but only 3 colors. Grasshopper will assign the colors in a repeating pattern, so in this
cases vertices 0 and 3 will be Red, vertices 1 and 4 will be Green, and the final vertex 2 will be Blue.
What is a Mesh?
157
The same set of vertices can have different connectivity information, resulting in different topology.
Understanding Topology
158
Homeomorphism
The points of a mesh can be moved without altering the connectivity information. The new mesh has the
same topology as the original.
It is possible for two distinct mesh shapes to be topologically identical. All this would mean is that they are
constructed out of the same number of points and that the points are structured by the same set of faces. Earlier,
we established that a mesh face is only concerned with the indices of a set of points and has no interest in their
actual location in rhino-space. Therefore, if the only difference between two distinct mesh shapes is the specific 3dimentional position of the points that are used to define it, then the two meshes are considered to be
homeomorphic (or topologically equivalent) and therefore share the same topological properties.
An example of homeomorphism among letters (note that some of the above homeomorphic groups might be
different depending on what font is considered)
Understanding Topology
159
Orientable
A mesh is considered orientab le if there are well-defined sides to the mesh. An simple example of a non-orientable
mesh occurs when adjacent faces have normals pointing in opposite directions. These 'flipped faces' can cause
problems in visualizations and renderings, as well as manufacturing or 3D-printing.
Understanding Topology
160
Manifold vs Non-Manifold
Non-manifold geometry is essentially geometry that cannot exist in the "real world". This does not necessarily make
it "bad geometry" but it is something to be aware of due to complications it may present for tools and operations (for
example: rendering of refractive effects, fluid simulations, boolean operations, 3d printing, etc). Common conditions
that result in a non-manifold mesh include: self intersection, naked edges (from holes or internal faces), disjoint
topology, and overlapping/duplicate faces. A mesh can also be considered Non-Manifold if it includes any vertices
which are shared by faces that do not share edges or any edges with a valence greater than 2, creating a junction of
at least 3 faces
161
Understanding Topology
162
Zooming into a NURBS surface retains a smooth curve, while a mesh element has a fixed resolution
It is interesting to note that while NURBs surfaces are stored as mathematical equations, the actual visualization of
these surfaces requires meshes. It is not possible for a computer to display a continuous equation. Instead, it must
break that equation down into smaller parts, the result of which is that all rendering or display processing must
convert NURBS to meshes. As an analogy, consider that even though we can store the equation of a line on a
computer, in order to display that line, the computer must at some point convert the line into a series of discrete
pixels on a screen to display.
Understanding Topology
163
1.6.3.1 Primitive
Grasshopper comes with a few simple mesh primitive components:
1. Mesh Box - This primitve requires a Box object as an input which provides the size and location, as well
as X,Y, and Z values that determine how many faces to divide the box into. The six sides of a Mesh Box
are unwelded allowing for creases. (See the following section for more information about welded
meshes)
2. Mesh Plane - This primitive requires a Rectangle input to determine the size and location of the plane,
as well as W and H values to determine the number of faces.
3. Mesh Sphere - This primitive requires a base plane to determine the center and orientation of the
sphere, a radius for the size, and U and V values to determine the number of faces.
4. Mesh Sphere Ex - Also known as a Quadball, this primitive creates a sphere composed of six patches,
which are subdivided according to the C input. A quadball is topologically equivalent to a cube, even
though it is geometrically spherical.
As we saw in the previous section, the Construct Mesh component can be used to directly create a mesh from a
list of vertices and a list of faces (and an optional list of vertex colors). Constructing an entire mesh manually can be
extremely tedious, so this component is more often used with an existing list of faces and vertices which have been
Creating Meshes
164
1.6.3.4 Exercise
In this exercise, we use a basic Mesh primitive, perform a transformation on the vertices, and then assign a color
based on the normal vectors to approximate the rendering process.
Example files that accompany this section: http://grasshopperprimer.com/appendix/A-2/1_gh-files.html
01.
02.
Mesh/Primitive/Mesh Sphere - Drag and drop a Mesh Sphere component onto the canvas
03.
Params/Input/Number Slider - Drag and drop a Number Slider component onto the
canvas and set the following values:
Rounding: Integer
Lower Limit:0
Creating Meshes
165
04.
Connect the Number Slider to the U Count (U) and V Count (V) inputs of the Mesh Sphere
Component
Adjust the slider and notice how the resoultion of the sphere changes in the Rhino viewport. Higher numbers
result in a smoother sphere, but also produce larger datasets which can require more processing time.
05.
06.
Connect the Mesh (M) output of the Mesh Sphere component to the Mesh (M) input of the
Deconstruct Mesh component
07.
08.
Connect the Vertices (V) output of the Deconstruct Mesh component to the Geometry (G)
input of the Move component
09.
Connect the Normals (N) output of the Deconstruct Mesh component to the Motion (T)
input of the Move component
10.
Mesh/Analysis/Construct Mesh - Drag and drop a Construct Mesh component onto the
canvas
11.
Connect the Geometry (G) output of the Move component to the Vertices (V) input of the
Construct Mesh component
12.
Connect the Faces (F) output of the Deconstruct Mesh component to the Faces (F) of the
Construct Mesh component
We deconstructed the mesh to get its vertices, faces, and normals. We then simply moved each vertex
according to its normal vector. Because we did not change the topology of the sphere at all, we re-used the
list of faces to re-construct the new mesh. Normal vectors always have a length of one, so this ended up
reconstructing a new mesh sphere with a radius of one more than the original sphere.
Next, we will use a sine function to manipulate the sphere in a slightly more complicated way.
Creating Meshes
166
13.
14.
Connect the Vertices (V) output of the Deconstruct Mesh component to the Point (P) input
of the Deconstruct component
15.
Params/Input/Number Slider - Drag and drop two Number Slider components onto the
canvas
16.
17.
18.
19.
Zoom in to the Expression component until you see the options for adding or removing
input variables and click on a '+' to add a 'z' variable
20.
Right click the 'y' input of the Expression component and change the text to 'A'
21.
Right click the 'z' input of the Expression component and change the text to 'f'
22.
Double click the Expression component to edit the expression, and enter the following:
A\*sin(x\*f/)
23.
Connect the X output of the Deconstruct component to the 'x' input of the Expression
component
24.
Connect the Amplitude Number Slider to the A input, and the Frequency Number Slider to
the 'f' input of the Expression component
25.
26.
Connect the Normals (N) output of the Deconstruct Mesh component to the A input of the
Multiplication component
27.
Connect the Result (R) output of the Expression component to the the B input of the
Multiplication component
28.
Connect the Result (R) output of the Multiplication component to the Motion (T) input of the
Move component
Creating Meshes
167
Adjust the Amplitude and Frequency number sliders to see how the newly constructed mesh changes.
29.
Mesh/Primitive/Mesh Colours - Drag and drop a Mesh Colours component onto the
canvas
Params/Input/Gradient - Drag and drop a Gradient component onto the canvas
30.
You can right-click the gradient component and select "Presets" to change the color
gradient. In this example, we used the Red-Yellow-Blue gradient
31.
Connect the Result (R) output of the Expression component to the Parameter (t) input of
the Gradient component
32.
Connect the output of the Gradient component to the Colours (C) input of the Mesh
Colours component
Connect the Mesh (M) output of the Construct Mesh component to the Mesh (M) input of
the Mesh Colours component
33.
In this step, we could achieve the same result by connecting the gradient directly to
the Colours (C) input of the **Construct Mesh** component
Creating Meshes
168
We used the Expression results to drive both the movement of the vertices and the color of the mesh, so the
color gradient in this case corresponds to the magnitude of the movement of the vertices.
For the final portion of the exercise, we will instead use the direction of the normals relative to a 'light source' vector
to simulate the basic process of rendering a mesh.
34.
35.
While the topology of the original mesh has not changed, the normal vectors will be
different, so we need to use a new Deconstruct Mesh to find the new normals.
</blockquote
We will use this as the direction of a light source. You can use other vectors, or
reference a line from Rhino to make this more dynamic
37.
38.
Connect the Normals (N) output of the Deconstruct Mesh component to the A input of the
Angle component
Creating Meshes
169
39.
Connect the output of the Unit Z component to the B input of the Angle component
40.
41.
Connect the Pi component to the Upper Limit (L1) input of the Gradient component
42.
Connect the Angle (A) output of the Angle component to the Parameter (t) input of the
Gradient component
We used the white-to-black preset for our gradient. This sets the mesh color according to the angle between
the normal and the light source, with normals that are directly facing the light source to black and the normals
facing away from the source to white (To be a little more accurate, you can reverse the gradient by adjusting
the handles). The actual process of rendering a mesh is much more complicated than this, obviously, but
this is the basic process of creating light and shadow on a rendered object.
Creating Meshes
170
1.6.4.1 Smooth
Smoother meshes can sometimes be achieved by simply increasing the number of faces in a process called
sub division. This can often lead to extremely large datasets which take a long time to calculate, and requires
additional add-ons to Grasshopper that are not built-in. In these situations, the Smooth component can be used as
an alternative to make meshes less jagged or faceted, without increasing vertex and face count or changing the
topology. The strength, numb er of iterations, and displacement limit can all be used to adjust how much smoothing
occurs.
Attaching a boolean value to the input N provides option to skip naked vertices. A vertex is naked if it is connected to
a naked edge, meaning the vertex is on the boundary of an open mesh. By toggling this option, you maintain the
exterior boundary of a mesh while smoothing the interior edges.
1.6.4.2 Blur
The Blur component acts in a similar way as smooth, except it only affect the vertex colors. It can also be used to
reduce the jagged appearance of colored meshes, although to a lesser extent since it does not change any
Mesh Operations
171
geometry.
1. Initial mesh
2. Blur after 1 iterations
3. 6 iterations
4. 12 iterations
5. 20 iterations
1.6.4.3 Triangulate
In order to ensure each face is planar, or to export a mesh to a different software that might not allow quad faces, it
is sometimes necessary to triangulate a mesh. Using the Triangulate component, each quad face is replaced with
two triangle faces. Grasshopper always uses the shortest diagonal of the face to create a new edge.
1.6.4.4 Weld
Mesh Operations
172
In the last section, we noticed that a single vertex can be shared by adjacent faces and the normal for that vertex is
calculated as the average of the adjacent faces, allowing a smoother visualization. However, it is sometimes
desireable to have a sharp crease or seam where one face does not smoothly transition to the next by way of the
vertex normals. For this situation it is necessary for each face to have its own vertex with its own normal. The list of
vertices would contain at least two points that have the same coordinates, but different indices.
1. Welded Faces - Both faces share vertices 1 and 2. The vertex normals at these vertices are the average
of the face vertices.
2. Unwelded Faces - Duplicate vertices are added to the list. The faces do not share any vertex indices.
Vertices 1 and 6, and vertices 2 and 5 have identical coordinates, but are separate vertices. They each
have their own vertex normal
The process of taking two vertices that are in the same position and combining them into a single vertex is called
welding, while unwelding takes a single vertex and splits it into multiple vertices.
The Weld component uses a threshold angle as input. Any two adjacent faces with an angle less than the
threshold angle will be welded together, resulting in common vertices with a normal that is the average of the
adjacent faces. Unweld works in the opposite manner, where adjancent faces with an angle greater than the given
threshold will be unwelded, and their shared vertices will be duplicated.
1. The default Box Mesh has 726 vertices. The mesh is creased at the corners of the box, where vertices
Mesh Operations
173
Mesh Operations
174
This component tests to determine whether a given point is inside a mesh solid or not. This only works with closed
meshes.
Mesh Closest Point
This component will calculate the position on a mesh that is closest to a given point. This component outputs three
pieces of data: the coordinates of the calculated point on the mesh, the index of the face which contains that point,
and the mesh parameter. This parameter is extremely useful in conjunction with the Mesh Eval component
discussed below.
1. Given a point in space, We want to find the closet point on the mesh
2. The face that contains the closest point is identified
3. The parameters of the closest point on the face are calculated
For those users interested in a little more detail about how a mesh is parameterized, we can take a closer look at
how a mesh parameter is structured. You can see this structure by attaching a panel to the parameter output of a
Mesh Closest Point component. The mesh parameter has the form: N[A,B,C,D]. The first number, N, is the index of
the face which contains the calculated point.
The following four numbers define the b arycentric coordinates of the point within that face. The coordinates of the
Mesh Interactions
175
referenced point can be found by multiplying each vertex of the face by these numbers in order and then add the
results together. (Of course, this is already done for us, and is given in the Point output). Also note that barycentric
coordinates are only unique for triangular faces, meaning that on a quad face the same point could have multiple
different parameterizations. Grasshopper avoids this problem by internally triangulating a quad face when
calculating a parameter, the result of which is that of the four numbers in a mesh parameter, at least one of them
will always be zero.
Barycentric Coordinates
Mesh Eval
The Mesh Eval component uses a mesh parameter as an input and returns the referenced point, as well as the
normal and color at that point. The color and normal are calculated as interpolations of the vertex colors and vertex
normals, using the same barycentric coordinates as the mesh parameter.
Unlike joining curves or NURBS surfaces which require adjacency, any meshes can be joined into a single mesh even meshes that are not touching. Recall that a mesh is simply a list of vertices, and a list of faces. There is no
actual requirement for those faces to be connected (Although in most applications, such a mesh would not be very
desirable!!).
Mesh Interactions
176
This component does not weld mesh vertices together, so it is often useful to use this in combination with a Weld
component.
Mesh Boolean
Meshes in Grasshopper have a set of boolean operations similar to boolean operations for NURBS solids.
Boolean operations are order specific, meaning that switching the order of the input meshes A and B will result in
different outputs.
1. Mesh Difference
2. Mesh Intersection
3. Mesh Split
4. Mesh Union
Mesh Interactions
177
1. Mesh | Ray
2. Mesh | Plane
3. Mesh | Curve
4. Mesh | Mesh
Occlusion
As we have discussed, one of the (many) uses of mesh geometry is for visualizations and creating shaded
rendering based on face normals. When rendering, it also necessary to know when an object is in shadow behind
another object. The Occlusion component in Grasshopper allows us to enter a set of sample points, along with
occluding mesh geometry that will 'cast shadows', and a view ray, or vector, to indicate the direction that 'light' is
coming from.
Such a process can be used to create shadows in rendering, or determine whether objects are hidden from a
certain camera view.
Mesh Interactions
178
02.
03.
04.
05.
Params/Input/Number Slider - Drag and drop a Number Slider component onto the
canvas and set the following values:
Name: Length
Lower Limit: 1
Upper Limit: 10
Curve/Primitive/Line SDL - Drag and drop a Line SDL component onto the canvas
Connect the Point component to the Start (S) input of the Line SDL component, and
connect the Number Slider to the Length (L) input.
06.
The default Direction (D) value of **Line SDL** is the Unit Z vector, which is what we
will use for this example
Params/Input/Number Slider - Drag and drop a Number Slider onto the canvas and set
the following values:
Name: V Count
Working with Mesh Geometry
179
07.
Rounding: Integer
Lower Limit: 1
Upper Limit: 100
08.
Curve/Division/Divide Curve - Drag and drop a Divide Curve component onto the canvas
09.
Connect the Line (L) output of the Line SDL component to the Curve (C) input of the Divide
Curve component
10.
Connect the V Count number slider to the Count (N) input of the Divide Curve component
11.
Curve/Primitive/Circle CNR - Drag and drop a Circle CNR component onto the canvas
12.
Connect the Points (P) output of the Divide Curve component to the Center (C) input of the
Circle CNR component
We have a series of circles stacked vertically. We will use these to make the profile of our vase.
Next, we will use a Graph Mapper to control the radii of the circles.
13.
14.
Connect the V Count number slider to the Steps (N) input of the Range component
180
15.
Params/Input/Graph Mapper - Drag and drop a Graph Mapper component onto the
canvas
16.
Right-click the Graph Mapper, click 'Graph Types' from the menu and select 'Bezier'
17.
Params/Input/Number Slider - Drag and drop a Number Slider component onto the
canvas and set the following values:
Name: Width
Lower Limit: 0
Upper Limit: 10
18.
19.
Connect the Graph Mapper and the Width number slider to the A and B inputs of the
Multiplication component
20.
Connect the Result (R) output of the Multiplication component to the Radius (R) input of
the Circle CNR component
Use the handles on the Graph Mapper to adjust the profile of the circles.
NOTE: It is important to make sure the start point of the bezier curve on the Graph Mapper is not at zero. By
lifting the start point to a number greater than zero, we produce a flat base for our vase.
181
We now have a profile for our vase. Next, we will construct a mesh surface. This will require creating mesh vertices
and defining mesh faces according to the index of those vertices.
21.
22.
Params/Input/Number Slider - Drag and drop a Number Slider component onto the
canvas and set the following values:
Name: U Count
Rounding: Even
Lower Limit: 2
Upper Limit: 100
Curve/Division/Divide Curve - Drag and drop a Divide Curve component onto the canvas
Connect the Circle (C) output of the Circle CNR component to the the Curve (C) input of the
Divide Curve component, and connect the U Count number slider to the Count (N) input
23.
The Points(P) output of this component are the vertices we will use for our mesh
24.
Sets/Sequence/Series - Drag and drop two Series components onto the canvas
25.
Connect the U Count number slider to the Step (N) input of the first Series component, and
connect the V Count number slider to the Count (C) input of the same Series component
26.
Connect the Series (S) output of the first Series component to the Start (S) input of the
second Series component, and connect the U Count number slider to the Count (C) input
27.
Sets/List/Shift List - Drag and drop a Shift List component onto the canvas
28.
Connect the output of the second Series component to the List (L) input of the Shift List
component
29.
Maths/Operators/Addition - Drag and drop two Addition components onto the canvas
30.
Connect the output of the second Series component and the U Count number slider to the
A and B inputs of the first Addition component
31.
Connect the output of the Shift List component and the U Count number slider to the A and
B inputs of the second Addition component
32.
Mesh/Primitive/Mesh Quad - Drag and drop a Mesh Quad component onto the canvas
Connect the following to the inputs of the Mesh Quad component:
A - Second **Series** component
B - **Shift List**
C - First **Addition** component
D - Second **Addition** component
33.
We have just create the initial topology for our mesh. These faces will be combined
with the vertices. The order of these connections is crucial, so go ahead and double
check all the connections at this point!
34.
Sets/Tree/Flatten - Drag and drop a Flatten Tree component onto tha canvas
35.
Connect the Points (P) output of the Divide Curve component to the Tree (T) input of the
Flatten Tree Component
36.
Mesh/Primitive/Construct Mesh - Drag and drop a Construct Mesh component onto the
canvas
182
37.
Connect the Tree (T) output of the Flatten Tree component to the Vertices (V) input of the
Construct Mesh component
38.
Connect the Face (F) output of the Mesh Quad component to the Faces (F) input of the
Construct Mesh component. Right-click the F (Faces) input and select 'Flatten'
Next we will close the bottom of the vase. To do this, we will add the original origin point to our list of vertices, and
then construct triangle mesh faces from the bottom edge to that point.
39.
40.
Connect the U Count number slider to the Count (C) input of the Series component
41.
Sets/List/List Length - Drag and drop a List Length component onto the canvas
Connect the Tree (T) output of the Flatten Tree component to the List (L) input of the List
Length component
42.
This will be the index of the origin point after we add it to the existing list of vertices.
43.
Sets/List/Shift List - Drag and drop a Shift List component onto the canvas
Mesh/Primitive/Mesh Triangle - Drag and drop a Mesh Triangle component onto the
Working with Mesh Geometry
183
44.
45.
canvas
46.
Sets/Tree/Merge - Drag and drop two Merge components onto the canvas
47.
Connect the Tree (T) output of the Flatten Tree component to the D1 input, and connect the
initial Point component to the D2 input of the first Merge component
48.
Connect the Faces (F) of the Mesh Quad component to the D1 input, and connect the
Mesh Triangle output to the D2 input of the second Merge component
49.
Connect the first Merge component to the Vertices (V) input of the Construct Mesh
component, and connect the second Merge component to the Faces (F) input of the
Construct Mesh component.
We have capped the bottom of the vase with triangle mesh faces.
184
We will now add some detailing to the vase. We will start by adding a curve to the vertical direction by adjusting the
seam of the original circles
50.
51.
Connect the Circle (C) output of the Circle CNR component to the Curve (C) input of the
Seam component
52.
Right click the Curve (C) input of the Seam component and select 'Reparameterize'
53.
Params/Input/Number Slider - Drag and drop a Number Slider component onto the
canvas. We will use the default settings for this slider
54.
55.
Connect the output from the Graph Mapper to the A input, and the newest Number Slider to
the B input of the Multiplication component
56.
Connect the Result (R) of the Multiplication component to the Parameter (t) input of the
Seam component
The curvature is achieved by changing the seam position of the initial circles, and uses the same Graph
Mapper as the vase profile.
185
57.
58.
We are using the default Pattern (P) input of the **Dispatch** component to separate
the points into two lists with alternating points
59.
Vector/Vector/Vector 2Pt - Drag and drop a Vector 2Pt component onto the canvas
60.
Connect the B output of the Dispatch component to the A input of the Vector 2Pt
component
61.
Connect the Points (P) of the first Divide Curve component to the B input of the Vector 2Pt
component
Right-click the B input of the Vector 2Pt component and select 'Graft', and right-click the
Unitize (U) input, go to 'Set Boolean' and select 'True'
62.
This creates a unit vector for each point that points towards the center of the circle
63.
Params/Input/Number Slider - Drag and drop a Number Slider component onto the
canvas. We will use the default settings
64.
65.
Connect the Vector (V) output of the Vector 2Pt component to the A input, and connect the
Number Slider to the B input of the Multiplication component
66.
67.
Connect the B output of the Dispatch component to the Geometry (G) input of the Move
component
68.
Connect the Result (R) output of the Multiplication component to the Motion (T) input of the
Move component
186
69.
70.
Connect the A output of the Dispatch component to the 0 input of the Weave component
71.
Connect the Geometry (G) output of the Move component to the 1 input of the Weave
component
72.
Connect the Weave (W) output of the Weave component to the Tree (T) input of the Flatten
Tree component
Remember to go back and adjust your sliders and graph mapper to see how the model changes, and to
make sure everything still works. This is known as 'flexing' the model, and should be done frequently to check
for mistakes in the definition.
We now have a single surface for our vase. If we wanted to print this vase using a 3D printer, we need it to be a
closed solid. We will create a solid by offsetting the current mesh, then combining the original mesh and the offset
mesh.
187
73.
74.
Connect the Mesh (M) output of the Construct Mesh component to the Mesh (M) input of
the Deconstruct Mesh component
75.
Params/Input/Number Slider - Drag and drop a Number Slider component onto the
canvas. We will use the default settings
76.
77.
Connect the Normals (N) output of the Deconstruct Mesh component to the A input, and
connect the Number Slider to the B input of the Multiplication component
78.
79.
Connect the Vertices (V) output of the Deconstruct Mesh component to Geometry (G) input
of the Move component
80.
Connect the Result (R) output of the Multiplication component to the Motion (T) input of the
Move component
81.
Mesh/Primitive/Construct Mesh Drag and drop a Construct Mesh component onto the
canvas
82.
Connect the Geometry (G) output of the Move component to the Vertices (V) input of the
Construct Mesh component
83.
Connect the Faces (F) output of the Deconstruct Mesh component to the Face (F) input of
the Construct Mesh component
By offseting the mesh according to the vertex normals, we now have an 'inside' and an 'outside' mesh, but we
still have a gap at the top between the two mesh geometries
188
The final step will be to create a closed mesh by creating a new mesh geometry to close the gap and then joining
the meshes together.
84.
Mesh/Analysis/Mesh Edges - Drag and drop a Mesh Edges component onto the canvas
85.
Connect the Mesh (M) output of the first Construct Mesh component to the Mesh (M) input
of the Mesh Edges component
86.
Curve/Util/Join Curves - Drag and drop a Join Curves component onto the canvas
87.
Connect the Naked Edges (E1) output of the Mesh Edges component to the Curves (C)
input of the Join Curves component
88.
Curve/Analysis/Control Points - Drag and drop a Control Points component onto the
canvas
Connect the Curves (C) output of the Join Curves component to the Curve (C) input of the
Control Points component
89.
By joining the curves and then extrating the control points, we ensure that the order
of the points is consistent along the rim of the vase, which is important for making
the resulting mesh orientable and manifold
90.
Sets/List/Shift List - Drag and drop a Shift List component onto the canvas
91.
Connect the Points (P) output of the Control Points component to the List (L) input of the
Shift List component
92.
93.
94.
Zoom in to the Entwine component to show the option to add an extra input. We will need
four inputs. Connect them in the following way:
{0;0} - Points (P) from first **Control Points** component
{0;1} - output from first **Shift List**
{0;2} - output from second **Shift List**
{0;3} - Points (P) from second **Control Points** component
189
95.
Sets/Tree/Flip Matrix - Drag and drop a Flip Matrix component onto the canvas
96.
Connect the Result (R) from the Entwine component to the Data (D) input of the Flip
Matrix component
97.
Mesh/Primitive/Construct Mesh - Drag and drop a Construct Mesh component onto the
canvas
98.
Connect the Data (D) outut of the Flip Matrix component to the Vertices (V) input of the
Construct Mesh component
99.
Mesh/Util/Mesh Join - Drag and drop a Mesh Join component onto the canvas
100.
Connect all three Construct Mesh components to the Mesh Join component by holding
down the Shift key while connecting the wires (or use a Merge component). Right-click
the Mesh (M) input of the Mesh Join component and select 'Flatten'
190
191
2. Extensions
Foundations are meant to be built upon. This volume features an array of key
plugins for Grasshopper that will extend the application's functionality and your
ability to take your designs further.
Extensions
192
2.1. Element*
Element* is a mesh geometry plugin for Grasshopper, enabling mesh creation,
analysis, transformation, subdivision, and smoothing. Element* provides access
to mesh topology data using the Plankton half-edge data structure for polygon
meshes.
Element*
193
2.1.1. Element*
Integrating the use of Meshes in your workflow offers a wide variety of opportunities to create shapes that
range from faceted to smooth. Element* allows you to go further, by giving you more intuitive access to
analyzing mesh topology and smoothing routines. This chapter is a User's Guide for Element* Version 1.1 and
will get you up to speed.
Download the Element* plug-in to get started
Element* components are categorized based on their operations. Much like the periodic table, which provides a
framework for analyzing chemical behavior, Element provides a framework for analyzing and exloring
geometry based on mesh data and operations. We imagine new components will be created by analysing the
relationships between components in each category.
Introduction
194
Below are some inspirational images of the types of products and applications that could be generated using
Element*.
Introduction
195
Introduction
196
Introduction
197
198
199
2.1.3.1 Analyse
2.1.3.2 Data
Components
200
1. Data Visualizer
2. Edge Neighbors
3. Face Neighbors
4. Vertex Neighbors
Element* Data Visualizer
This component is used to help visualize the half-edge data of the faces of an input mesh.
Element* Edge Neighbors
This component provides access to the adjacency data structured according to the edges of the input mesh. The
output data is provided as a tree with one branch for each edge in the mesh. It returns the mesh edges, the edge
end points, center ponts of the faces adjacent to each edge (dual), the neighboring edges as line objects (arranged
in clockwise order) , and neighbouring face centers (center points of faces adjacent to the edge start and end
points)
Edge Neighbors - Edges, End vertices, Adjacent face centers, Neighboring edges, and Neighbouring face
centers
Element* Face Neighbors
This component is similar to the others in this section, but the data is organized in a tree according to the faces of
the mesh, with one branch per face. The outputs are the face centers, vertices of each face (arranged in counter
clockwise order), neighbouring edges (arranged in counter clockwise order), and the centers of neighboring faces
(arranged in counter clockwise order).
Components
201
Face Neighbors - Face centers, face vertices, neighbouring edges, neighbouring face centers
Element* Vertex Neighbors
This component outputs the mesh vertices, neighboring vertices (arranged in clockwise order), neighbouring
edges (arranged in clockwise order), and neighbouring face centers (arranged in clockwise order) structured in a
tree according to the vertices of the mesh.
Vertex Neighbors - Vertices, neighbouring vertices, neighbouring edges, neighbouring face centers
2.1.3.3 Primitives
Element* provides four additional mesh primitives: the Dodecahedron, Tetrahedron, Octahedron, and Icosahedron.
These components take a single number as input for the radius, and produce meshes centered at the origin, and
composed of one face per side. With the addition of the Cube, which is already availible through Grasshopper's
built-in primitives, these make up the five Platonic solids.
1. Dodecahedron
Components
202
2. Tetrahedron
3. Octahedron
4. Icosahedron
2.1.3.4 Smooth
Element* Smooth provides an optimized smoothing algorithm that is more efficient than Grasshopper's Smooth
Mesh for large datasets. It makes use of the Lapacian Smoothing algorithm for Half-Edge structured meshes. It
does not change the topology or vertex count of welded meshes, but will combine identical vertices if there are any
duplicates caused by an unwelded mesh. We can specify the smoothing strength, boundary condition, boundary
tolerance as well as the number of iterations.
2.1.3.5 Subdivide
Element* Catmull Clark Subdivision
This is a recursive subdivision defined by the Catmull Clark algorithm. We can specify the number of iterations as
well as how to handle naked edge conditions.
Element* Constant Quad
This subdivison component will create an all quad mesh by adding a face for each edge of the mesh.
Components
203
2.1.3.6 Transform
1. Mesh Windown
2. Mesh Frame
3. Mesh Thicken
4. Mesh Offset
5. Mesh Poke Face
These components provide a number of different transformations described below. Each component has the
additional capability of accepting per-vertex distance data to allow for variations of the transformation magnitudes
across the mesh.
Element* Mesh Window
Reconstructs a new mesh on the inside of a face based on an offset value. This component accepts either a mesh
or a list of closed polylines as input.
Element* Mesh Frame
Outputs a frame around mesh faces. Each resultant face will have a new hole in the center. This component
accepts either a mesh or a list of closed polylines as input.
Element* Mesh Thicken
This component will thicken an input mesh along the vertex normals, and according to provided distance values.
Element* Mesh Offset
This component creats an offset of the input mesh based on the vertex normals.
Element* Mesh Poke Face
First the mesh face goes through the frame operation then the face inner is split the selected faces and allows the
user to specify the push or pull amount from the center of the original polygon. For example, a four-sided polygon
(quad) is split into 4 three-sided polygons with one shared vertex in the middle. The height input allows you to
transform that vertex.
Components
204
1. Mesh Window
2. Mesh Frame
3. Icosohedron transformed with mesh frame, then thickend and subdivided
2.1.3.7 Utility
Components
205
Normal Count. The other returns the Mesh Status, which is the condition of the mesh, whether it has non manifold
edges, degenerate face count, naked edge count, and disjoined mesh count. This component does not operate on
a mesh it simply returns the information to the user. There is also an option to combine identical vertices, therefore
the user can see the effects this would have on the mesh.
Components
206
2.1.4. Exercise
In this section, we will work through a simple exercise using the Element* primitives as a base. We will
incorporate the half-edge data structure as well using both features of the transform components (uniform and
per vertex)
02.
03.
Params/Input/Number Slider - Drag and drop the Number Slider component onto the
canvas
04.
Connect the Number Slider to the Radius (R) input of the Icosohedron component
05.
Double-click the Number Slider and set appropriate values. For this example, we used:
Name: Radius
Rounding: Integer
Lower Limit: 5
Upper Limit: 50
Value: 25
06.
Element*/Data/Face Neighbors - Drag and drop the Face Neighbors component onto the
canvas
07.
Connect the Mesh (M) output of the Icosohedron component to the Mesh (M) input of the
Face Neighbors component.
Exercise
207
Looking at the data of the Neighboring Face Edges (NE) output, we see that we have a tree with 20 branches,
where each branch contains three lines. The 20 branches each represent a face of the icosohedron which
has 20 sides, while the three lines are the edges of each triangular face.
08.
Params/Input/Number Slider - Drag and drop a Number Slider component onto the
canvas and set the following values:
Rounding: Float
Lower Limit:0
Upper Limit: 0.5
09.
10.
Double-click the Panel component and enter "1" into the text-field
11.
12.
Connect the Panel with a value of "1" into the A input and connect the number slider to the
B input of the Subtraction component
13.
14.
Connect the Number Slider to the D1 input of Merge, and connect the output R of the
Subtraction component to the D2 input of Merge
15.
Curve/Analysis/Evaluate Curve - Drag and drop an Evaluate Curve component onto the
canvas
16.
Connect the Face Edges (NE) output of the Face Neighbors component to the Curve (C)
input of the the Evaluate Curve component
17.
Right click the Curve (C) input of the Evaluate Curve component and select Graft. This will
create a new branch for each edge.
18.
Connect the Result (R) output of the Merge component to the Parameter (t) input of the
Evaluate Curve component. Because we grafted the Curve input, each edge is evaluated
at both parameters from Merge
19.
Sets/Tree/Trim Tree - Drag and drop a Trim Tree component onto the canvas
Connect the Points (P) output of Evaluate Curve to the Tree (T) input of the Trim Tree
Exercise
208
20.
component.
The default value of Depth (D) input for **Trim Tree** is 1. This reduce the depth of
our data tree one level by merging the outer most branch. The result is 20 branches,
each with six points.
21.
22.
Connect the Tree (T) output of the Trim Tree component to the Vertices (V) input of the
Polyline component
23.
24.
25.
Right click the Closed (C) input of the Polyline component, click "Set Boolean" and set the
value to True
This has created a closed polyline of six sides for each original face of the mesh.
Element*/Transform/Mesh Frame - Drag and drop a Mesh Frame component onto the
canvas.
Connect the Polyline (Pl) output of the Polyline component to the Geometry (G) input of the
Mesh Frame component
Note that the **Mesh Frame** component can take either meshes or a list of closed
polyline curves as input
26.
Params/Input/Number Slider - Drage and drop a Number Silder component onto the
canvas. We will keep the default range of 0 to 1 for this slider
27.
Connect the Number Slider to the Factor (F) input of the Mesh Frame component
Exercise
209
28.
Element*/Utility/Mesh Combine and Clean - Drag and drop a Mesh Combine and Clean
component on the canvas
29.
Connect the Mesh (M) output of Mesh Frames to the Mesh (M) input of the Mesh Combine
and Clean component
30.
Right click the Mesh (M) input of Mesh Combine and Clean and select Flatten
By flattening the tree of meshes, **Combine and Clean** will merge all 20 face
meshes into a single mesh
31.
Element*/Transform/Mesh Thicken - Drag and drop a Mesh Thicken component onto the
canvas
32.
Connect the Mesh (M) output of Combine and Clean to the Mesh (M) input of Mesh Thicken
33.
34.
Connect the Mesh (M) output of Mesh Thicken to the Mesh (M) input of the Catmull Clark
Subdivision component
We have truncated the triangular faces of the initial mesh, effectively also creating rings around each original
vertex. We have also created a frame for each face, then thickened the mesh and refined it with subdivision.
Next we will take advantage of the Per Vertex capabilities of the transform components by using an attractor
point.
35.
Exercise
210
36.
37.
38.
Tip - you can also create a point directly in Grasshopper by double-clicking the
canvas to bring up the Search window, then typing a point coordinate such as
"10,10,0" (without the quotes)
39.
40.
Connect the Vertices (V) output of the Deconstruct Mesh component to the A input of the
the Distance component
41.
42.
Connect the Distance (D) output of the Distance component to the PerVectex Data (VD)
input of the Thicken component
43.
Params/Input/Number Slider - Drag and drop two Number Slider components onto the
canvas. We will use these to set the lower and upper limits for the Mesh Thicken
component
44.
Double-click the Number Sliders and set the values. In this example, we left the first slider
at default values, and set the Upper Limit of the second slider to 5.0
45.
46.
Connect the two number sliders to the A and B inputs of the Construct Domain component
47.
Connect the Domain (I) output of the Construct Domain component to the Min and Max
Values (D) input of the Mesh Thicken component.
48.
Exercise
Right click the Type (T) input of the Thicken component, select "Set Integer" and enter a
value of 1
You can also enable the PerVertex Data by using a **Boolean Toggle** component
set to True.
211
Exercise
212
2.1.5.1 Example 1
Example files that accompany this section: http://grasshopperprimer.com/appendix/A-2/1_gh-files.html
213
00.
Create a meshplane in Rhino with XFaces = 2 & YFaces = 2 and Start a new definition,
type Ctrl-N (in Grasshopper)
01.
01b.
Reference a mesh in Rhino by right-clicking the Mesh component and selecting "Set one
Mesh".
We are going to use a simple mesh plane to walk through the definition, feel free to
swap out the mesh with your own mesh
02.
Element*/Utility/Mesh Combine and Clean - Drag and drop a Element* Mesh Combine
and Clean component on the canvas
03.
04.
Params/Input/Number Slider - Drag and drop a Number Slider component onto the
canvas and set the following values:
Lower Limit: 0.0000
Upper Limit: 1.0000
05.
Curve/Analysis/Evaluate Curve - Drag and drop a Evaluate Curve container onto the
canvas
05b.
Connect the Neighbouring Edges (NE) output of the Element* Vertex Neighbors
component to the Curve (C) input of the Evaluate Curve component
05c.
Connect the Number Slider to the Float (t) input of the Evaluate Curve component and set
the value to 0.5000
05d.
Right click the Curve (C) input of the Evaluate Curve component and enable
Reparameterize
214
06.
Element*/Analyse/Mesh Closest Point - Drag and drop a Element* Mesh Closest Point
container onto the canvas
06a.
Connect the Mesh output (M) of the Element*/Utility/Mesh Combine and Clean
component to the Mesh (M) input of the Element* Mesh Closest Point component
06b.
Connect the Points output (P) of the Curve/Analysis/Evaluate Curve component to the
Point (P) input of the Element* Mesh Closest Point component
07.
Params/Input/Number Slider - Drag and drop a Number Slider component onto the
canvas and set the following values:
Rounding: Float
Lower Limit:0
Upper Limit: 10.000
08.
09.
10.
10b.
Connect the Face Centers output (FC) of the Element* Vertex Neighbors component to
the Point component
11.
215
12.
12b.
Connect the Weave output (W) of the Weave component to the Vertices (V) input of the
Polyline component
12c.
Right click the Closed (C) input of the Polyline component, click "Set Boolean" and set the
value to True
This has created a closed polyline.
13.
Params/Input/Number Slider - Drage and drop a Number Silder component onto the
canvas. We will keep the default range of 0 to 1 for this slider
14.
14b.
Connect the Polyline (Pl) output of the Polyline component to the Geometry (G) input of
the Mesh Frame component
Note that the **Mesh Frame** component can take either meshes or a list of
closed polyline curves as input
14c.
Connect the Number Slider to the Factor (F) input of the Mesh Frame component
15.
Element*/Utility/Mesh Combine and Clean - Drag and drop a Element* Mesh Combine
and Clean component on the canvas
Right click the Combine Type (CT) input of the Element* Mesh Combine and Clean
component, click "Set Integer" and set the value to 1.
216
15b.
16.
17.
17b
The Combine Type input has two options (0, which combines and cleans the
meshes) and (1, which joins the meshes in the list without merging vertices). In
this example we want to join the meshes
Right click the Mesh (M) input of the Element* Mesh Combine and Clean component, click
"Flatten".
This will flatten the list so we can join the mesh list together.
18.
19.
2.1.5.2 Example 2
Example files that accompany this section: http://grasshopperprimer.com/appendix/A-2/1_gh-files.html
217
00.
Create a meshplane in Rhino with XFaces = 2 & YFaces = 2 and Start a new definition,
type Ctrl-N (in Grasshopper)
01.
01b.
Reference a mesh in Rhino by right-clicking the Mesh component and selecting "Set one
Mesh".
We are going to use a simple mesh plane to walk through the definition, feel free to
swap out the mesh with your own mesh
02.
Element*/Utility/Mesh Combine and Clean - Drag and drop a Element* Mesh Combine
and Clean component on the canvas
03.
04.
05.
Params/Input/Number Slider - Drag and drop a Number Slider component onto the
canvas and set the following values:
Rounding: Float
Lower Limit:0
Upper Limit: 2.000
06.
07.
Maths/Operators/Addition - Drag and drop two Addition components onto the canvas
08.
09.
218
10.
11,12.
11b,12b.
11c,12c.
13,14.
Params/Input/Number Slider - Drag and drop a Number Slider component onto the
canvas and set the following values:
Rounding: Float
Lower Limit:0
Upper Limit: 1.000
Connect the Number Slider (10) to the Factor (F) input of the Mesh Frame component
Element*/Subdivide/Catmull Clark Subdivision - Drag and drop a Catmull Clark
Subdivision component onto the canvas
We will set the Iterations input (I) value to 1 as well as the **Edge Condition**
input (E) to a value of 1. The edge condition input options are 0 = Fixed, 1 ==
Smooth, 2 == Corners Fixed.
15.
Sets/Tree/Merge - Drag and drop two Merge components onto the canvas
15b.
Right click the Result (R) output of the Merge component and click "Flatten".
16.
Components have detailed remarks and warnings to inform the user of the current or potential issues that
might come about from interaction with other components. In some instances you might use the Element
Comb ine and Clean component to join and comb ine identical vertices on a mesh which could lead to non
manifold edges if that mesh is thickend later on. The Element Combine and Clean component will inform you
of this issue that will return the list back to you. You have the option of setting the Combine Type to a value of 1
which will combine the meshes in the list but not combine identical vertices.
219
17.
Element*/Utility/Mesh Edges - Drag and drop a Element* Mesh Edges component on the
canvas
17b
Connect the Mesh (M) output of the Element* Mesh Combine and Clean component (16)
to the Mesh input (M) of the Element* Mesh Edges component
18.
Params/Input/Number Slider - Drag and drop a Number Slider component onto the
canvas and set the following values:
Rounding: Float
Lower Limit:0
Upper Limit: 1.000
19.
19b
Connect the Face Polylines (FP) output of the Element* Mesh Edges component to the
Mesh input (M) of the Element* Mesh Frame component
19c
Connect the Number Slider to the Float (f) input of the Element* Mesh Frame component
20.
Element*/Utility/Mesh Combine and Clean - Drag and drop a Element* Mesh Combine
and Clean component on the canvas
21.
Right click the Mesh (M) input of the Element* Mesh Combine and Clean component and
click "Flatten".
Right click the Combine Type (CT) input of the Element* Mesh Combine and Clean
220
22.
23.
24.
25.
Element*/Utility/Mesh Status - Drag and drop a Element* Mesh Status component on the
canvas
25b
Connect the Info (I) and Status (S) outputs of Element* Mesh Status to a
Params/Input/Panel component
The mesh **Info** output contains mesh validity information, closed or open type
and mesh component counts (vertices, faces, normals). The mesh **Status**
informs the user if the mesh is in "Good" condition as well as data regarding non
manifold edges, unused vertex count, degenerate face count, naked edge count
and disjoined mesh count.
221
Appendix
The following section contains useful references including an index of all the
components used in this primer, as well as additional resources to learn more
about Grasshopper.
Appendix
222
Appendix
223
2.1. Index
This index provides additional information on all the components used in this primer, as well as other
components you might find useful. This is just an introduction to over 500 components in the Grasshopper
plugin.
Parameters
Geometry
P.G.Crv
Curve Parameter
Represents a collection of Curve geometry. Curve geometry is
the common denominator of all curve types in Grasshopper.
P.G.Circle
Circle Parameter
Represents a collection of Circle primitives.
P.G.Geo
Geometry Parameter
Represents a collection of 3D Geometry.
P.G.Pipeline
Geometry Pipeline
Defines a geometry pipeline from Rhino to Grasshopper.
P.G.Pt
Point Parameter
Point parameters are capable of storing persistent data. You can
set the persistent records through the parameter menu.
P.G.Srf
Surface Parameter
Represents a collection of Surface geometry. Surface geometry
is the common denominator of all surface types in Grasshopper.
Primitive
P.P.Bool
Boolean Parameter
Represents a collection of Boolean (True/False) values.
P.P.D
Domain Parameter
Represents a collection of one-dimensional Domains. Domains
are typically used to represent curve fragments and continuous
numeric ranges. A domain consists of two numbers that indicate
the limits of the domain, everything in between these numbers is
part of the domain.
P.P.D2
Domain2 Parameter
Contains a collection of two-dimensional domains. 2D Domains
are typically used to represent surface fragments. A twodimensional domain consists of two one-dimensional domains.
P.P.ID
Guid Parameter
Represents a collection of Globally Unique Identifiers. Guid
parameters are capable of storing persistent data. You can set
the persistent records through the parameter menu.
P.P.Int
Integer Parameter
Represents a collection of Integer numeric values. Integer
parameters are capable of storing persistent data. You can set
Index
224
P.P.Num
Number Parameter
Represents a collection of floating point values. Number
parameters are capable of storing persistent data. You can set
the persistent records through the parameter menu.
P.P.Path
File Path
Contains a collection of file paths.
Input
P.I.Toggle
Boolean Toggle
Boolean (true/false) toggle.
P.I.Button
Button
Button object with two values. When pressed, the button object
returns a true value and then resets to false.
P.I.Swatch
Color Swatch
A swatch is a special interface object that allows for quick setting
of individual color values. You can change the color of a swatch
through the context menu.
P.I.Grad
Gradient Control
Gradient controls allow you to define a color gradient within a
numeric domain. By default the unit domain (0.0 ~ 1.0) is used,
but this can be adjusted via the L0 and L1 input parameters. You
can add color grips to the gradient object by dragging from the
color wheel at the upper left and set color grips by right clicking
them.
P.I.Graph
Graph Mapper
Graph mapper objects allow you to remap a set of numbers. By
default the {x} and {y} domains of a graph function are unit
domains (0.0 ~ 1.0), but these can be adjusted via the Graph
Editor. Graph mappers can contain a single mapping function,
which can be picked through the context menu. Graphs typically
have grips (little circles), which can be used to modify the
variables that define the graph equation. By default, a graph
mapper objects contains no graph and performs a 1:1 mapping
of values.
P.I.Slider
Number Slider
A slider is a special interface object that allows for quick setting of
individual numeric values. You can change the values and
properties through the menu, or by double-clicking a slider
object. Sliders can be made longer or shorter by dragging the
rightmost edge left or right. Note that sliders only have an output
(ie. no input).
P.I.Panel
Panel
A panel for custom notes and text values. It is typically an inactive
object that allows you to add remarks or explanations to a
Document. Panels can also receive their information from
elsewhere. If you plug an output parameter into a Panel, you can
see the contents of that parameter in real-time. All data in
Grasshopper can be viewed in this way. Panels can also stream
their content to a text file.
P.I.List
Value List
Index
225
Utilities
P.U.Cin
Cluster Input
Represents a cluster input parameter.
P.U.COut
Cluster Output
Represents a cluster input parameter.
P.U.Dam
Data Dam
Delay data on its way through the document.
P.U.Jump
Jump
Jump between different locations.
P.U.Viewer
Param Viewer
A viewer for data structures.
P.U.Scribble
Scribble
A quick note.
Maths
Domain
M.D.Bnd
Bounds
Create a numeric domain which encompasses a list of
numbers.
M.D.Consec
Consecutive Domains
Create consecutive domains from a list of numbers.
M.D.Dom
Construct Domain
Create a numeric domain from two numeric extremes.
M.D.Dom2Num
Construct Domain
Create a two-dimensional domain from four numbers.
M.D.DeDomain
Deconstruct Domain
Deconstruct a numeric domain into its component parts.
M.D.DeDom2Num
Deconstruct Domain
Deconstruct a two-dimensional domain into four numbers.
M.D.Divide
Divide Domain
Divides a two-dimensional domain into equal segments.
Index
226
M.D.Divide
Divide Domain
Divides a two-dimensional domain into equal segments.
M.D.Inc
Includes
Test a numeric value to see if it is included in the domain.
M.D.ReMap
Remap Numbers
Remap numbers into a new numeric domain.
Operators
M.O.Add
Addition
Mathematical addition.
M.O.Div
Division
Mathematical division.
M.O.Equals
Equality
Test for (in)equality of two numbers.
M.O.And
Gate And
Perform boolean conjunction (AND gate). Both inputs need to be
True for the result to be True.
M.O.Not
Gate Not
Perform boolean negation (NOT gate).
M.O.Or
Gate Or
Perform boolean disjunction (OR gate). Only a single input has
to be True for the result to be True.
M.O.Larger
Larger Than
Larger than (or equal to).
M.O.Multiply
Multiplication
Mathematical multiplication.
M.O.Smaller
Smaller Than
Larger than (or equal to).
M.O.Similar
Similarity
Test for similarity of two numbers.
M.O.Sub
Subtraction
Mathematical subtraction.
Index
227
Script
M.S.Eval
Evaluate
Evaluate an expression with a flexible number of variables.
M.S.Expression
Expression
Evaluate an expression.
Trig
M.T.Cos
Cosine
Compute the cosine of a value.
M.T.Deg
Degrees
Convert an angle specified in radians to degrees.
M.T.Rad
Radians
Convert an angle specified in degrees to radians.
M.T.Sin
Sine
Compute the sine of a value.
Utilities
M.U.Avr
Average
Solve the arithmetic average for a set of items.
M.U.Phi
Golden Ratio
Returns a multiple of the golden ratio (Phi).
M.U.Pi
Pi
Returns a multiple of Pi.
Sets
List
S.L.Combine
Combine Data
Combine non-null items out of several inputs.
S.L.CrossRef
Cross Reference
Cross Reference data from multiple lists.
S.L.Dispatch
Dispatch
Dispatch the items in a list into two target lists. List dispatching
is very similar to the [Cull Pattern] component, with the exception
that both lists are provided as outputs.
S.L.Ins
Insert Items
Insert a collection of items into a list.
Index
228
S.L.Item
List Item
Retrieve a specific item from a list.
S.L.Lng
List Length
Measure the length of a list. Elements in a list are identified by
their index. The first element is stored at index zero, the second
element is stored at index one and so on and so forth. The
highest possible index in a list equals the length of the list
minus one.
S.L.Long
Longest List
Grow a collection of lists to the longest length amongst them.
S.L.Split
Split List
Split a list into separate parts.
S.L.Replace
Replace Items
Replace certain items in a list.
S.L.Rev
Reverse List
Reverse the order of a list. The new index of each element will
be N-i where N is the highest index in the list and i is the old
index of the element.
S.L.Shift
Shift List
Offset all items in a list. Items in the list are offset (moved)
towards the end of the list if the shift offset is positive. If Wrap
equals True, then items that fall off the ends are re-appended.
S.L.Short
Shortest List
Shrink a collection of lists to the shortest length amongst them.
S.L.Sift
Sift Pattern
Sift elements in a list using a repeating index pattern.
S.L.Sort
Sort List
Sort a list of numeric keys. In order for something to be sorted, it
must first be comparable. Most types of data are not
comparable, Numbers and Strings being basically the sole
exceptions. If you want to sort other types of data, such as
curves, youll need to create a list of keys first.
S.L.Weave
Weave
Index
229
Sets
S.S.Culli
Cull Index
Cull (remove) indexed elements from a list.
S.S.Cull
Cull Pattern
Cull (remove) elements in a list using a repeating bit mask. The
bit mask is defined as a list of Boolean values. The bit mask is
repeated until all elements in the data list have been evaluated.
S.S.Dup
Duplicate Data
Duplicate data a predefined number of times. Data can be
duplicated in two ways, either copies of the list are appended at
the end until the number of copies has been reached, or each
item is duplicated a number of times before moving on to the
next item.
S.S.Jitter
Jitter
Randomly shuffles a list of values. The input list is reordered
based on random noise. Jittering is a good way to get a random
set with a good distribution. The jitter parameter sets radius of
the random noise. If jitter equals 0.5, then each item is allowed
to reposition itself randomly to within half the span of the entire
set.
S.S.Random
Random
Generate a list of pseudo random numbers. The number
sequence is unique but stable for each seed value. If you do not
like a random distribution, try different seed values.
S.S.Range
Range
Create a range of numbers. The numbers are spaced equally
inside a numeric domain. Use this component if you need to
create numbers between extremes. If you need control over the
interval between successive numbers, you should be using the
[Series] component.
S.S.Repeat
Repeat Data
Repeat a pattern until it reaches a certain length.
S.S.Series
Series
Create a series of numbers. The numbers are spaced
according to the {Step} value. If you need to distribute numbers
inside a fixed numeric range, consider using the [Range]
component instead.
Tree
S.T.Explode
Index
Explode Tree
Extract all the branches from a tree.
230
S.T.Flatten
Flatten Tree
Flatten a data tree by removing all branching information.
S.T.Flip
Flip Matrix
Flip a matrixlike data tree by swapping rows and columns.
S.T.Graft
Graft Tree
Typically, data items are stored in branches at specific index
values (0 for the first item, 1 for the second item, and so on and
so forth) and branches are stored in trees at specific branch
paths, for example: {0;1}, which indicates the second sub-branch
of the first main branch. Grafting creates a new branch for every
single data item.
S.T.Merge
Merge
Merge a bunch of data streams.
S.T.Path
Path Mapper
Perform lexical operations on data trees. Lexical operations are
logical mappings between data paths and indices which are
defined by textual (lexical) masks and patterns.
S.T.Prune
Prune Tree
Removes all branches from a Tree that carry a special number of
Data items. You can supply both a lower and an upper limit for
branch pruning.
S.T.Simplify
Simplify Tree
Simplify a tree by removing the overlap shared amongst all
branches.
S.T.TStat
Tree Statistics
Get some statistics regarding a data tree.
S.T.Unflatten
Unflatten Tree
Unflatten a data tree by moving items back into branches.
Vector
Grid
V.G.HexGrid
Hexagonal
2D grid with hexagonal cells.
V.G.RecGrid
Rectangular
2D grid with rectangular cells.
Index
231
V.G.SqGrid
Square
2D grid with square cells
Point
V.P.Pt
Construct Point
Construct a point from {xyz} coordinates.
V.P.pDecon
Deconstruct
Deconstruct a point into its component parts.
V.P.Dist
Distance
Compute Euclidean distance between two point coordinates.
Vector
V.V.X
Unit X
Unit vector parallel to the world {x} axis.
V.V.Y
Unit Y
Unit vector parallel to the world {y} axis.
V.V.Vec2Pt
Vector 2Pt
Create a vector between two points.
Curve
Analysis
C.A.CP
Control Points
Extract the nurbs control points and knots of a curve.
Division
C.D.Divide
Index
Divide Curve
Divide a curve into equal length segments.
232
Primitive
C.P.Cir
Circle
Create a circle defined by base plane and radius.
C.P.Cir3Pt
Circle 3Pt
Create a circle defined by three points.
C.P.CirCNR
Circle CNR
Create a circle defined by center, normal and radius.
C.P.Line
Line SDL
Create a line segment defined by start point, tangent and length.
C.P.Polygon
Polygon
Create a polygon with optional round edges.
Spline
C.S.IntCrv
Interpolate
Create an interpolated curve through a set of points.
C.S.KinkCrv
Kinky Curve
Construct an interpolated curve through a set of points with a
kink angle threshold.
C.S.Nurbs
Nurbs Curve
Construct a nurbs curve from control points.
C.S.PLine
PolyLine
Create a polyline connecting a number of points.
Util
C.U.Explode
Index
Explode
Explode a curve into smaller segments.
233
<C.U.Join
Join Curves
Join as many curves as possible.
C.U.Offset
Offset
Offset a curve with a specified distance.
Surface
Analysis
S.A.DeBrep
Deconstruct Brep
Deconstruct a brep into its constituent parts.
Freeform
S.F.Boundary
Boundary Surfaces
Create planar surfaces from a collection of boundary edge
curves.
S.F.Extr
Extrude
Extrude curves and surfaces along a vector.
S.F.ExtrPt
Extrude Point
Extrude curves and surfaces to a point.
S.F.Loft
Loft
Create a lofted surface through a set of section curves.
S.F.RevSrf
Revolution
Create a surface of revolution.
S.F.Swp2
Sweep2
Create a sweep surface with two rail curves.
Primitive
S.P.BBox
Index
Bounding Box
Solve oriented geometry bounding boxes.
234
Util
S.U.SDivide
Divide Surface
Generate a grid of {uv} points on a surface.
S.U.SubSrf
Isotrim
Extract an isoparametric subset of a surface.
Mesh
Triangulation
M.T.Voronoi
Voronoi
Planar voronoi diagram for a collection of points.
Transform
Affine
T.A.RecMap
Rectangle Mapping
Transform geometry from one rectangle into another.
Array
T.A.ArrLinear
Linear Array
Create a linear array of geometry.
Morph
T.M.Morph
Index
Box Morph
Morph an object into a twisted box.
235
T.M.SBox
Surface Box
Create a twisted box on a surface patch.
Display
Color
D.C.HSL
Colour HSL
Create a colour from floating point {HSL} channels.
Dimensions
D.D.Tag
Text tags
A text tag component allows you to draw little Strings in the
viewport as feedback items. Text and location are specified as
input parameters. When text tags are baked they turn into Text
Dots.
D.D.Tag3D
Text Tag 3D
Represents a list of 3D text tags in a Rhino viewport
Preview
D.P.Preview
Custom Preview
Allows for customized geometry previews.
Vector
D.V.Points
Index
Point List
Displays details about lists of points.
236
1.3.
1.3.2.1_attractor definition.gh
1.3.3_operators and conditionals.gh
1.3.3.4_trigonometry components.gh
1.3.3.5_expressions.gh
1.3.4_domains and color.gh
1.3.5_booleans and logical operators.gh
1.4.
1.4.1.2_grasshopper spline components.gh
1.4.3_data matching.gh
1.4.4_list creation.gh
1.4.5_list visualization.gh
1.4.6_list management.gh
1.4.7_working with lists.gh
1.5.
1.5.1.3_morphing definition.gh
1.5.2.1_Data Tree Visualization.gh
1.5.3_working with data trees.gh
1.5.3.6_weaving definition.gh
1.5.4_rail intersect definition.gh
1.6.
1.6.1_what is a mesh.gh
1.6.3_creating meshes.gh
1.6.6_working with meshes.gh
Example Files
237
2.3. Resources
There are many resources available to learn more about Grasshopper and parametric design concepts. There
are also over a hundred plugins and add-ons that extend Grasshopper s functionality. Below are some of our
favorites.
Plug-in Communities
food4Rhino (WIP) is the new Plug-in Community Service by McNeel. As a user, find the newest Rhino Plug-ins,
Grasshopper Add-ons, Textures and Backgrounds, add your comments, discuss about new tools, get in contact
with the developers of these applications, share your scripts. http://www.food4rhino.com/
Add-ons We Love
DIVA-for-Rhino allows users to carry out a series of environmental performance evaluations of individual buildings
and urban landscapes. http://diva4rhino.com/
Element is a mesh geometry plugin for Grasshopper, enabling mesh creation, analysis, transformation,
subdivision, and smoothing. http://www.food4rhino.com/project/element
Firefly offers a set of comprehensive software tools dedicated to bridging the gap between Grasshopper and the
Arduino micro-controller. http://fireflyexperiments.com
GhPython is the Python interpreter component for Grasshopper that allows you to execute dynamic scripts of any
type. Unlike other scripting components, GhPython allows the use of rhinoscriptsyntax to start scripting without
needing to be a programmer. http://www.food4rhino.com/project/ghpython
Resources
238
HAL is a Grasshopper plugin for industrial robots programming supporting ABB, KUKA and Universal Robots
machines. http://hal.thibaultschwartz.com/
Extends Grasshoppers ability to create and reference geometry including lights, blocks, and text objects. Also
enables access to information about the active Rhino document, pertaining to materials, layers, linetypes, and
other settings. http://www.food4rhino.com/project/human
Karamba is an interactive, parametric finite element program. It lets you analyze the response of 3-dimensional
beam and shell structures under arbitrary loads. http://www.karamba3d.com/
Kangaroo is a Live Physics engine for interactive simulation, optimization and form-finding directly within
Grasshopper. http://www.food4rhino.com/project/kangaroo
Fold panels using curved folding and control panel distribution on surfaces with a range of attractor systems.
http://www.food4rhino.com/project/robofoldkingkong
LunchBox is a plug-in for Grasshopper for exploring mathematical shapes, paneling, structures, and workflow.
http://www.food4rhino.com/project/lunchbox
Meshedit is a set of components which extend Grasshoppers ability to work with meshes.
http://www.food4rhino.com/project/meshedittools
Parametric tools to create and manipulate rectangular grids, attractors and support creative morphing of parametric
patterns. http://www.food4rhino.com/project/pt-gh
Resources
239
Platypus allows Grasshopper authors to stream geometry to the web in real time. It works like a chatroom for
parametric geometry, and allows for on-the-fly 3D model mashups in the web browser.
http://www.food4rhino.com/project/platypus
TT Toolbox features a range of different tools that we from the Core Studio at Thornton Tomasetti use on a regular
basis, and we thought some of you might appreciate these. http://www.food4rhino.com/project/tttoolbox
Weaverbird is a topological modeler that contains many of the known subdivision and transformation operators,
readily usable by designers. This plug-in reconstructs the shape, subdivides any mesh, even made by polylines,
and helps preparing for fabrication. http://www.giuliopiacentino.com/weaverbird/
Additional Primers
The Firefly Primer This book is intended to teach the basics of electronics (using an Arduino) as well as various
digital/physical prototyping techniques to people new to the field. It is not a comprehensive book on electronics (as
there are already a number of great resources already dedicated to this topic). Instead, this book focuses on
expediting the prototyping process. Written by Andrew Payne. http://fireflyexperiments.com/resources/
Essential Mathematics Essential Mathematics uses Grasshopper to introduce design professionals to foundation
mathematical concepts that are necessary for effective development of computational methods for 3D modeling
and computer graphics. Written by Rajaa Issa.
http://www.rhino3d.com/download/rhino/5.0/EssentialMathematicsThirdEdition/
Generative Algorithms A series of books which is aimed to develop different concepts in the field of Generative
Algorithms and Parametric Design. Written by Zubin Khabazi. http://www.morphogenesism.com/media.html
Rhino Python Primer This primer is intended to teach programming to absolute beginners, people who have
tinkered with programming a bit or expert programmers looking for a quick introduction to the methods in Rhino.
Written by Skylar Tibbits. http://www.rhino3d.com/download/IronPython/5.0/RhinoPython101
General References
Wolfram MathWorld is an online mathematics resource., assembled by Eric W. Weisstein with assistance from
thousands of contributors. Since its contents first appeared online in 1995, MathWorld has emerged as a nexus of
mathematical information in both the mathematics and educational communities. Its entries are extensively
referenced in journals and books spanning all educational levels. http://mathworld.wolfram.com/
Further Reading
Burry, Jane, and Mark Burry. The New Mathematics of Architecture. London: Thames & Hudson, 2010.
Burry, Mark. Scripting Cultures: Architectural Design and Programming. Chichester, UK: Wiley, 2011.
Resources
240
Hensel, Michael, Achim Menges, and Michael Weinstock. Emergent Technologies and Design: Towards a Biological
Paradigm for Architecture. Oxon: Routledge, 2010.
Jabi, Wassim. Parametric Design for Architecture. Laurence King, 2013.
Menges, Achim, and Sean Ahlquist. Computational Design Thinking. Chichester, UK: John Wiley & Sons, 2011.
Menges, Achim. Material Computation: Higher Integration in Morphogenetic Design. Hoboken, NJ: Wiley, 2012.
Peters, Brady, and Xavier De Kestelier. Computation Works: The Building of Algorithmic Thought. Wiley, 2013.
Peters, Brady. Inside Smartgeometry: Expanding the Architectural Possib ilities of Computational Design.
Chichester: Wiley, 2013.
Pottmann, Helmut, and Daril Bentley. Architectural Geometry. Exton, PA: Bentley Institute, 2007.
Sakamoto, Tomoko, and Albert Ferr. From Control to Design: Parametric/algorithmic Architecture. Barcelona: ActarD, 2008.
Woodbury, Robert. Elements of Parametric Design. London: Routledge, 2010.
Resources
241
242