Expected Time: 45 min
Using Grasshopper as a parametric design tool gives us the ability to study different design solutions. In this tutorial we will create a Grasshopper model that gives us the ability to study the openings in a curved roof. By changing the a slider the size of the openings either decreases or increases.
Before we start building the grasshopper model we should determine some of its basic properties. We will start with a single curved surface in Rhino, which represents our roof. Our roof needs several openings to let light through. The openings are created by raising the middle of a line straight up creating a arc from one side to the other through this raised point. The aspects we want to study are how many openings we should have and how large they should be.
So our variables/parameters are:
- number of openings
- height at the middle of the openings
Step 1 - Preparing the Rhino scene
First of all we need to define our roof in Rhino. We do this by creating a curve and extruding it to get our surface.
- Create a curve in Rhino
It is probably easiest to draw the curve in “Right”-view.
Now we will extrude this surface in a straight line.
- Extrude the curve
It's probably easiest to extrude the curve in “Front”-view.
Our surface should look something like this. This will be our starting point for the Grasshopper model.
Step 2 - Starting the Grasshopper model
First we have to define the surface we created in Rhino. Therefore we create a Surface parameter.
- Create a Surface parameter
Now we have the Surface component we can connect our Rhino surface.
- Set one surface on the Surface parameter
Now we need to deconstruct the surface in faces, edges and corners. There are several ways to divide a surface, but in this case using the Deconstruct Brep would be a good solution.
- Connect a Deconstruct Brep to the surface
As you can see, the Deconstruct Brep component outputs three items: the surface face, edges and vertices.
The surface has four edges and we only need to use two of them. So we somehow need to identify those two edges. If we hover with our mouse over the E of the Brep Components it shows us that the output is a list of four curves. With the function List Item, we can specify specific items in a list. We need to identify two edges, so we make two List Items. Note that computers start to count with zero, so the edges are 0, 1, 2 and 3.
- Retrieve specific edges by using the List Item component
Without setting a specific index, the List Item component will retrieve the first item of the list, which is index 0. By zooming in on the component, you will see that several plus icons will appear. By clicking twice on the lowest plus, we will also get the second item (index 1) and the third item (index 2) of the list.
- Add two item to the List Item output
Now that we have the two edges identified, we can divide them.
- Divide the edges using the Divide Curve component
As we want to set the number of divisions for the curve, we create a Number Slider to control this.
- Add a number slider to the count
The next step is that we need lines from the division points on one side to the division points on the other side.
- Connect the points with a line
The only problem is we don't get the result we wanted. The lines are linked in a crossing pattern.
We need to reverse one of the lists of division points.
- Reverse on of the point lists
Now the curves are correct.
Step 3 - Creating the second set of curves
We want to get the middle of the lines so we use the Middle Curve node.
- Get the middle of the line
Now that we have identified the middle, we want to be able to move it in the Z-direction to create the openings in the roof. Add a move component with a Z unit-vector to move the middle points up.
- Move the middle points up
- Add a Z unit-vector to the direction
- Add a Number Slider to control the size of our openings
Now that we have the raised midpoint of the curves, we can create arcs going from one side through the raised midpoint to the other side.
- Add an 3pt Arc to the canvas
- For point A: use the original division points of the first curve;
- For point B: use the moved middle points of the created lines;
- For point C: use the reversed list of the division points of the second curve.
We now have an arc between above every created line on the surface.
Step 4 - Creating the surfaces
We now have two sets of curves, and we want to create a loft from the first arc to the second straight line. We could do this in several ways, but in this tutorial we will clean the list of curves by removing the curves we don't need. This means we will delete the first straight curve and the last arc.
- Add a cull component to the created Arcs and the lines that divide the surface
We need to specify which items from the list we want to delete. Removing the first item of a list isn't very complicated, because we know the first item always has the index number 0.
- Remove the first Arc
Removing the last item from a list can be done by entering the number -1. Grasshopper will know that you want to remove the last item from the list.
- Remove the last line
We now have the right items in the two lists, but if we try to loft the outputs of the two lists it won't give us the desired result. It just makes one loft going through all the arcs and one loft going through all the straight lines. This happens because the two lists are structured in a way that Grasshopper combines all the items in one list to make the loft instead of combining one value of the first list with one value of the second list.
If we look at the data in the list by using a panel, we can clearly see different structures in both lists. Pay special attention to the darker yellow lines. We can see different numbers of zeros between the accolades. To be able to combine two lists, we need to get this structure identical in both lists.
We have to somehow tell Grasshopper to divide the lists in separate items, so it will loft them one by one.
- Graft both lists
We can now use these lists as input for the loft component.
- Loft the lines with the Arc by connecting both of them to the Curves input of the loft component
Notice the dashed lines which indicate the connection between the loft and graft components. A dashed line indicates a grafted list.
- Add a surface component for good practice.
You just finished your roof!