# Grasshopper and Rhino

## Handy Tips

• Make a number slider with shorthand notation.
• Left-click plus Alt to copy.
• Control-Alt left click to find item in menu.
• Control-Tab to switch among GH windows, same as in SolidWorks.

## Importing Objects from Rhino.

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

3. In GH, insert a Params > Geometry > Curves 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 Curves 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. Click on the Y domain box and set it to 2:5.
19. Connect the "t" output of Divide Curve to the input of the Graph Mapper.
20. Insert a Curve > Primitive > Ellipse component.
21. Connect the output of the Graph Mapper to the R1 and R2 inputs of the Ellipse.
22. Observe that the ellipses are all centered on the origin in the XY plane.

23. Insert a Transformations > Euclidean > Origin component.
24. Connect the E output of the Ellipse component to the geometry input of the Origin component.
25. Connect the P output of the Adjust Plane component to the B input of Orient.
26. Disable the preview of the Ellipse component so we see only the Orient component.
27. Observe that the ellipses are tangent to the curve.

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

33. In Rhino, click on the surface to select it.
34. Move it so it no longer coincides with the the Grasshopper surface.
35. Go to the View menu in Rhino and change the view from Wireframe to Rendered.
36. 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. NURBS (Non-Uniform Rational B-Splines) surfaces.
3. Meshes.
4. Breps (Boundary Representations).

## Experimenting with Geometric Primitives

1. In GH do File > New to make a new canvas.
2. In Rhino, do File > New.
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. 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 baseon the XY plane.
12. In GH, create a Params > Geometry component and set it to the cone you created in Rhino.

## Making and Edting Curves

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

Editing curves:

Select curve, press F10 to show control points.
Press F11 to hide control 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

1. Draw three gently waving curves in the XY plane, stacked one above the other.
2. Insert a Params > Curves component.
3. Right click and select Set Multiple Curves.
4. Click on the desired curves in Rhino.
5. Press Enter when done.

6. Insert a Surface > FreeForm > Loft component.
7. Connect the Curves component to the C input of the Loft component.

8. 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.

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 BREP: insert a Surface > Analysis > BREP Topology component and connect the Loft to its input. This shows the bounding curves of the surface.

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

## More Things To Try

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

5. Make a cube. Subtract a cone from it using Intersection > Shape > Solid Difference.

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 To component.
4. Connect the Geometry component to the geometry input of Move To.
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.

Dave Touretzky