Grasshopper and Rhino

Handy Tips

Grasshopper tips:
  • Make a number slider with shorthand notation: 1 < 5 < 20.
  • Right click to pan the canvas.
  • Left-click then Alt to copy a component.
  • Control-Alt left click to find item in menu.
  • Control-Tab to switch among GH windows, same as in SolidWorks.
Rhino tips:
  • Right click to pan in the X-Y window.
  • Right click rotates in the Perspective window.
  • Shift-Right click to pan in the Perspective window.

Importing Objects from Rhino.

  1. In Rhino, select Curve > Free form > Interpolate Points.
  2. Draw a gently waving curve on the XY plane. Hit Enter to complete the curve.

  3. In GH, insert a Params > Geometry > Curve component.
  4. Right click and choose Set One Curve.
  5. Click on the curve in Rhino to select it.

  6. Insert a number slider 2<10<40 below the Curve component.
  7. Insert a Curve > Division > Divide Curve component.
  8. Connect the Curve component to the C input of Divide Curve.
  9. Connect the number slider to the N input of Divide Curve.

  10. Hover over the "t" (not "T") output and observe the values.
  11. Right click on the Curve component and set Reparameterize.
  12. Hover over the "t" output of the Divide Curve component and observe that the values now range from 0 to 1.

  13. Insert a Vector > Plane > Adjust Plane component.
  14. Connect the P output of Divide Curve to the P input of Adjust Plane. Note that Adjust Plane wants a set of planes as input, but the P output of Divide Curve is a set of points. Grasshopper automatically converts the points to planes with origins at those points.
  15. Connect the T output of Divide Curve to the N input of Adjust Plane. Now the planes are normal to the curve at each point.

  16. Insert a Params > Input > Graph Mapper component.
  17. Right click and set Graph Types to Parabola.
  18. Double click on the Graph Mapper component to open the dialog box.
  19. Click on the Y domain boxes and set the domain to 2:5. Then click OK.
  20. Connect the "t" output of Divide Curve to the input of the Graph Mapper.
  21. Insert a Curve > Primitive > Ellipse component.
  22. Connect the output of the Graph Mapper to the R1 and R2 inputs of the Ellipse.
  23. Observe that the ellipses are all centered on the origin in the XY plane.

  24. Connect the P output of the Adjust Plane component to the P input of the Ellipse component.
  25. Disable the preview of the Adjust Plane component so we see only the Ellipse component.
  26. Observe that the ellipses are tangent to the curve.

  27. Insert a Surface > Freeform > Loft component.
  28. Connect the output of the Ellipse component to the C input of the Loft.
  29. Insert a Surface > Util > Cap Holes component.
  30. Connect the output of the Loft component to the input of the Cap Holes component.
  31. Bake the Cap Holes component.

  32. In Rhino, click on the surface to select it.
  33. Move it so it no longer coincides with the the Grasshopper surface.
  34. Go to the View menu in Rhino and change the view from Wireframe to Rendered.
  35. Go to File > Export Selected, set the output type to STL file, and save the file. This file can now be 3D printed.

Surface Geometry in Grasshopper/Rhino

There are four kinds of surface geometry:
  1. Geometric primitives (box, sphere, cone, etc.).
  2. Meshes.
  3. NURBS (Non-Uniform Rational B-Splines) surfaces.
  4. Breps (Boundary Representations).

Geometric Primitives: Rhino vs. Grasshopper

You can use geometric primtives to make surface geometry in either Grasshopper or Rhino.
  1. In GH do File > New to make a new canvas,
  2. In Rhino, do File > New and select No Template.

  3. In GH, insert a Params > Geometry > Plane component.
  4. Right click on the component and choose Set One Plane.
  5. In Rhino, click in the XY plane to set the origin of the new plane.
  6. Then click to set the plane orientation, and once more to select the up/down direction.

  7. In Grasshopper, insert a Surface > Primitive > Cone component.
  8. Connect the output of the Plane component to the B input of the Cone component.
  9. Right click on the radius (R) input, choose Set Number, and set the value to 3.
  10. Right click on length (L) input, choose Set Number, and set the length to 10.

  11. In Rhino, select Solid > Cone and draw a cone with its base on the XY plane. The first click sets the center of the base, the second click sets the radius, and the third click sets the height.
  12. Note: if you need to change the size of the cone you can use the Rhino command BoxEdit.
  13. In GH, create a Params > Geometry component and do Set One Geometry to reference the cone you created in Rhino.

Making and Editing Curves


