Saturday 14 February 2009

Rhino goes Parametric with Grasshopper

It has been some time since we posted, as it has been busy at RhinoCentre. More and more people are finding their way to our excellence network, be it for advice, training, constructional drawings or high end visualizations. But luckily we did find some time to dive into Grasshopper. Grasshopper enables you to create flexible parametric designs with Rhino. This means that you can easily adapt your design based on important design parameters and constraints. This article demonstrates how Grasshopper can be applied to the design of a (simple) cabinet.

Watch the cabinet introduction video
Watch the cabinet culling video
Watch the cabinet shifting video

I think that even in its current state, Grasshopper has a lot to offer and shows a lot of potential. I hope this simple example will stimulate you to give Grasshopper a try.

Download Grasshopper for Rhino
Download the Grasshopper cabinet example file.

Since the development of Grasshopper has started, it has created a lot of buzz, especially in the architectural world. There haven't been many examples yet though of what Grasshopper can do in other disciplines. The following example shows a cabinet that has been made completely parametric with the use of Grasshopper. The width, depth and height and other features of the cabinet can be changed with the sliders on the remote control panel (for new users of Grasshopper: this is the panel that appears when enabling Remote Control Panel in the view menu)

The amount of shelves can be changed as well. The cabinet has 1 or 2 doors. The decision whether it needs 1 or two doors is made automatically, based on the size of the cabinet. In this case, when the cabinet is less wide than 600 units (the file assumes you are working in mm) only one door will be generated, when the cabinet is wider, two doors are generated.
This is done with the cull component. Based on a comparison, the cull component can decide to generate or not generate geometry. In order to do this, it accepts a true or a false. To generate this true or false, you have to make a condition. In programming languages this often looks (similar) like:

if (condition) then
do something
end if

and more particularly, to generate a boolean (true/false), it could look like this:

if (condition) then
end if

in Grasshopper, however, you can achieve the same result with a function component with a single variable. This one can be found under the scalar tab, expressions
In the cabinet example, this is done by connecting the width of the cabinet to the x of the function. The function is simple. For the cull component that needs to generate a single door, the function reads x<600
For the cull component that needs to generate 2 doors, the function reads x>600
In the following two images, you see the above in action:

The construction for the shelves is a bit more difficult. In order to get the shelves perfectly spaced over the available inner height, a curve is generated and divided. Since the shelves are positioned at these division points with their lower corner, I made sure that the line that is being divided starts at 1 shelf thickness below the top of the bottom side of the cabinet.

Now if we would place the shelves at the division points of the curve, we would end up with 2 more shelves than needed: this is because dividing a curve also generates points at the start and end of the line. There are several methods to get rid of these shelves. Here I used the shift component twice. So the list of points is first shifted downward, then shifted upward. The booleans for wrapping the list while shifting are set to false. Therefore, the outer points will be erased from the list. Exactly what we want.

about Grasshopper
Grasshopper is a plugin for Rhinoceros Nurbs Modeling for Windows. It is being developed by Robert McNeel and Associates. The brain behind Grasshopper is Dutch urban architect and programmer David Rutten.