# Kangaroo Tutorial 1 - Catenary

## Introduction

In this tutorial you will learn to create a 'simple' Catenary shape with Kangaroo Physics.

An example of form-finding methods used in architecture is the Sagrada Familia in Barcelona. Gaudi developed idealized hanging chain models to visualize the catenary arches of his designs.

LMB: Left Mouse Button

MMB: Middle Mouse Button

RMB: Right Mouse Button

## The Design

Before we start building the Grasshopper model we should determine some of its basic properties. The design we want to achieve is a catenary chain with a Base Curve and two Anchor Points. The precise shape of the curve profiles is not fixed and alternatives can be explored.

Kangaroo Catenary

Other properties include:

• number of curve segments
• vector force acting on a point
• springs form lines

# Building the Grasshopper model

## Step 1 - Starting the Grasshopper model

Create two points

In this particular design we will start by making a line which will act as base of the catenary chain. A line can be constructed by drawing it in Rhinoceros or with Grasshopper components. In this case we start by drawing geometry in Rhino. First create two points in Rhino; one at the origin and one moved in the X-direction. Next step is to draw a line between the two points.

To create a point in Rhinoceros go to the following menu tab.

Curve » Point Object » Single Point

Create single line
Two points and line in Rhino

And now create a line between the two points.

Curve » Line » Single Line

Connect points & line to Grasshopper

Connect the two points and line to Grasshopper. First create a Point component.

Params » Geometry » Point

Now we have the Point component we can connect our Rhino points.

RMB on the point » select “Set Multiple Points” and click on the two points we created in Rhino

Second create a Curve component.

Params » Geometry » Curve

Now we have the Curve component we can connect our Rhino line.

RMB on the point » select “Set One Curve” and click on the two points we created in Rhino

## Step 2 - Divide Curve

Divide curve into equal length segments
Shatter curve

For the catenary we use the curve as base and the two points will be used as Anchor Points. To create a hanging chain we will have to break the curve into separate segments with the Shatter Component. Next step is to create springs between the curve segments and apply a load onto these segments.

Divide the curve into equal length segments by connecting the Curve to the Divide Curve component. The default number of segments is 10.

Curve » Division » Divide Curve

Now we will separate these equal length segments withe the Shatter component. As a result you will get 10 individual lines. This can be made visible with a Panel component.

Curve » Division » Shatter

Increase number of segments

By connecting a slider to the number of segments [N], more segments can be made. This will give a smoother chain model. Always use whole numbers, a so called “integer”.

Create the slider for the number of segments.

Params » Input » Number Slider

We want to change the setting of the slider so that it conforms to our use. There is a minimum and a maximum number of segments.

RMB on the slider > edit

Set the rounding to Integer

Set the lower limit value to 1

Set the upper limit value to 20

Rename the slider

## Step 3 – Creating Kangaroo Vector Force

Unary Force in Z-direction

The base curve is divided into equal length segments with Divide Curve. In this example the curve has 11 points. On every point a Unary Force will be applied in the Z-direction. A Unary Force is a force acting on a point.

First we create the Unary Force component (Kangaroo Physics).

Kangaroo » Forces » UnaryForce

Drag the output P of the Divide Curve component to the input P of the UnaryForce component.

To apply the force in the Z-direction we need to create a Unit-Z component.

Vector » Vector » Unit Z

Unary Force vectors

Next create the slider for the amount of force applied on the points in the Z-direction.

Params » Input » Number Slider

We want to change the setting of the slider so that it conforms to our use. There is a minimum and a maximum number of segments.

RMB on the slider > edit

Set the rounding to Integer

Set the lower limit value to 0

Set the upper limit value to 20

Rename the slider

Now let review what we have done in the viewport of rhino and check if the grasshopper definition works.

Because Grasshopper definitions work as a downward stream of data this is the only way to do this. We can solve this quite easily by hiding the original geometry.

RMB on the components > toggle preview, except the UnaryForce component.

All the other components will be hidden and the UnaryForce will remain visible. In your viewport you will see 11 vector lines in the Z-direction.

Checking you output is a useful habit and makes searching for errors a lot easier. The common practice is to use a Panel. A panel is basically a text-like field that displays the input.

Params » Input » Panel

Connect the output of the function to the input of the panel

## Step 4 – Adding Kangaroo Spring System

Create springs from lines

In this step we will add springs between the separate line segments to create the hanging chain model.

Go to the Kangaroo tab to create the spring system. Kangaroo » Forces » SpringsFromLine

Drag the output S of the Shatter component to the input Connection & Rest length of the SpringsFromLine component. Now 10 springs will be created.

## Step 5 – Creating Kangaroo Catenary Simulation

Create Line component & Kangaroo Physics component

To run a simulation we will need the Kangaroo Physics component. First create a Line component that will be used as input for the Kangaroo Physics component. And then create the Kangaroo Physics component.

Params » Geometry » Line

Kangaroo » Kangaroo » KangarooPhysics

Connect Kangaroo Physics component
Connect Boolean Toggle and Timer

First drag the output S of the Shatter component to the input of the Line component.

Second drag the output of the Line component to the input Geometry of the Kangaroo Physics component.

Third drag the output of the Point component to the input AnchorPoints of the Kangaroo Physics component.

Fourth drag both the UnaryForce component output U & SpringsFromLine component output S to the input Force objects of the Kangaroo Physics component. To drag both outputs to the input press LMB and SHIFT.

The input to Force objects needs to be a flattened list. (To flatten the input RMB on the Force objects input and select Flatten).

The difference is in the way Grasshopper treats the values in a list. In the first (not flattened) list each value is a separate object (also called a separate branch), in the flattened list it is one object with multiple values.

To start and stop the simulation you need to attach a Toggle to the SimulationReset input of Kangaroo Physics component. When this is set to True Kangaroo does some initial pre-calculation and matches all the inputs to the appropriate points. When it is set to False the simulation moves forward one iteration every time the grasshopper solution updates.

Params » Input » Boolean Toggle

Set Timer interval

To make the simulation continuously update you need to attach a Timer component.

Drag the dotted line from the timer to any part of the Kangaroo component. The timer has an interval setting which controls how long it waits between updating the solution. Right click and change this interval to 1ms to get the maximum speed.

Params » Util » Timer

Switch toggle to False to run the simulation.

Use the Boolean Toggle when you change the input of the number of segments or the amount of force applied. This will recalculate the simulation.

Increase number of segments
Increase number of segments & Force