# Grasshopper Curve Frames-Arrays

## Contents

## Introduction

**LEVEL: INTERMEDIATE**

Expected Time: 75 min

In this tutorial, you will learn using the remap tool in Grasshoppper and controlling a set of geometries with the Graph Mapper. In the first section a recap will be given about planes, as described in Tutorial 8 Ramp Easy. Next, you will learn some components relating to arrays. Finally the concept of mapping will be explained.

## Horizontal Frames

In this first example, horizontal frames will be demonstrated. There is a difference between dividing a curve and connecting those points with a line versus creating perpendicular lines from the curves. This can be useful in creating stairs along a a curve, for example.

In the right picture, you can see a script that is used to connect lines between division points of two curves. First, the curve is set from Rhino to Grasshopper with

Using a Grasshopper Points from Curve. Notice that the connecting lines are not perpendicular. This is because the equal divisions of the curve are not perpendicularly placed across each other.

If you want perpendicular lines to the curve, you use the *set a number* to control the Number of Horizontal Frames. (Note: These are called Frames because they are planes derived from geometry)

To draw a line along the y-axis of the planes, use

to extract the directions of the vector. Now use with the Starting point at the origin of the Frame and the y-direction of the deconstructed vector into the Direction. The Length of the line can vary, using a Number Slider.If the direction of the offset and the SDL do not match, you can invert one or the other by using the

*You can now delete or save this script for future use. We will continue with another example.*

## Perpendicular Frames

In addition to Horizontal Frames, Grasshopper also has a tool to distribute Perpendicular Frames with the

If you follow the same steps as above, you'll see that in this case the y-direction of the plane follows the z-direction of Rhino's world coordinate system and the x-direction is perpendicular to the curve.

*You can now delete or save this script for future use. We will continue with another example.*

## Curve Array

The difference between this method and the previous ones is that here we define a geometry to distribute along a curve rather than defining a point or plane to draw geometry upon or move geometry to. In this example we start with curve-geometry to be converted into a solid, but you can start with any type of geometry (point, curve, surface, brep) or even multiple geometries.

First, in Rhino, define your geometry to be arrayed along the curve. In this case, we have drawn a cross-like curve and *set one curve*. To convert this to a solid, we use and . For the extrusion, define the direction, in this case the z-direction by using . If we connect the capped Brep to the Geometry input of the command, it will distribute the geometry along the curve by a defined Number. This can be adjust by using a Number Slider or *set a number*.

*You can now delete or save this script for future use. We will continue with the next tutorial.*

## Distance based Scaling using Remapping

In this chapter, you will learn how to use the remap tool. This can be useful for example, if you want to change a parameter based on a relation to another parameter. Imagine the following situation: based on the curve we drew in the previous exercise we will extrude geometry along the curve. However, the extrusion should be larger when it is further from the start point. Furthermore, the extrusion should be at least 1 and have a maximum of 10.

Add two curve parameters to the canvas. The first parameter should hold the base curve. The second parameter should hold a closed curve, for example a star, at the start of the base curve.

- Add two curve parameter to the canvas
- Set the base curve and the geometry to array on the parameter

Next, create a curve array of geometries along the base curve.

- Connect the curve parameters to a Curve Array as illustrated
- Define the amount of geometries with the count input

Now we need to find the location of the geometries, based on the curve length. First, use the Area node to find the Centroid of the geometries. After that, use the Curve Closest Point node to find the location. As you can see, the Curve Closest Point has three outputs: Point, Parameter and Distance. In our case, the Parameter output describes the location on the curve.

- Find the centroid of the Arrayed Geometries
- Use the curve closest point to find the Parameter on the curve

In the next step, we need to find the height of the geometries. Take a look at the following example, and try to figure out if you understand what happens:

- Add a Remap Numbers component to the canvas

- Connect the Parameters of the Curve Closest Point to the Value input of the Remap Numbers node.
- Add a bounds component between the parameters output and the Remap Numbers Source input

Create a domain between 1 and 10 for the Target input of the Remap Numbers component.

- Connect a Construct Domain to the Target
- Add a Number Slider to the start and end of the Construct Domain

Now check if the values from the remap component gives values between your created domain with a panel.

- Connect a panel to the remap output.

Change the values to a Z-Vector by connecting it to a Z-Unit vector.

- Add a Z-Unit vector to the canvas and connect it to the remap output

Now extrude the geometries along the base curve using the Z-Unit vector as direction.

- Extrude the geometries

- Cap the holes of the extrusions

Your model is now finished!

## Distance based Scaling using Graphmapper

To control, for example, the height of the geometry according to a numeric graph, you can use the Graphmapper command. This component functions can be used a input for the Value input of the Remapping tool, to get for example, a sin-like shape. The Graphmapper will create a range of numbers according to a defined graph. For this tutorial **we will use the script from the previous chapter**.

In the following image, the Graph mapper will be explained. Take a look to find out if you understand how it works.

First, we have to remove and disconnect a few components from the previous script.

- Remove the bounds component
- Disconnect the Parameter output (Curve Closest Point) to the Value input (Remap Numbers)

Add a range component to the canvas. Connect the Number Slider with the amount of points to the Steps input. You can leave the Domain input as it is.

- Add a Range node to the canvas
- Connect the previously created Number Slider to the Steps input

- Connect a Graph Mapper to the range output

- Select the type of Graph you want

By clicking on the white points of the Graph, you can alter the shape of the Graph.

- Connect the Graph Mapper to the Value Input of the Extrude node

- Remove the unused Area node
- Remove the unused Curve Closest Point node

You now have an arrayed geometry along a curve. The height of the extrusions is based on a Graph Mapper!