# Tutorial 4 - Fabrication

Chapter 3 of this article will soon be obsolete. This chapter wil be removed after the installation of the latest version of Grasshopper on the desktop computers at the faculty.

## Introduction

The parametric feature of Grasshopper gives us the ability to make different studies. Eventually you can finalize your created geometry with the Bake Selected command.
In this example you can use a closed polysurface or a landscape-like sloping surface. You will slice the geometry in even slices to create section lines for example for lasercutting.

Landscape-like surface

You will make a model of the geometry used or created. Meaning, that you probably need to scale down the model. Further you need to determine the thickness of the slices.

Variables

1. Scale
2. Slice thickness

### Step 1: Scaling and positioning

Scaling geometry

First you need to define a geometry.

Params » Geometry » Surface

To scale you need two input fields. A division operator and a scale component for the transformation.
Create to input fields with:

Params » Input » Panel

Connect the outputs of the Panels with the inputs of the division operator.

Math » Operators » Division

Connect the result of the division operator and your geometry with the Scale component.

Transform » Affine » Scale

Positioning geometry

It is very likely that the geometry is somewhere in your viewport. When scaled down you would like to have your geometry in the origin and not somewhere else in your viewport.

To find the lowest point create a bounding box around your scaled geometry.

Surface » Primitive » Bounding Box

To get the different components of the box we need to explode the geometry.

Surface » Analysis » BRep Components

This outputs 6 faces, 12 edges and 8 vertices. You need one vertice to move from. Choose one of the items and connect it with output V (vertices) of BRep Components.

Sets » List » List Item

You need a vector to the origin. Create a vector and connect the first position with input A.

Vector » Vector » Vector 2Pt

Connect the origin with input B of the vector (X,Y,Z) is standard 0.

Vector » Point » Point XYZ

Create a move component to perform the translation. Connect it with the scaled geometry and the vector. The lower left corner should be in the origin now.

Transform » Euclidian » Move

### Step 2: Creating the base

The shape is still hovering in the air. So if you slice the shape horizontal you will get the contour lines of the shape itself but you will be missing the contour lines of the outer edges.
This means that you need te create a bounding box and trim away the unneeded parts with the edges of the shape.

Selecting faces

Create a bounding box.

Surface » Primitive » Bounding Box

To get the faces explode the box.

Surface » Analysis » BRep Components

You need only the vertical faces. You can create four seperate List Item components with seperate index numbers, but you can also combine a series of index numbers with one List Item.

Sets » Sequence » Series

Selecting edges

To get the trim lines, you need the edges of the landscape shape. Again use Explode (BRep Components) and select the edges with Series and List Item.

Trim surface

To trim a face you first need to split a face. The actual trim is to keep one of the splitted faces.

Add a Surface Split component to divide the sides of the bounding box

Intersect » Physical » Surface Split

Connect the output with a List Item component and keep the face you want. This is the same what Trim in Rhino actually does. It hides one of the trimmed surfaces.

Connecting the wrong way

You might think let's connect the output of the edges with input C and connect the output of the faces with input S of the Surface Split component. Unfortunately, that will not work.

Connecting the right way

The output of the faces and edges is one data stream. To make it work with the Surface Split component you need to split the data stream in single branches. This way the data is handled one by one.

Sets » Tree » Graft Tree

Check the difference of the data structure by adding a Param Viewer component before and after the Graft Tree component.

### Step 3: Slicing

To slice the shape in equal segments you will need cutting planes and extract the intersection curves between the shape and the slices.

Determining plane size and divide height

Determine the size of the cutting planes with the edges of the earlier created bounding box of the shape. Select only one edge for the length and one edge for the width.

Curve » Analysis » Length

You wil also need a vertical edge to divide in equal lenghts. Later you will place on each division point a cutting plane.

Curve » Division » Divide Length

According to the thickness of your sheet material you can set it here. The lenght of the division can be set with a Number Slider. Connect this with input L of the Divide Length component.

Slicing

You now have all the required information to create a plane. Connect the output from the edges and the height with the inputs of the Plane component.

Surface » Primitive » Plane Srf

On each division point a cutting plane will be created. To get the cutting lines between the intersecting surfaces you will need the BRep | Plane component.

Intersect » Mathematical » BRep I Plane

These intersection lines you can bake. RMB on the BRep | Plane component and select Bake... If asked select a layer in Rhino to put the lines in.

## Building the model in previous versions (before 0.8.0001)

Landscape-like surface

