Tutorial 1 - Rotating Tower
One of the main uses of Grasshopper is to build simple parametric models. In this tutorial we start by exploring these possibilities by dealing with some of the basic operations. To show this we will make a simple parametric tower. To work with complex objects, a design process usually starts from a very simple first level and then other layers are added; complex forms are comprised of different hierarchies, each associated with its own logic and details. These levels are also interconnected and their members affect each other and in that sense this method called ‘Associative’. So let us start by describing the towers basic properties.
Before we start building the grasshopper model we should determine some of its basic properties. The design we want to achieve is a tall tower with a bottom and top profile. The precise shape of the profiles is not fixed and alternatives need to be explored. Furthermore we are aiming at a minimal total floor area of 35.000 m2.
Other properties include:
- radius of the bottom shape
- radius of the top shape
Building the grasshopper model
Step 1 - Starting the grasshopper model
Now that we have defined the input we can determine what components we need to build the model. As mentioned before, the process of making a complex model usually starts from a very simple level. In this particular design we will start by making a line which will act as the core of the building. Any line is constructed by connecting two points. Therefore we start by creating the two points; one at the origin and one moved in the Z-direction controlled by the height property.
We leave the input to its default 0,0,0 thereby creating a point in the origin of the model.
Next we want to create the second point.
Again we start by creating a point, but now we are going to control the Z value by the use of a slider.
And now the slider
We want to change the setting of the slider so that it conforms to our use. For each slider one can set the type of numbers, lower and upper limits and its default value.
Set the lower limit value to 3.000 (the minimum height is 3 meter)
Set the upper limit value to 300.000 (the maximum height)
Now it is a good habit to give your slider an appropriate name
We can connect the number slider to the Z input of the point.
Drag the output of the slider to the Z input of the second point.
Using the two points we can create the line connecting them. First we create the line, then we connection the two points to input A and B of the line.
Drag the output of the first point to the A input of the Line
Drag the output of the second point to the B input of the Line
The result of these first steps are visible in the perspective window in Rhino. You should see a line in the Z direction. Changing the “buildingHeights” sliders value should change the height of the line.
For the bottom and the top shapes we choose to use a polygon as base. We will use the two points created earlier as the basepoints of the shapes. For the polygon we need to specify the number of sides and the outer radius. Both these values are driven by the design and the designer and are controlled by sliders.
Create the first and second polygon
The polygon has 4 inputs:
- P – The baseplane or point for the polygon
- R – The outer radius of the polygon
- S – The number of sides of the polygon
- Rf – The radius of the optional rounded corners
Create the slider for the radius
We want to change the setting of the slider so that it conforms to our use. There is a minimum and a maximum radius.
RMB on the slider > edit
Set the lower limit value to 5.000 (the minimum radius is 5 meter)
Set the upper limit value to 25.000 (the maximum radius is 25 meter)
Rename the slider
RMB on the slider > first item in the popupmenu controls the name. Set it to “outerRadius”
Next create the second slider for the number of sides. This slider requires for an important setting as the number of sides can only be a whole number, a so called “integer”
Create the slider for the number of sides
We want to change the setting of the slider so that it conforms to our use. There is a minimum and a maximum number of sides and, most important, a type of values available.
RMB on the slider > edit
Set the rounding to Integer
Set the lower limit value to 3 (less that 3 sides create a line and has no area)
Set the upper limit value to 10 (the maximum number of sides)
Rename the slider
RMB on the slider > first item in the popupmenu controls the name. Set it to “numberOfSides”
Now connect the output of the sliders to the polygons. It is important to notice that one slider can control multiple objects, making it easier to control complex models.
Drag the output of the “outerRadius”t to the R input of both the Polygons
Drag the output of the “numberOfSides” to the S input of both the Polygons
Both polygons are now created in the origin of the model. As mentioned before we will use the 2 points created before as input.
Drag the output of the first point to the P input of the first polygon
Drag the output of the second point to the P input of the second polygon
Lets review what we have constructed until now. We should have 2 polygons; one at the bottom of the line and one at the top of the line. Check whether changing the numberOfSides and the outerRadius changes the two polygons accordingly.
Step 3 – Adding Rotation
The effect of the rotated tower is controlled bij the rotation of the top shape. To enable this we need a rotate option and a slider to control this rotation.
First we create the rotate option and connect the top shape output to the rotate
Drag the output P of the top shape to the input G of the rotate
Now we need to define the angle of rotation. For this particular design we want to be able to rotate the top between 0 and 180 degrees. So we create a slider with floating point numbers as option and connect this to the rotate.
We want to change the setting of the slider so that it conforms to our use. There is a minimum and a maximum number degrees to rotate.
RMB on the slider > edit
Set the lower limit value to 0.0000 (0 equals no rotation)
Set the upper limit value to 180.0000 (the maximum rotation)
Connect the output of the slider to the input A of the rotate.
Now let review what we have done in the viewport of rhino and check if the grasshopper definition works. The first thing you might notice is that there are actually two top polygon shapes (if you don’t see two you need to increase the rotation). The reason why this happens is that the rotate option actually takes the geometry, copies and rotates it according the specified angle. Because grasshopper definitions work as a downward stream of data this is the only way to do this. We can solve this quite easily by hiding the original polygon.
RMB on the second polygon > toggle preview
The second polygon will be hidden and the rotated copy will remain visible. Also notice the Polygon Icon turning into a darker grey color.
The second issue that we have to deal with is the rotation. Given the minimum and maximum values that we have set for the slider we can expect the top polygon to rotate 180 degrees. If we check this in the model we can see that the object actually rotates a lot more than 180 degrees. Further inspection shows that the input A of the rotate expects a rotation in Radians instead of Degrees (hover with your cursor above the A shows this popup).
So we need to convert degrees to radians. For these kind of calculations we can use a function block. Function blocks a especially useful for creating more complex mathematical calculations.
We choose F1 because we have only one value to use in our calculation.
We start by connecting the output of our degree slider to the input x of the function.
Connect output of the slider to the input X of the function
Next we need to set the function: what needs to happen with the input. The function block comes with a separate editor which has numerous mathematical functions to choose from. Besides the ones visible in the toolbars there is also a “Expression function list” which shows the complete list of available functions. In this list we can find the “Rad(x)” function which converts the value X (in degrees) to radians. Close this list.
Type Rad(x) in the Expression input field.
Now we need to connect the output of the function to the input A of the rotate.
Connect the output of the function to the input A of the rotate.
We can check whether this works by reviewing the output of the function block and comparing this to the specified number of degrees in the slider. Checking you output is a useful habit and makes searching for errors a lot easier. The common practice is to use a Panel. A panel is basically a text-like field that displays the input.
Connect the output of the function to the input of the panel
In our example the degree slider is set to 45 degrees. If we convert this to radians (multiply the degrees times pi/180) we expect a value of 0.785 so it works!
Now that we have both bottom and top profile set we can connect them to make the outer surface of the tower. For this we use the loft component. The loft connects the curves in the order they are connected and forms a surface that runs through these curves. Therefore they can be considers sections through the surface. It is important to notice that we want to connect multiple sources (curves) to one input (the input of the loft. To accomplish these we can hold the “shift” key to connect more than one object to an input.
Connect the bottom polygon output to the S input of the loft
Connect the top polygon output to the S input of the loft WHILE HOLDING THE SHIFT KEY
Now we can review the overall shape of the tower in the Rhino perspective view. Try changing some of the slider input to see the impact on the model.
Step 4 – Creating the floors
In the beginning of this design some requirement were set. One of those requirements is the minimal needed floor area in the building. To calculate this we first need to model these floors. Again, before we start the modelling, we need to define what kind of input and output we need. The output is composed of two parts; first we want to see the floor slabs in our model and second we want the total amount of square meters. The input is relatively simple; we need to specify the number of floors and we need to specify the thickness of the slabs. There are two methods to specify the number of floor; by defining a number or by defining the floor height for each floor. In our design we choose the second option because we are looking for an usable design.
Furthermore we are reusing a component that we have build in the beginning: the core-line. This will act as the main driver for the division of the floors. Grasshopper has the option to position points along a curve. We are using these points as the input for the positioning of our floors. The input will be a slider defining the height of the floors. To make life easier we first will temporarily hide the outer surface of the tower created earlier.
RMB on the Loft > Toggle Preview
Again we want to change the setting of the slider so that it conforms to our use. There is a minimum and a maximum height.
RMB on the slider > edit
Set the lower limit value to 2.8000 (minimum 2.8 meters)
Set the upper limit value to 6.0000 (maximum 6 meters)
Rename to floorHeight
Now we can create the curve division and connect these. Please take notice of the other division types.
Connect the output of floorHeight to the input D of the division
Connect the output of the line to the input C of the division
We can check the output in our Rhino Model view. You will see a series of points along the line.
Because the shape of the tower is not known at the beginning of the process (we can rotate the top shape and change the number of sides of the tower) we need to create the floors based on the outer shape of the tower. To create the needed outer curve an intersection at each floor with the outer surface needs to be made. The intersection is made between a (virtual) plane and the outer surface. The plane uses the points on curve as center point.
Connect the output P of the Divide Distance to the Input O of the XY Plane.
Notice that for each point a plane is created. This is actually one of the more powerfull features of Grasshopper: Because the Divide Distance creates multiple points, the XY Plane treats each point as a centerpoint for a new plane, thereby making it easy to define one action for multiple objects.
Using the plane the intersection with the outer surface (also called a “BRep”) can be made.
Connect the output P of the XY Plane to the P input of the Intersect
Connect the output L of the previously created loft to the B input of the Intersect
The curves define the outer boundary of the floors. Using a plane command the floor surface can be created.
Connect the output C of the intersect to the input E of the Planar Srf
With the surface for each floor created the area can be calculated using the Area component. A panel is created to review the result
Connect the output S of the Planar Srf to the input B of the Brep Area
Connect the output A of the Brep Area to the input of the panel
In the panel window the output of the Area component is visible. Notice that it treats each floor as an individual element and therefore calculates the area for each floor.
To calculate the total floor area all the individual floor areas need to be added. This can be accomplished with the use of the Mass Addition. This will be placed between the Brep Area and the Panel. For the Mass Addition the list of individual floor areas needs to be treated as one. This is done using the flatten command.
Connect the output A of the Brep Area to the Input D of the Flatten Tree
Create a panel and connect to the output of the Flatten Tree
The difference is in the way Grasshopper treats the values in a list. In the first (not flattened) list each value is a separate object (also called a separate branch), in the flattened list it is one object with multiple values.
Connect the output D of the Flatten Tree to the input I of the Mass Addition
Connect the output R (the result) to the input of one of the panels
Delete the other Panel
The value in the panel is the total area of all the floors combined. In this example the total area is appr. 29100 square meters. There are several options to influence this value:
- Change the buildingHeight > a higher building can contain more floors, hence more floor area
- Change the outerRadius > larger floors
- Change the floorHeight > more or less floors
- Change the rotation > although the influence is minimal
- Change the number of Sides > also minimal influence
So you could image the number of different alternatives you could create all with around 35000 square meters.
The last step is creating the thickness of the floors. To accomplish this the surface is extruded to the specified thickness. A slider will be used as input for the extrude. The extrude need a direction. In this case the Z-direction will be used.
Again we want to change the setting of the slider so that it conforms to our use. There is a minimum and a maximum thickness.
RMB on the slider > edit
Set the lower limit value to 0.1000 (minimum 0.1 meters)
Set the upper limit value to 0.5000 (maximum 0.5 meters)
Rename to floorThickness
Create the direction Z and connect the slider to the direction. The slider will act as an multiplier on the direction, which has a default value of 1.
version 0.7.XXX or later:
Connect the output of the floorThickness to the input F of unit Z
Next create the extrude component
Connect the output S of the planarSrf to the input B of the extrude
Connect the output V of the UnitZ to the input D of the extrude
This is the end of this tutorial. The resulting Grasshopper Definition allows the designer to generate alternatives using the various inputs defined in this tutorial.