Tutorial 3 - Populate Surface

From TOI-Pedia


Introduction

The Result of this tutorial

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.

The Design

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
  • open/closed
  • specific shape variations (round corners, etc.)
  • 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

Create a surface

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.

Surface » Plane » Corner To Corner

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.

Create the surface in Grasshopper

Now we start using Grasshopper. In Grasshopper we open a Surface to be able to link to the surface we created in Rhino.

Params » Geometry » Surface


Set the surface created in Rhino

We need to set the surface.

RMB on the surface » select “Set one Surface” and click on the surface we created in Rhino


Decompose the surface into its components

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.

Surface » Analysis » BRep Components


Connect the two together

By connecting the Surface with the BRep Components we get to see the preview of the surface with its corner points.


The list containing the data of the corner points

Hovering over the V of the BRep Components shows us the list containing the coordinates of the four corner points.


Retrieve a specific item from the list

We need to split the data of the corner points so we can use them individually. To do this we need a List Item. Sets » List » List Item


Connecting the data with the 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.



Connecting the data with the 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.

RMB on the i in the List Item » select “Set Integer” and set to respectively 1, 2 and 3


Creating the Polyline

To create the triangles we will use the Poly Line option.

Curve » Spline » Poly Line



Connecting the Polyline

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.

RMB on the C in the Poly Line » select “Set Boolean” and set to True


Model with the created triangles

Our Grasshopper model should now look something like this.


Step 2 - Shaping up the triangles

Offset 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.

Curve » Util » Offset


Number Slider for the distance

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.

Params » Input » Number Slider


Three point plane to determine the position of the triangle
Right hand rule

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.

Vector » Plane » Plane 3Pt


The actual offset of the triangles

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.


Planar surface

We will use a planar surface to actually create the face of the triangle.

Surface » Freeform » Planar Srf



Connecting the triangles to the Planar Srf

We want to make a planar surface between the original triangle curve and the offset curve, therefore we connect both to the Planar Srf.



Problem with 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.



Flattening the data

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.

RMB on the E of the Planar Srf » click on “Flatten”



Flattening the data

Now the triangles are how we want them. The component to populate the surface with is now ready.


Step 3 - Populating the surface

Curves to create a 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. Curve » Free-Form » Interpolate Points


Curve component

In Grasshopper we create a Curve component.


Params » Geometry » Curve


Linking the Rhino curves to the Curve component

We link the curves we drew in Rhino to the Grasshopper Curve component.

RMB on the Curve » click on “Set Multiple Curves” and select the curves top to bottom


Loft component

We are going to create a lofted surface through the curves.

Surface » Freeform » Loft


Connecting the curves to the Loft

We connect the curves to the Loft component.


Creating an Isotrim

Next step is to divide the surface we created by doing an Isotrim.

Surface » Util » Isotrim


Adding a Divide Domain2

Isotrim needs input values with the actual number of divisions. An easy way to achieve that is to use Divide Domain2.

Math » Domain » Divide Domain2


The finished divided surface

The Grasshopper model of the divide surface is complemented with two sliders to control the subdivisions.


The finished divided surface

The surface now looks more or less like this.


The finished divided surface

The interesting part is the output of the Isotrim component. If we look closely we see that its a list of surfaces.


The finished divided surface

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.


Plane chaos

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.


Plane radius reduced
Personal tools
Actions
Navigation
Tools