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.
  • Alt-Control-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 (in the plane of the points) 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 box and set it 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. Insert a Transformations > Euclidean > Orient component.
  25. Connect the E output of the Ellipse component to the geometry input of the Orient component.
  26. Connect the P output of the Adjust Plane component to the B input of Orient.
  27. Disable the previews of the Ellipse and Adjust Plane components so we see only the Orient component.
  28. Observe that the ellipses are tangent to the curve.

  29. Insert a Surface > Freeform > Loft component.
  30. Connect the output of the Orient component to the C input of the Loft.
  31. Insert a Surface > Util > Cap Holes component.
  32. Connect the output of the Loft component to the input of the Cap Holes component.
  33. Bake the Cap Holes component.

  34. In Rhino, click on the surface to select it.
  35. Move it so it no longer coincides with the the Grasshopper surface.
  36. Go to the View menu in Rhino and change the view from Wireframe to Rendered.
  37. 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 > 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. 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 some another way of generating sturfaces, 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. 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.

  15. Make a box. Subtract a cone from it using Intersection > Shape > Solid Difference.
  16. Feed the output to a BREP Topology component.

  17. 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 cylinder 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 three Sets > Sequence > Random components. Connect the output of List Length to their N inputs.
  8. Set the seed (S) values of the Random components to 1, 2, and 3.
  9. Set the domain (R) values of the Random components to 0.3 to 1.
  10. Insert a Transformations > Affine > Scale NU (Non-Uniform) component.
  11. Connect the output of Move To to the G input of Scale NU.
  12. Connect the output of the first Random component to the Z input of Scale NU.
  13. Insert a Display > Color > CMYK component.
  14. Connect the outputs of the three Random components to the C, M, and Y inputs of the CMYK component.
  15. Create a Display > Preview > Custom Preview component.
  16. Connect the G output of Scale NU to the G input of Custom Preview.
  17. Connect the output of CMYK to the S input of Custom Preview.
  18. To see the colors, turn off preview of the other components and turn on preview for Custom Preview. Make sure that nothing is selected.
  19. Flatten the Radial Grid P output so that all cylinders get unique colors.

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