Grasshopper: Visual Scripting for Rhinoceros 3D
()
About this ebook
We live in a three-dimensional world. To design objects for everyday living, users must learn how to create in three dimensions. For precise modern designs that must conform to specific tolerances, we use computers to create a digital model first, and then pass that model on to a machine, such as a CNC router or 3D printer for fabrication.
There are many software packages that are used to create digital models. One such package that is popular for industrial, product, and graphic design and architecture is Rhinoceros 3D, or “Rhino.” Grasshopper is a visual scripting platform for Rhino. With it, the user can build precise, customizable Rhino objects by simply dragging boxes around the screen and connecting them with virtual “wires.” No knowledge of programming is necessary!
This work provides an introduction to modeling objects with Grasshopper. Through a series of examples and tutorials, readers will learn how to build complex objects by combining simple components. Applications include both NURBS surface modeling and mesh manipulation techniques.
In Part I, Bachman offers a brief overview of scripting with Grasshopper, with simple examples used to introduce the reader to the most common Grasshopper components. In Part II, more complicated Grasshopper scripts are presented, showcasing the variety of objects readers can create. These examples were carefully chosen so that readers can see how the concepts from Part I can be put together to create increasingly complex designs. Finally, Part III features a reference guide from Grasshopper’s own help files containing descriptions of some of the most common Grasshopper components.
David Bachman
David Bachman is a Professor of Mathematics at Pitzer College (Claremont, CA). His is the author of two previous works, Advanced Calculus Demystified, published by McGraw-Hill, and A Geometric Approach to Differential Forms, published by Birkhäuser, as well as more than 20 research articles. Through his company, David Bachman Design, Inc., he regularly consults with an international clientele of artists and product designers. In addition, Bachman’s own designs have been shown in a variety of galleries across the US.
Related to Grasshopper
Related ebooks
Performative Materials in Architecture and Design Rating: 0 out of 5 stars0 ratingsNew Geometric Systems: Jekabs Zvilna and Integrative Form-Languages Rating: 0 out of 5 stars0 ratingsInflection 03: New Order: Journal of the Melbourne School of Design Rating: 0 out of 5 stars0 ratingsAutodesk Revit Architecture 2016 for Architects and Designers Rating: 5 out of 5 stars5/5CITA Complex Modelling Rating: 0 out of 5 stars0 ratings3ds Max Speed Modeling for 3D Artists Rating: 5 out of 5 stars5/5Autodesk 3ds Max 2019: A Detailed Guide to Arnold Renderer Rating: 0 out of 5 stars0 ratingsLeadership in Architecture: My Passion in Life Rating: 0 out of 5 stars0 ratingsAutodesk 3ds Max 2020: Modeling Essentials, 2nd Edition Rating: 0 out of 5 stars0 ratingsBlender 3D: Designing Objects Rating: 1 out of 5 stars1/5MAXON Cinema 4D R20: Modeling Essentials Rating: 0 out of 5 stars0 ratingsManual of Section Rating: 4 out of 5 stars4/5Spacetecture Rating: 0 out of 5 stars0 ratingsRevit 2020 for Architecture: No Experience Required Rating: 0 out of 5 stars0 ratingsExploring Autodesk Revit 2020 for Architecture, 16th Edition Rating: 0 out of 5 stars0 ratingsModern Architecture and Climate: Design before Air Conditioning Rating: 4 out of 5 stars4/5Exploring Autodesk Revit 2018 for Architecture, 14th Edition Rating: 5 out of 5 stars5/5BIG-BIM 4.0: Ecosystems for a Connected World Rating: 4 out of 5 stars4/5Exploring Autodesk Revit 2017 for Structure , 7th Edition Rating: 1 out of 5 stars1/5Keyshot 3D Rendering Rating: 0 out of 5 stars0 ratingsLumion 3D Best Practices Rating: 5 out of 5 stars5/5Autodesk Revit 2020 Black Book Rating: 0 out of 5 stars0 ratingsRevolution? Architecture and the Anthropocene Rating: 0 out of 5 stars0 ratings3D Printing and CNC Fabrication with SketchUp Rating: 0 out of 5 stars0 ratingsAutodesk 3ds Max 2019: Arnold Essentials Rating: 0 out of 5 stars0 ratingsGreen BIM: Successful Sustainable Design with Building Information Modeling Rating: 1 out of 5 stars1/5Autodesk 3ds Max 2020: A Detailed Guide to Arnold Renderer, 2nd Edition Rating: 0 out of 5 stars0 ratings
Mathematics For You
What If?: Serious Scientific Answers to Absurd Hypothetical Questions Rating: 5 out of 5 stars5/5Alan Turing: The Enigma: The Book That Inspired the Film The Imitation Game - Updated Edition Rating: 4 out of 5 stars4/5Math Magic: How To Master Everyday Math Problems Rating: 3 out of 5 stars3/5Quantum Physics for Beginners Rating: 4 out of 5 stars4/5Algebra - The Very Basics Rating: 5 out of 5 stars5/5The Little Book of Mathematical Principles, Theories & Things Rating: 3 out of 5 stars3/5Mental Math Secrets - How To Be a Human Calculator Rating: 5 out of 5 stars5/5My Best Mathematical and Logic Puzzles Rating: 4 out of 5 stars4/5Basic Math & Pre-Algebra For Dummies Rating: 4 out of 5 stars4/5Standard Deviations: Flawed Assumptions, Tortured Data, and Other Ways to Lie with Statistics Rating: 4 out of 5 stars4/5Flatland Rating: 4 out of 5 stars4/5Algebra II For Dummies Rating: 3 out of 5 stars3/5Real Estate by the Numbers: A Complete Reference Guide to Deal Analysis Rating: 0 out of 5 stars0 ratingsThe Golden Ratio: The Divine Beauty of Mathematics Rating: 5 out of 5 stars5/5Logicomix: An epic search for truth Rating: 4 out of 5 stars4/5Calculus Made Easy Rating: 4 out of 5 stars4/5Relativity: The special and the general theory Rating: 5 out of 5 stars5/5Sneaky Math: A Graphic Primer with Projects Rating: 0 out of 5 stars0 ratingsPre-Calculus For Dummies Rating: 5 out of 5 stars5/5Algebra I Workbook For Dummies Rating: 3 out of 5 stars3/5Summary of The Black Swan: by Nassim Nicholas Taleb | Includes Analysis Rating: 5 out of 5 stars5/5How to Solve It: A New Aspect of Mathematical Method Rating: 4 out of 5 stars4/5Statistics: a QuickStudy Laminated Reference Guide Rating: 0 out of 5 stars0 ratingsThe Everything Guide to Algebra: A Step-by-Step Guide to the Basics of Algebra - in Plain English! Rating: 4 out of 5 stars4/5Game Theory: A Simple Introduction Rating: 4 out of 5 stars4/5Trigonometry For Dummies Rating: 0 out of 5 stars0 ratingsACT Math & Science Prep: Includes 500+ Practice Questions Rating: 3 out of 5 stars3/5
Reviews for Grasshopper
0 ratings0 reviews
Book preview
Grasshopper - David Bachman
Part 1
Learning Grasshopper
1
Getting Started
FIGURE 1.1. The Grasshopper window with the Geometry panel expanded.
When you first start up Grasshopper you’ll see something like Figure 1.1, a mostly blank window with a menu of little boxes along the top. The blank part is called the canvas, and it is where you’ll build your programs, called scripts. Each object and operation in Rhino is represented by a box, called a component. For example, there are components corresponding to Rhino primitive objects like spheres and cylinders, components corresponding to Rhino transformations like revolve and translate, and components for building one object from others, such as loft.
A menu of the most basic components initially appears across the top of the Rhino window. Those components are put into panels, and more components in each panel can be accessed by clicking on the name of the panel. For example, clicking on the word Geometry at the top of the screen expands that panel, as shown in Figure 1.1, giving you access to many more components. Furthermore, many more panels of components are in different tabs.
To build a Grasshopper script, you simply drag components onto the canvas, and connect them with wires,
represented as arcs. The input and output to each component is either an object (e.g., a sphere), a piece of data (e.g., a number), or an operation (e.g., a rotation). Information always passes between components from left to right. Hence, wires connected to the left side of a component represent a flow of input data, and wires connected on the right represent output.
As with any design package, there are often several ways to create a desired object in Grasshopper. For our first examples of Grasshopper scripts, we will see five different ways to create the simple cylinder shown in Figure 1.2.
The Cylinder Component
Since a cylinder is a basic object in Rhino, there is a built-in Grasshopper component that does the same thing. Click on the Surface tab to bring up the panels of components for working with surfaces. Then click on the Primitive panel, and finally select Cylinder. Now click anywhere on the canvas to place a Cylinder component there.
FIGURE 1.2. A cylinder in Rhino, generated by a Grasshopper script.
Immediately you should notice several things about this component. On the left side of the box there are three little white bumps. These are places where you can connect wires from other components for input data. The bumps correspond to the letters B,
R,
and L,
which stand for Base Plane,
Radius,
and Length.
If you rest the pointer over each of these letters, a little callout window will pop up telling you what the input represents, and its default value. The Base Plane
is the plane on which the cylinder will sit. This not only sets the 3-dimensional orientation of the cylinder, but also its location in space, since the center of the base of the cylinder is the origin of the Base Plane.
In the Rhino viewports you should see the cylinder created by this component.
To change the radius of the cylinder, right-click on the letter R.
A secondary pop-up menu will appear. Select Set Number,
type any number in the window, and click Commit Changes.
The cylinder in the Rhino viewport will now change.
One of the most powerful things about Grasshopper is its ability to dynamically interact with the user. To see this, go to the Params tab, and select the Number Slider component from the Input panel. By default, this slider outputs a real number between 0 and 1. Place this component on the canvas to the left of the Cylinder component. Then move the pointer to the white bump on the right side of the slider, hold down the left mouse button, and drag a wire to the R
input of the Cylinder component. Notice that the name of the slider automatically changes to the word Radius.
Watch the Rhino viewport as you play with the Grasshopper slider. You should see the cylinder expanding and contracting as its radius changes. You can also place a second slider on the canvas, and connect it to the L
input. Adjusting that slider will change the height of the cylinder. See Figure 1.3.
FIGURE 1.3. Building an adjustable cylinder with the Cylinder component.
Now try double-clicking on the name of either slider. A new window will pop up, where you can adjust the minimum and maximum values of the slider (among other things). Changing these will allow you to make the cylinder as big as you want.
At this point, the cylinder you see in the Rhino window is only a preview of what Grasshopper is generating. It is not a Rhino object, and thus cannot be manipulated within Rhino. Once you are satisfied with the look of your cylinder, you can turn it into a Rhino object by right-clicking on the C
output of the Cylinder component, and selecting Bake.
Extruding a Circle
For our second method, we’ll do a vertical extrusion of a circle, as in Figure 1.4. Start with the Circle component (Curve tab, Primitive panel). By default, this creates a circle of radius 1 in the XY-plane. To make a cylinder we’ll do a vertical extrusion. Place an Extrude component (Surface tab, Freeform panel) on the canvas to the right of the Circle component. Then connect the output of the Circle component to the B
input of the Extrude component.
FIGURE 1.4. Vertically extruding a circle produces a cylinder.
At this point the Extrude component should be orange, indicating that it needs more information in order to function. A small bubble appears in its top-right corner, and hovering over it reveals the message Input parameter D failed to collect data.
The D
input is waiting for a vector to tell the Extrude component which direction to do the extrusion, and how far. Drop a Unit Z component (Vector tab, Vector panel), representing a unit vector in the Z-direction, on the canvas and connect it to the D
input of the Extrude component. All components should now be their usual gray, representing the fact that they are functioning properly, and a cylinder should appear in the Rhino viewport.
Hovering over the output of each component reveals a description of what that component is generating. For example, hovering over the output of the Unit Z component displays {0.0,0.0,1,0},
which is a vertical vector of length one. As with the previous method, to change the radius of the cylinder, just attach a number slider to the R
input of the Circle component. To change the height, attach a number slider to the F
input of the Unit Z component. This has the effect of rescaling the vector coming out of that component, which in turn tells the Extrude component to create a surface of a different height.
At this point there are two components outputting geometry to the Rhino viewport: the Circle component and the Extrude component. When we build more complicated objects, you will want to display only the object generated by one particular component. To do this, click on the small icon in the top-right corner of the Grasshopper window that looks like a half-green, half-gray surface, as shown in Figure 1.5. Now you’ll only see objects in the Rhino viewport when you select them on the canvas, and they will appear there green.
FIGURE 1.5. Click here to change the display mode to only draw a preview of selected objects.
FIGURE 1.6. Lofting two circles will make a cylinder.
Lofting Two Circles
Following the previous method, select the Extrude component and delete it. In its place, drop a Move component (Transform tab, Euclidean panel). Connect the output of the Circle component to the G
input, and the output of the Unit Z component to the T
input. As you would likely guess, the Move component will now move the circle up in the Z-direction.
Now place a Loft component (Surface tab, Freeform panel) on the canvas, above and to the right of the Move component. Connect the output of the Move component to the C
input of the Loft component. Then, holding down the shift key, also connect the output of the Circle component to the C
input of the Loft component, as in Figure 1.6. The Loft component is now being given two circles, and will create a surface between them.
Piping a Line Segment
Our fourth method is depicted in Figure 1.7. Begin with a Line component (Curve tab, Primitive panel). Right-click on the A
input, and choose Set one Point.
The Grasshopper window will temporarily disappear, leaving you looking at the Rhino viewport. Select the origin. Do the same thing for the B
input, but this time select the point (0, 0,1). (You’ll have to do this in Rhino’s Front or Right viewport. If you want to select these points exactly, it is helpful to have Grid Snaps on in Rhino.) The Line component should now make a line connecting these two points.
FIGURE 1.7. Piping a line segment.
Now drop a Pipe component (Surface tab, Freeform panel) onto the canvas. Connect the output of the Line component to the C
input of the pipe. Just as in the Rhino Pipe
command, the Pipe component puts a tube around the curve that is fed into it. A tube around the line segment constructed above is again a cylinder. The radius of the resulting cylinder can be adjusted at the R
input of the Pipe component.
Revolving a Line Segment
Begin with the line segment from the previous method. As in the third method demonstrated previously, move this line segment one unit in the X-direction by feeding it to the G
input of a Move component, with a Unit X component connected to the T
input. Place a Revolution component (Surface tab, Freeform panel) on the right side of the canvas. Connect the output of the Line component to the A
input (thus defining the axis of revolution), and the output of the Move component to the P
input (defining the curve to be revolved). See Figure 1.8. By default, the input curve is revolved a full 2π radians (360 degrees) around the axis line, in this case creating a full cylinder.
FIGURE 1.8. Making a cylinder by revolving a line segment.
2
Lists
A Simple List
As we saw in the previous chapter, wires in a Grasshopper script represent the flow of information between components. In each of the scripts of the previous section, there was a single piece of information passing through each wire. However, one of the things that makes Grasshopper powerful is that wires can simultaneously contain multiple pieces of information in a list. We illustrate this in our next example.
One of the primitive surfaces in Rhino is a torus, or donut shape, as in Figure 2.1. Unfortunately, at the time of this writing this has not been incorporated as a Grasshopper primitive surface. Perhaps the easiest way to make such a surface is to create a pipe around a circle, just as when we made a cylinder by piping a line segment in the previous chapter. Here we will use a different method