Tutorial 3 - Populate Surface
A strong feature of Grasshopper is it's ability to populate surfaces. In this tutorial we will populate a double curved surface with structural triangles. At first we will start making the component, which we will then use to populate the surface.
Before we start building the grasshopper model we should determine some of its basic properties. In the introduction we already stated that we want to populate a double curved surface with structural triangles. But to study different results we need to have different input. Therefor we need to determine some variables/parameters that will influence the different results.
These variables/parameters could include:
- number of triangles in both directions
- specific shape variations (round corners, etc.)
In this tutorial we will try to keep it simple, so we skip the complicating variables (for now).
Building the grasshopper model
Step 1 - Starting the grasshopper model
First of all we need to define the triangles. We do this by creating two triangles on a base surface. So first of all we need this surface. We could use a surface created within Grasshopper, but as this surface is just temporary we use a surface created in Rhino instead.
The size of the surface does not matter that much, but it is easiest to make it more or less the estimated size of the final triangles that will make the surface.
Now we start using Grasshopper. In Grasshopper we open a Surface to be able to link to the surface we created in Rhino.
We need to set the surface.
We want to create triangles between the corners of the surface. Therefore we need the data of the corners. We get this data by decomposing the surface.
By connecting the Surface with the BRep Components we get to see the preview of the surface with its corner points.
Hovering over the V of the BRep Components shows us the list containing the coordinates of the four corner points.
We need to split the data of the corner points so we can use them individually. To do this we need a List Item.
Connect the data of the BRep Components with the L input of the List Item. We need the four corner points, so we need four List Items. We can just copy and paste the first List Item.
For the four List Items we need to set which item from the list we want. By default it is set to 0, which responds to the first item of the list. For the second, third and fourth List Item we need to change this to respectively 1, 2 and 3.
To create the triangles we will use the Poly Line option.
We connect three of the List Items with the Poly Line to create one of the triangles (after connecting the first, we connect the second and third by holding down the shift key).
To make sure it's a proper triangle we need to take care of the order of connecting the List Items. There is a difference when you pick the points clockwise (negative direction) or counterclockwise (positive direction).
Pick the points clockwise. Later we will explain why.
It might be useful to also visually change the order of the List Items in the Grasshopper window. To close the triangle we need to close the Poly Line.
Our Grasshopper model should now look something like this.
Step 2 - Shaping up the triangles
The triangles are only curves so far, so we want to give them some thickness. First of all we are going to offset the curves.
The Offset will need a distance, so it would be nice to be able to change this distance easily. Especially because we don't know exactly how big everything will be in the end. To change the Offset distance we use a Number Slider.
The triangles are going to populate a double curved surface. Thus the plane on which the triangles are positioned should be different for every triangle. To achieve this we have to determine the positioning of the plane.
Create a plane through three points. Use the right hand rule. Your thumb is the Z-axis, make sure it points upwards, your index finger the X-axis and your other fingers is the Y-axis.
For each triangle we use a Plane 3Pt and an Offset. The distance for the offset is the same for both triangles so we use one Number slider that connects to both Offsets. For the Plane 3Pt we use the three corner points of the triangle and use its output to determine the direction of the Offset. With the Plane 3Pt we need to take care with the order of the input, because it influences the direction of the offset.
As you remember you made the triangles with a closed polyline in clockwise (negative) direction on a global coordinate system with Z-axis up. With Plane 3Pt you created a local coordinate system with Z-axis up.
With this knowledge a positive offset on a postive closed lines would be in outer direction. And a positive offset on a negative closed lines would be in inner direction.
We will use a planar surface to actually create the face of the triangle.
We want to make a planar surface between the original triangle curve and the offset curve, therefore we connect both to the Planar Srf.
There is only one problem. Instead of making one surface between the two curves, it makes two surfaces. This has to do with the data streams (more on data streams later). Grasshopper data works in a very hierarchical way and if components are not in the same hierarchy-layer they will not work together.
By flattening the data we more or less flatten the hierarchy. This makes sure the components are in the same hierarchy-layer and therefore they can work together.
Now the triangles are how we want them. The component to populate the surface with is now ready.
Step 3 - Populating the surface
Now all we need is a Surface to populate the triangles onto. We can do this in many different ways, but in this example we start with drawing three curves in Rhino.
In Grasshopper we create a Curve component.
We link the curves we drew in Rhino to the Grasshopper Curve component.
We are going to create a lofted surface through the curves.
We connect the curves to the Loft component.
Next step is to divide the surface we created by doing an Isotrim.
Isotrim needs input values with the actual number of divisions. An easy way to achieve that is to use Divide Domain2.
The Grasshopper model of the divide surface is complemented with two sliders to control the subdivisions.
The surface now looks more or less like this.
The interesting part is the output of the Isotrim component. If we look closely we see that its a list of surfaces.
Our original triangles had a surface as input, so all we have to do is connect the output of the Isotrim with the input of the triangle and it will populate the surface with the triangles. The sliders give us the opportunity to adjust some variables and therefore study several design alternatives. Changing the input curves of the surface also gives us this opportunity.
If your result is looking like the image at the right, don't think you did anything wrong immediately. The messy grey geometry you see are the planes generated by the plane3pt component. You can change the size of the planes by going to the display tap of grasshopper in the top. Then click on the plane radius button and change it to a lower value till it looks fine. You can also just turn the planes off by right clicking on the plane3pt components and unclick preview.