Ways of making curves: 
  Curve > Polyline
  Curve > Freeform > Interpolate points
  Curve > Freeform > Control points

Editing curves:

To adjust control points:
  Select curve, press F10 to show control points.
  Press F11 to hide control points.

To adjust edit points:
  Edit > Control Points > Show Edit Points
  Press F11 to hide them

Use Control-left click to raise a curve (or a point) along the Z axis.

Multiple Representations of Surface Geometry

We've already seen how to construct surface geometry using geometric primitives such as Cone. Let's examine another other way of generating surfaces, based on NURBS.
  1. Draw three gently waving curves in the XY plane, stacked one above the other. After each curve, hit Enter to repeat the curve command.
  2. Insert a Params > Curve component.
  3. Right click and select Set Multiple Curves.
  4. Click on the desired curves in Rhino.
  5. Press Enter when done.
  6. Control-click on the middle curve to raise it.

  7. Insert a Surface > FreeForm > Loft component.
  8. Connect the Curve component to the C input of the Loft component.

  9. Surface as a NURB: insert a Surface > Analysys > Surface Points component, and connect the Loft to its input. This shows the NURB control points of the surface. The U and V outputs give the number of divisions along each dimension, and there are U*V control points.

  10. Surface as a mesh: insert a Mesh > Analysis > Face Normals component, and connect the Loft to its input. This shows the centerpoints of all the mesh faces.
  11. Insert a Display > Vector > Vector Display Ex component.
  12. Connect the Centers (C) output of the Face Normals component to the P input of the Vector Display Ex component.
  13. Connect the Normals (N) output of the Face Normals component to the V input of the Vector Display Ex component.
  14. To get the normals to point in the opposite direction, right click on the N output, select Expression, and enter "x*-1".

  15. Surface as a BREP: insert a Surface > Analysis > BREP Topology component and connect the Loft to its input. This shows the bounding curves of the surface.

  16. Make a box and a cone in Rhino using the Solid menu items.
  17. Import the box and cone into Grasshopper as geometry parameters.
  18. Subtract the cone from the box using Intersection > Shape > Solid Difference.
  19. Feed the output to a BREP Topology component.

  20. Tip: Middle click on Loft component to pop up a shortcut menu where you can turn Preview on/off or Enable/Disable the component.

NURBS From Two Sets of Curves (U and V)

  1. Make two sets of curves in orthogonal directions.
  2. Import each set into a Params > Curve object
  3. Insert a Surface > Freeform > Network Surface component.
  4. Feed the curves into the U and V inputs of the Network Surface Component.

Colored Radial Grid

  1. Draw a small cylinder at the origin in Rhino and connect it to a Params > Geometry component.
  2. Insert a Vector > Grid > Radial component.
  3. Insert a Transform > Euclidean > Move component.
  4. Connect the Geometry component to the geometry input of Move.
  5. Connect the Radial Grid P output to the T input of Move To.
  6. Insert a Sets > List > List Length component and connect the Radial grid P output to its input.
  7. Insert a Sets > Sequence > Random component. Connect the output of List Length to the N input.
  8. Set the domain (R) values of the Random component to 0.3 to 1.
  9. Make two copies of the Random component, stacked vertically.
  10. Set the seed (S) values of the Random components to 1, 2, and 3.
  11. Insert a Transformations > Affine > Scale NU (Non-Uniform) component.
  12. Connect the output of Move To to the G input of Scale NU.
  13. Connect the output of the first Random component to the Z input of Scale NU.
  14. Insert a Display > Color > Colour CMYK component.
  15. Connect the outputs of the three Random components to the C, M, and Y inputs of the CMYK component.
  16. Create a Display > Preview > Custom Preview component.
  17. Connect the G output of Scale NU to the G input of Custom Preview.
  18. Connect the output of CMYK to the M input of Custom Preview.
  19. To see the colors, turn off preview of the other components and turn on preview for Custom Preview. Make sure that nothing is selected.
  20. Flatten the Radial Grid P output so that all cylinders get unique colors.

  21. To eliminate the innermost cylinders, which are overlapped: first undo the Flatten of the Radial Grid P output.
  22. Insert a Set > Tree > Flip Matrix component and connect the Radial Grid P output to it.
  23. Insert a Set > Sequence > Cull Index component and feed it the output of Flip Matrix.
  24. Right click on the index input to Cull Index and do Set Multiple Integers; set the values to 0 and 1.
  25. Flatten the output of Cull Index.
  26. Run the output of Cull Index into the inputs of the Move and List Length components.

Dave Touretzky
Last modified: Wed Apr 5 20:31:55 EDT 2017