# Introduction

In this tutorial we will look at how to generate a spaceframe. Although the beginning is quite straight forward , the difficulty arises when the top frame has to be defined. It tackles a typical problem with Grasshopper , the list and tree editing. Due to the fact that Grasshopper doesn't store object names but defines the geometry in an indexed list makes the selection of objects sometimes quite arduous.

## The Design

Space frame

Before we start building the grasshopper model we should determine some of its basic properties. We will start with a one curved surface in Rhino, which represents our roof. Our roof will be divided in a grid of sub surfaces, forming the basis of the bottom grid of the space frame. This sub surface will dictate the width and length of the grid elements and will help to define the nodes of the upper grid of the space frame. By generating line information from the sub surfaces and the elevated centre point of the top part of the space frame

So our variables/parameters are:

• the length and width of our bottom grid
• height of the spaceframe
• the thickness of the frame elements.

# Building the grasshopper model

## Step 1 - Preparing the Rhino scene

Drawing a curved line

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.

Curve » Free-Form » Interpolate Points

Our curve

It's probably easiest to draw the curve in “Right”-view.

Extrude curve

Now we will extrude this surface in a straight line.

Surface » Extrude Curve » Straight

Extrude curve in Front-view

It's probably easiest to extrude the curve in “Front”-view.

Our roof surface

Our surface should look something like this. This will be our starting point for the Grasshopper model.

## Step 2 - Starting the Grasshopper model

Create a Surface component

First we have to define the surface we created in Rhino. Therefor we create a Surface component.

Params » Geometry » Surface

Connect the Surface component to the Rhino surface

Now we have the Surface component we can connect our Rhino surface.

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

Isotrim

We need to divide the surface. There are several ways to divide a surface, but in this case dividing the surface in sub surfaces is the option to choose. Surface » Utility » Isotrim

Connecting the Isotrim Components

Now we connect the output of the Surface component with the input of the Isotrim. However as we can see we need additional information on how to divide the surface in a grid of sub surfaces.

Domain

With the Isotrim option we can define a part of a surface. This will mean that we have to define a two dimensional area on the surface. A segment in the U direction and a segment in the V direction. To do this we have to define between which coordinates in the U direction to define the surface in the U direction and the same in the V direction. Defining an area like this can be done with a domain.

Domain surface

If we want to define a sub surface (a part of the surface) we can use the Math-Domain-Domain2 component to define the U and V range of the sub surface. By linking a set of sliders to the input of the Domain2 component the sub surface can be adjusted in location and size of the sub surface.We double-click on the number slider to change it's properties and set the rounding to integers.

Math » Domain » Domain2

Click right

In some cases it can be that the parameterazation of the surface is giving an indication of the length and width of the surface. This can be a maximum value larger than 1. When the curve is reparameterized the U and V value will be evenly distributed from 0 to 1. This enables you to define an area on a relative position on the surface.

Select S input of Isotrim component » RightClick

Domain

We have defined a single sub surface on our roof. In our case however we need a grid of sub surfaces covering the whole surface of the roof. In essence we need to define a set of domains in the U and V direction. There is a simple option for this. We select the domain option in Math - Domain - Domain. This domain option defines the domain in 1 direction , the U or V direction. We use two sliders to define the domain of 0 to 1. We double-click on the number slider to change it's properties and set the rounding to integers. We name the Domain component Domain U. We copy the set and name that component Domain V

Math » Domain » Domain

Domain divide

