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.
- In Rhino, select Curve > Free form > Interpolate Points.
- Draw a gently waving curve on the XY plane. Hit Enter to complete the curve.
- In GH, insert a Params > Geometry > Curve component.
- Right click and choose Set One Curve.
- Click on the curve in Rhino to select it.
- Insert a number slider 2<10<40 below the Curve component.
- Insert a Curve > Division > Divide Curve component.
- Connect the Curve component to the C input of Divide Curve.
- Connect the number slider to the N input of Divide Curve.
- Hover over the "t" (not "T") output and observe the values.
- Right click on the Curve component and set Reparameterize.
- Hover over the "t" output of the Divide Curve component and observe
that the values now range from 0 to 1.
- Insert a Vector > Plane > Adjust Plane component.
- 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.
- 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.
- Insert a Params > Input > Graph Mapper component.
- Right click and set Graph Types to Parabola.
- Double click on the Graph Mapper component to open the dialog box.
- Click on the Y domain boxes and set the domain to 2:5. Then click OK.
- Connect the "t" output of Divide Curve to the input of the Graph Mapper.
- Insert a Curve > Primitive > Ellipse component.
- Connect the output of the Graph Mapper to the R1 and R2 inputs of the Ellipse.
- Observe that the ellipses are all centered on the origin in the XY plane.
- Connect the P output of the Adjust Plane component to the P input of the Ellipse component.
- Disable the preview of the Adjust Plane component so we see only the Ellipse component.
- Observe that the ellipses are tangent to the curve.
- Insert a Surface > Freeform > Loft component.
- Connect the output of the Ellipse component to the C input of the Loft.
- Insert a Surface > Util > Cap Holes component.
- Connect the output of the Loft component to the input of the Cap Holes component.
- Bake the Cap Holes component.
- In Rhino, click on the surface to select it.
- Move it so it no longer coincides with the the Grasshopper surface.
- Go to the View menu in Rhino and change the view from Wireframe to Rendered.
- 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:
- Geometric primitives (box, sphere, cone, etc.).
- Meshes.
- NURBS (Non-Uniform Rational B-Splines) surfaces.
- Breps (Boundary Representations).
Geometric Primitives: Rhino vs. Grasshopper
You can use geometric primtives to make surface geometry in either Grasshopper or Rhino.
- In GH do File > New to make a new canvas,
- In Rhino, do File > New and select No Template.
- In GH, insert a Params > Geometry > Plane component.
- Right click on the component and choose Set One Plane.
- In Rhino, click in the XY plane to set the origin of the new plane.
- Then click to set the plane orientation, and once more to select the up/down direction.
- In Grasshopper, insert a Surface > Primitive > Cone component.
- Connect the output of the Plane component to the B input of the Cone component.
- Right click on the radius (R) input, choose Set Number, and set the value to 3.
- Right click on length (L) input, choose Set Number, and set the length to 10.
- 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.
- Note: if you need to change the size of the cone you can use the Rhino command BoxEdit.
- 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.
- Draw three gently waving curves in the XY plane, stacked one above the other. After each
curve, hit Enter to repeat the curve command.
- Insert a Params > Curve component.
- Right click and select Set Multiple Curves.
- Click on the desired curves in Rhino.
- Press Enter when done.
- Control-click on the middle curve to raise it.
- Insert a Surface > FreeForm > Loft component.
- Connect the Curve component to the C input of the Loft component.
- 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.
- 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.
- Insert a Display > Vector > Vector Display Ex component.
- Connect the Centers (C) output of the Face Normals component to the P input of the
Vector Display Ex component.
- Connect the Normals (N) output of the Face Normals component to the V input of the
Vector Display Ex component.
- To get the normals to point in the opposite direction, right click on the N output, select
Expression, and enter "x*-1".
- 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.
- Make a box and a cone in Rhino using the Solid menu items.
- Import the box and cone into Grasshopper as geometry parameters.
- Subtract the cone from the box using Intersection > Shape > Solid Difference.
- Feed the output to a BREP Topology component.
- 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)
- Make two sets of curves in orthogonal directions.
- Import each set into a Params > Curve object
- Insert a Surface > Freeform > Network Surface component.
- Feed the curves into the U and V inputs of the Network Surface Component.
Colored Radial Grid
- Draw a small cylinder at the origin in Rhino and connect it to a Params > Geometry component.
- Insert a Vector > Grid > Radial component.
- Insert a Transform > Euclidean > Move component.
- Connect the Geometry component to the geometry input of Move.
- Connect the Radial Grid P output to the T input of Move To.
- Insert a Sets > List > List Length component and connect the Radial grid P output
to its input.
- Insert a Sets > Sequence > Random component. Connect the output of List Length to the N input.
- Set the domain (R) values of the Random component to 0.3 to 1.
- Make two copies of the Random component, stacked vertically.
- Set the seed (S) values of the Random components to 1, 2, and 3.
- Insert a Transformations > Affine > Scale NU (Non-Uniform) component.
- Connect the output of Move To to the G input of Scale NU.
- Connect the output of the first Random component to the Z input of Scale NU.
- Insert a Display > Color > Colour CMYK component.
- Connect the outputs of the three Random components to the C, M, and Y inputs of
the CMYK component.
- Create a Display > Preview > Custom Preview component.
- Connect the G output of Scale NU to the G input of Custom Preview.
- Connect the output of CMYK to the M input of Custom Preview.
- To see the colors, turn off preview of the other components and turn on preview for
Custom Preview. Make sure that nothing is selected.
- Flatten the Radial Grid P output so that all cylinders get unique colors.
- To eliminate the innermost cylinders, which are overlapped: first undo the Flatten of the Radial Grid P output.
- Insert a Set > Tree > Flip Matrix component and connect the Radial Grid P output to it.
- Insert a Set > Sequence > Cull Index component and feed it the output of Flip Matrix.
- Right click on the index input to Cull Index and do Set Multiple Integers; set the values to 0 and 1.
- Flatten the output of Cull Index.
- Run the output of Cull Index into the inputs of the Move and List Length components.
|