You will make a model of the geometry used or created. Meaning, that you probably need to scale down the model. Further you need to determine the thickness of the slices.

Variables

1. Scale
2. Slice thickness

### Step 1: Scaling and positioning

Scaling geometry

First you need to define a geometry.

Params » Geometry » Surface

To scale you need two input fields. A division operator and a scale component for the transformation.
Create to input fields with:

Params » Special » Panel

Connect the outputs of the Panels with the inputs of the division operator.

Scalar » Operators » Division

Connect the result of the division operator and your geometry with the Scale component.

XForm » Affine » Scale

Positioning geometry

It is very likely that the geometry is somewhere in your viewport. When scaled down you would like to have your geometry in the origin and not somewhere else in your viewport.

To find the lowest point create a bounding box around your scaled geometry.

Surface » Freeform » Bounding Box

To get the different components of the box we need to explode the geometry.

Surface » Analysis » BRep Components

This outputs 6 faces, 12 edges and 8 vertices. You need one vertice to move from. Choose one of the items and connect it with output V (vertices) of BRep Components.

Logic » List » List Item

You need a vector to the origin. Create a vector and connect the first position with input A.

Vector » Vector » Vector 2Pt

Connect the origin with input B of the vector (X,Y,Z) is standard 0.

Vector » Point » Point XYZ

Create a move component to perform the translation. Connect it with the scaled geometry and the vector. The lower left corner should be in the origin now.

XForm » Euclidian » Move

### Step 2: Creating the base

The shape is still hovering in the air. So if you slice the shape horizontal you will get the contour lines of the shape itself but you will be missing the contour lines of the outer edges.
This means that you need te create a bounding box and trim away the unneeded parts with the edges of the shape.

Selecting faces

Create a bounding box.

Surface » Freeform » Bounding Box

To get the faces explode the box.

Surface » Analysis » BRep Components

You need only the vertical faces. You can create four seperate List Item components with seperate index numbers, but you can also combine a series of index numbers with one List Item.

Logic » Sets » Series

Selecting edges

To get the trim lines, you need the edges of the landscape shape. Again use Explode (BRep Components) and select the edges with Series and List Item.

VB script

Unfortunately Grasshopper does not yet have the ability to split or trim faces. You need to do some VB scripting.

Logic » Script » DotNET VB Script

Change some values to make it recognizable.

• RMB on the x and change it into C for curves.
• RMB on the y and change it into B for BRep faces.
• RMB on output A and change it into S for trimmed surfaces.

Double-click on the Script component and replace `'your code goes here…`
with this script `S = rhutil.RhinoSplitBrepFace(B, 0, C.ToArray, doc.AbsoluteTolerance)`

Trim surface

You need to do some fine-tuning with the script to get it working.

• RMB on C and check List. This makes splitting possible with more than one curve on a surface.
• RMB again on C and check OnCurve in Type hint.

The output of the script is a surface containing faces, edges and vertices. To get only the faces use Explode (BRep Components) and select the face needed with List Item.
This is the same what Trim in Rhino actually does. It hides one of the trimmed surfaces.

Connecting the wrong way

You might think let's connect the output of the edges with input C and connect the output of the faces with input B of the Split-script component. Unfortunately, that will not work.

Connecting the right way

The output of the faces and edges is one data stream. To make it work with the Split-script component you need to split the data stream in single branches. This way the data is handled one by one.

Logic » Tree » Graft Tree

Check the difference of the data structure by adding a Param Viewer component before and after the Graft Tree component.

### Step 3: Slicing

To slice the shape in equal segments you will need cutting planes and extract the intersection curves between the shape and the slices.

Determining plane size and divide height

Determine the size of the cutting planes with the edges of the earlier created bounding box of the shape. Select only one edge for the length and one edge for the width.

Curve » Analysis » Length

You wil also need a vertical edge to divide in equal lenghts. Later you will place on each division point a cutting plane.

Curve » Division » Divide Length

According to the thickness of your sheet material you can set it here. The lenght of the division can be set with a Number Slider. Connect this with input L of the Divide Length component.

Slicing

You now have all the required information to create a plane. Connect the output from the edges and the height with the inputs of the Plane component.

Surface » Primitive » Plane Srf

On each division point a cutting plane will be created. To get the cutting lines between the intersecting surfaces you will need the BRep | Plane component.

Intersect » Mathematical » BRep I Plane

These intersection lines you can bake. RMB on the BRep | Plane component and select Bake... If asked select a layer in Rhino to put the lines in.