If we define the domain in U direction from 0 to 1 ( covering the whole length of the surface and a domain in the V direction from 0 to 1 ( covering the whole width of the surface ) we defined the whole surface as a single sub surface. Because we want to divide the whole surface in a grind of sub surfaces , like a tilled floor, we divide the domains in the U and V direction to equal parts. again we use for the division a numberslider. We double-click on the number slider to change it's properties and set the rounding to integers.

Math » Domain » Divide Domain

Divide Domain

At this moment there are two 1 dimensional domains defined. They define the domain in the U direction and in the V direction. They have to be combined to a 2 dimensional domain. This is necessary to define the 2 dimensional sub surfaces. To do this we use the Math-Domain-Domain2 but now we use the component which generates a 2d domain from two 1d domains.

Math » Domain » Domain2

Subframes

When we connect them, and connect the 2D domain to the Isotrim we can see the subframes on the surface. This is however not a correct solution. The subframes are stacked diagonally and don't cover the whole surface. The reason of the problem is the way the U and V domain segments are combined. We have three options which you can select if you right click on the Domain2D component. The first is shortest list , the second longest list and the third the cross reference.

Cross reference

We select the Cross reference option in the Domain 2D component. The result is that the whole surface is filled with the sub surfaces.

Select Domain 2D » Right click » Cross reference

## Step 3 - Generating the bottom en middle grid

Brep Components

We have now the basis for the generating a space frame. We can use the data of the subframes as basis for the tubes which will make up the frame. If we use the option Surface-Analysis-Brep component we can extract the corner points , the edges and the faces from the sub frames. The points and edges we can use as a basis for the tubes of the grid.

Surface » Analysis » Brep components

Making the edges straight

If we use the edges of the sub surfaces they will follow the curvature of the surface. If we want to have straight tubes along the edges we have to simplify the edges to a straight line. This can be done by selecting the option Curve-Utilities-Simplify Curve. If the tolerance input (t) of the component is set to 1 the curves will change from curved to straight.

Curve » Utility » Simplify Curve

Creating the tubes

Now we have a list of curves which are straight and will form the basis of the bottom grid. This can be easily be done by using the curves for generating a pipe. Select Surface- Freeform - Pipe and connect the curve output of the Simplify Curve option to the Curve input of the Pipe. A slider can be used to define the diameter of the pipe.

Surface » Freeform » Pipe

Finding the centre points

The bottom grid is made. Now we need the top grid and the connecting pipes between the bottom and top grid. To define the top grid we need a point perpendicular to the centre of each sub surface. We can extract the centre of each sub surface with the help of the Surface-Analysis-Evaluate Surface. This option allows us to define a point on a surface by its U and V coordinates.

Surface » Analysis » Evaluate Surface

Re parametrize

The middle points can be defined by a U and V coordinate of every sub surface. If we want to select the middle we have to define the middle as U = 0.5 , V = 0.5 and W = 0.0 coordinate of every sub surface. For this to work we have to do two things.

• We have to re parametrize the sub surfaces so they will have the length and width of 1.
• Input the coordinates.

Select the Evaluate Surface component » Right Click on the S input » Select re parametrize

Panel

We can use a Parameter-Special-Panel to define the U and V coordinates. Couple the Panel to uv Input of the Evaluate Surface component. Type in the panel {0.5,0.5,0.0} These are the UVW coordinates of the middle point. The points are now defined at the centre of each sub surface.

Parameters » Special » Panel

Move

These points for the basis for the upper grid. Because the points are still placed on the same plane as bottom grid they have to moved perpendicular to the subsurface. The Evaluate Surface component can be used for this. It not only provides us with the centre points but also with the normal at that point and a frame. The Normal is a vector pointing perpendicular outward of the surface. A Normal has always the length of 1. There is now enough information for the move option to work. We select Transform-Euclidean-Move and connect the point information to the geometry input and the Normal out put of the Evaluate Surface component to the Translation vector input of the move component. The points move now 1 unit perpendicular to the sub surfaces.

Transform » Euclidean transform » Move

Move the points in the correct hight and direction

The points will move in the direction of the Normal. In this case down. Further can it be useful to have control on how high the top grid will be positioned above the bottom grid. For these options we can use Vector-Vector-Amplitude component. We connect the Normal output to the V input of the Amplitude component. For changing the hight of the points we can couple a slider to the A input of the Amplitude component. If the points are at the wrong side of the surface use a negative value to move them to the top side of the sub surfaces.

Vector » Vector » Amplitude

Lines for the connection of the top grid

We have now two sets of points. The corner points of each subsurface and the points of our top grid. This is enough information to generate a line. Select Curve-Primitive-Line and connect the V output of the Brep components and the G output of the translate component with the Line component.

Curve » Primitive » Line

Tubes

Convert the lines in tubes by using Surface-Freeform-Pipe. To generate a uniform frame you can use the slider for the radius of the bottom frame also for these tubes

Surface » Freeform » Pipe

## Step 3 - Generating the top grid

Sub List

Now we get to a tricky part of the creation of the grid. The information of the grid consists of a list of points. We have to organize them in such a way that we can select a row of points and generate a polyline between them. We have to generate sub lists. To generate a sub list we select Set-List_Sub List. We connect the geometry output of the Move component to the Base List of the Sub List component. The list has a tree structure which we have to get rid of to make this work so we Flatten the list. This can be done by Right clicking on the Base List input of the Sub list component and select the option of flatten. This will put all the points into one easy accessible form.

Set » List » Sub list

Flatten List

The list has a tree structure which we have to get rid of to make this work so we Flatten the list. This can be done by Right clicking on the Base List input of the Sub list component and select the option of flatten. This will put all the points into one easy accessible form.

Sub list » Right click » Flatten

Domain of the list

From this list we have to make a selection of , in this case , 10 rows of 10 points. This is similar to the generation of the sub surfaces. We can use a domain for this. A domain of 10 points. And 10 domains with each 10 points. We create a domain Math-Domain-Domain and connect the Domain output of the Domain with the domain input of the Sub List

Math » Domain » Domain

Series
Domains

To make the correct Domain segmentation we can use the Set-Sequence-Series option. This option will allow us to define a sequence of numbers for the first (a) input of the Domain and a second series component will define the second (b) input of the Domain.

The input of the first series is

• S - 0 starting point of the row
• N - 10 Next starting point of a row
• C - 10 Amount of rows

The second series

• S - 9 amount of points in the row
• N - 10 next end of row
• C - 10 amount of rows

Connect them to the Domain

Set » Sequence » Series

Polylines

The list is so organized that we have sub lists with 10 sets of points and we have 10 sub lists. If we connect a Curve-Spline-Polyline to the Sub list out put it will generate the correct lines for 1 direction of the top grid.

Curve » Spline » Polyline

Flip matrix

The list is so organized that we have sub lists with 10 sets of points and we have 10 sub lists. If we switch the data from 10 lists to 10 points and vis versa with the Set-Tree-Flip matrix option the lists are reorganized. If we couple the line option to the output of the flip matrix we have the lines perpendicular to the first set.

Set » Tree » Flip Matrix

Flip matrix

From the Flip Matrix and the Sub List we now can make Polylines which in turn can be used for generating the pipes.

Curves » Spline

Grid
Grasshopper