Parametrize a Rhino model using Grasshopper
This article covers a few methods in Grasshopper that you can use to parametrize a simple Rhino Model. It shows you some basic options, but is by no means a complete list of all available options. You'll get a basic understanding of how you could replace parts of your model with geometry that you generate parametrically using Grasshopper.
Use the Bake option to create 'real' Rhino geometry from any geometry that Grasshopper creates. When you bake your solution, you can specify to which layer, which helps you to keep your model clutter-free.
Rhino is a modeller that builds 3D models, which means using X, Y and Z coordinates. There's much more to it, but for this article we limit it to the basics. Working with 3D models inherently means working with vectors.
While you work in Rhino, for a large part the vector math may be hidden, but everything you do is based on them. This means that when you use Grasshopper to construct 3D models, you need to know and use some vector math. Basics you learn in Secondary School should be sufficient to grasp the basic concepts.
For a introduction or recap on vector math, you could read up in the Essential Mathematics for Computational Design, which is available through the Rhino website: Essential Mathematics Second Edition
Positions of points, which includes edit- and control points for curves and surfaces are stored as XYZ-vectors. Moving stuff also uses vectors.
Vectors have a direction, specified by the X, Y and Z values and a magnitude. The magnitude is the length of the vector, sometimes referred to as amplitude. A special kind of vectors is a Unit vector, which have a magnitude of 1. This makes it extremely useful to be used in calculations. The Unit(ize) function in Grasshopper will take any vector and change its length to 1.
Basic math operations on vectors:
- You can add two vectors. The result is a vector that points to the location that you would reach if you followed both vector A and B (in any order):
- You can subtract vectors. The result is a vector. It's basically the same as addition, but the resulting vector will point in the opposite direction.
- you can multiply a vector by a scalar (number). The resulting vector will have a magnitude that is set to the the current length multiplied by the scalar. (You see how a Unit vector might come in handy?!) Note that this does not change the direction of the vector, unless you multiply it by a negative number, which reverses the vector.
There are more operations you can perform, but for now, these will cover most basic applications of vectors. Stuff like rotating vectors doesn't need to be done by calculations: there are components that will do this for you.
Adding History to Booleans
One of the limitations of History in Rhino, is that it doesn't work with Booleans. Boolean operations are a powerful tool for modelling, but they do lack the option to be altered in a later stage.
Grasshopper was developed as an explicit history plug-in to overcome shortcomings like these in Rhino.
There are two main options: using solids that are modelled in Rhino and using solids that are generated from Grasshopper. Of course you can combine these two options.
Using Existing Rhino Solids
Use thecomponent to have Grasshopper use existing Rhino Solid objects. If you RMB click the Brep component, use Set one Brep to select a single Brep in Rhino. Brep stands for Boundary Representation, which actually is a collection of geometry types in Rhino. A Solid is a Brep, but so is a single surface or an open polysurface. But a Brep isn't necessarily a Solid. Just so you know.
Use Set Multiple Breps to specify multiple solids, but only if the Boolean you're using supports it.
is used for Solide Difference Booleans. Union and Intersect are also available.
The Difference component has two inputs:
- Solids to subtract from
- Solids to be subtracted (from A).
Connect your Brep components to these inputs. The resulting solid will be in output R, but as this is on exactly the same position as your originals, it might be hard to spot.
This is why, in the example, we've connected the output to a component on the Geometry input. On the Translate Vector input, we've connected a vector component to move it in the X direction. We've set the input of the Unit X Vector component to 30 for the translation distance, in this case using a component.
If you now change the original solids in Rhino, the resulting Solid that is generated by Grasshopper will change automatically.
Creating Solids in Grasshopper
Thesection contains the components that will create Solids Primitives. There are various ways of creating a box-shape. Choose the option that suits your scenario best.
The main things to take care of is positioning the geometry and settings the size.
To position your objects, the easiest and most flexible solution is to use a. You can specify a origin plane and by choosing the right type of plane, you determine the orientation.
The size of the primitives is controlled by inputs on each component that creates Solids.
This example creates two boxes using thecomponent. Input Base Plane is used to specify the construction plane for this box. We've connected a .
The Origin of this plane is set using a component. The second box skips the Construct Point component and uses a Panel with X Y and Z specified, separated by commas. The result is the same, but it's a bit quicker and neater.
Both Boxes use components to set the width, height and depth of the box. You can also use Panels of course.
The rest of the example is the same as the example with existing Rhino Solids, covered earlier.
Change Extrudes and Lofts using Vectors
The following examples show you the basic principles of creating extrudes and Lofts in Grasshopper. A straight extrude uses a vector to specify the direction in which the extrude is made. You can use various vector components to parametrize the direction and distance of the extrusion.
With lofts you can use Grasshopper to change the distance between curves for the loft or move the around to research various options.
The example use thecomponent to use an existing curve in Rhino.
The component is used to make a straight extrusion. Other extrusion options are also available. The direction and distance are controlled by a single vector. The example uses a component to create a vector, which is fed into a component that sets the length (magnitude) of the vector. This is fed into the Direction Vector input of the Extrude component.
You might also want to set the extrusion direction by specifying an angle (relative to some vector). You could use one of the components to create a fixed vector that you rotate ( ) around an axis by a set amount of radians or degrees.
When you have existing curves that you use to make a loft, you may want to change the position of these curves. You can do this using theor components. The move component uses vectors to specify the direction and distance.
The first curve is moved in the Z-direction by using a component. The length of this Unit factor is changed by using the Factor input with a Number Slider.
The second curve is moved by rotating a Z-vector around the Y-axis using thecomponent. To specify an angle in degrees, right-click the Angle input and enable 'Degrees', which converts the input from degrees to radians, which are used internally in the component by default.
Note that the component only has one input, Curves, for curves that should be lofted. A loft always uses at least two curves, so in this example we need to link both outputs from the Move components to this input, by holding Shift for every additional connection.
Construct new curves using extracted data from existing geometry
The strength of grasshopper is the possibility to analyse your geometry and extract data from it which can be used for making new geometry. This is why we find in the curves and surfaces tabs an analysis section. With these tools you can extract for example points, curves, edges and surfaces from existing geometry and use to build new geometry. In the case of the curves we have an additional option called divisions. These options are often used to extract points from curves to build new curves. For this course it is enough to know that using the point generated by the division component can be a good basis for generating a new curve which easily can be altered.
- Curve is generated in Rhino.
- The curve is attached to a curve parameter in Grasshopper
- The curve is divided generating a set of points. Curve - Division - Divide curve
- A point is selected from the list of points with Sets - List - List Item
- This point is moved - Transform - Euclidean - Move
- This modified point is integrated back in the list of all the points - Sets - List - Replace Item
- The curve is generated with the new location of the point - Curve - Spline - Interpolate