Kangaroo Tutorial 2 - Mesh
Contents
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.
This page uses abbreviations for the mouse buttons:
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.
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
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.
And now create a line between the two points.
Connect the two points and line to Grasshopper. First create a Point component.
Now we have the Point component we can connect our Rhino points.
Second create a Curve component.
Now we have the Curve component we can connect our Rhino line.
Step 2 - Divide 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.
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.
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.
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
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).
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.
Next create the slider for the amount of force applied on the points in the Z-direction.
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.
Connect the output of the function to the input of the panel
Step 4 – Adding Kangaroo Spring System
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.
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
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.
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.
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.
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.