Parametrize a Rhino model using Grasshopper

From TOI-Pedia

Introduction

Loading the player...



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.

Basics: Vectors

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:

Addition
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): Vector addition.png
Subtraction
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.
Multiplication
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

Example of a GH Definition performaing a Boolean Difference on existing Rhino Solids

Use the Params » Geometry » Brep component 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.


Intersect » Shape » Solid Difference is used for Solide Difference Booleans. Union and Intersect are also available.


The Difference component has two inputs:

A
Solids to subtract from
B
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 Transform » Euclidian » Move component on the Geometry input. On the Translate Vector input, we've connected a Vector » Vector » Unit X 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 Params » Input » Panel component.

Grasshopper shows geometry for each component that works with geometry, resulting in multiple objects that are visible. This clutters your 3D model, so it's recommended to turn of Preview (Solution » Preview Selected Off or any of the other shortcuts}} for these components. In the example, turn Preview off for both Brep components and the Solid Difference 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

Solid primitives in the Grasshopper Primitives menu

The Surface » Primitive section 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 Vector » Plane. 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.


Example of a Boolean Difference on two boxes that are created in grasshopper

This example creates two boxes using the Surface » Primitive » Center Box component. Input Base Plane is used to specify the construction plane for this box. We've connected a Vector » Plane » XY Plane.


The Origin of this plane is set using a Vector » Point » Construct Point 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 Params » Input » Number Slider 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.

Extrude

Example of an extrude based on a curve in Rhino

The example use the Params » Geometry » Curve component to use an existing curve in Rhino.


The Surface » Freeform » Extrude 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 Vector » Vector » Vector XYZ component to create a vector, which is fed into a Vector » Vector » Amplitude 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 Vector » Vector » Unit X/Y/Z components to create a fixed vector that you rotate (Vector » Vector » Rotate) around an axis by a set amount of radians or degrees.


Loft

example of moveing existing curves before lofting them

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 the Transform » Euclidian » Move or Transform » Euclidian » Rotate components. The move component uses vectors to specify the direction and distance.


The first curve is moved in the Z-direction by using a Vector » Vector » Unit Z 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 the Vector » Vector » Rotate component. 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 Surface » Freeform » Loft 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.


Combining multiple inputs may be tricky in more complicated definitions. The Tree structure of the connections determines which curves will be lofted together. Refer to Data Trees in Grasshopper Components for more information on Data Trees.


Construct new curves using extracted data from existing geometry

Example of a new curve being constructed and adjusted

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.


Example:

  • 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
Personal tools
Actions
Navigation
Tools