Elk

Elk is a plugin for Grasshopper running in Rhino. Elk works with .osm files exported from openstreetmap.org to extract 3D modeling data from public map data.

To begin using Elk:

1. Download Elk from food4rhino (you will need an account).

2. Follow Elk’s installation instructions.

3. Restart Rhino and Grasshopper. Verify that Elk has installed properly.

4. Use openstreetmap.org to identify and Export your site as an .osm file. Save the .osm file in a known location.

5. In Grasshopper, from the Params > Primitive panel, insert the File Path component, and from the Extra > Elk2 panel, insert the Location and OSM Data components. Right-click on the OSM Data component to select the Create 3D Buildings option. Connect the components as shown below:

elk-1

6. In Rhino, zoom extents to see the results:

elk-2

Advertisements

Grasshopper: Learning Resources

This page includes links to recommended resources for learning Grasshopper.

Because Grasshopper runs within Rhino, a basic knowledge of Rhino commands and procedures is essential for the beginning Grasshopper student.

 

BOOKS:

AAD_ALGORITHMS-AIDED DESIGN, by Arturo Tedeschi. The book covers Grasshopper in a thorough, detailed fashion, with many example definitions to try.

 

VIDEO TUTORIALS:

David Rutten, the creator of Grasshopper, has several tutorials online. Here are two introductory ones:

https://vimeopro.com/rhino/grasshopper-gettingstarted-by-david-rutten/video/79844992

https://vimeopro.com/rhino/grasshopper-gettingstarted-by-david-rutten/video/79844298

 

Mode Lab has an excellent series of Grasshopper tutorials: http://tinyurl.com/z6nubjw

(full link: https://www.youtube.com/playlist?list=PLGV167zE8gnUzZxgWwPkqPQrofJsXtB4g)

 

Digital Toolbox has a collection of tutorials organized by experience level. Although some of the tutorials are designed around older releases of Grasshopper and thus may require some interpretation in order to implement, they give a good feel for how the software works. Here are the links:

http://digitaltoolbox.info/grasshopper-basic/

http://digitaltoolbox.info/grasshopper-intermediate/

http://digitaltoolbox.info/grasshopper-advanced/

 

Step-by-Step: Brick Wall on Curved Path

brick_00

1. In Rhino: Use the BOX command to construct a “brick” with one corner at 0,0,0. Use the CURVE command to construct an arbitrary curved path. [The Grasshopper definition will stack the “brick” along the curved path.]
2. Insert the Brep and Crv parameters. Right-click on each in turn to “Set one Brep” and “Set one Curve.”

brick_01
3. Insert the Deconstruct Box component. Connect the Brep output to the Deconstruct Box input. [Deconstruct Box allows you to measure the X, Y, and Z dimensions of a Box.]

brick_02
4. Insert two instances of the Deconstruct Domain component. Connect the X output of Deconstruct Box to the input on the first Deconstruct Domain component; connect the Z output of Deconstruct Box to the input on the second Deconstruct Domain component. [Deconstruct Domain extracts the beginning and end points of a domain, in this case the beginning and end points of the X and Z dimensions of the “brick”.]

brick_03
5. Insert two instances of the Subtraction component. Connect the S output of the first Deconstruct Domain component to the B input of the first Subtraction component; connect the E output of the first Deconstruct Domain component to the A input of the first Subtraction component. Repeat this process with the second Deconstruct Domain and Subtraction components. [The results of the two Subtraction components represent the length and height of the “brick,” respectively.]

6. Insert the Length component and connect it to the Curve component. [This simply measures the length of the Rhino curved path. We will reference it later.]

brick_04
7. Insert a Number Slider. Edit its values as follows: Name: Height. Rounding: Integer Numbers. Numeric domain: Minimum: 1. Maximum: 10.

brick_05
8. On another area on the Canvas, insert the following components: Multiplication, Series, Vector XYZ, and Move. [We will use these components as part of a process to copy the curved path in the vertical direction.]

brick_06
9. Connect the components: Connect the R output of Multiplication to the N input of Series; connect the S output of Series to the Z input of Vector XYZ; connect the V output of Vector XYZ to the T input of Move.

brick_07
10. Right-click on the S output label of Series and select Graft. [The Graft option changes the data structure of the parameter. Instead of creating a single list of items, it effectively associates each item in a list with a unique source. In our definition, choosing the Graft option will cause Grasshopper to “remember” that the instructions apply to individual bricks.]

brick_08
11. Insert a Panel component. Edit its value to equal 2, and connect it to the B input of Multiplication.

brick_09
12. Copy-paste this entire group of components (i. e., Panel, Multiplication, Series, Vector XYZ, and Move) and set the new components below the original ones.

brick_10
13. Connect the components: Refer back to the earlier components we placed. Connect the R output of the second Subtraction component to the A input of each of the Multiplication components (two connections).

brick_11
14. Connect the components: Again referring back to the earlier components we placed, connect the output of the Number Slider to the C input of each of the Series components (two connections).

brick_12
15. Insert a Division component. Connect the L output of the Length component (i. e., the Length component which measures the length of the Rhino curve) to the A input of Division. Connect the R output of the first Subtraction component to the B input of Division.

brick_13
16. On another area on the Canvas, insert the following components: Panel (with a value of 2); Division; Multiplication; Series; Shift List; and Cull Nth. [We will use these components as part of a process to copy the “brick” along the curved path. The Shift List and Cull Nth components are critical to shifting the bricks by half their length on every alternating copy of the curved path.]

brick_14
17. Connect the components: Panel output to the B input on the Division and Multiplication components; R output of Division to N input on Series; R output of Multiplication to C input of Series; S output of Series to L input of Shift List; L output of Shift List to L input of Cull Nth.

brick_15
18. Refer back to components placed earlier. Connect the R output of Division (i. e., the Division component connected to the Length component) to the A input of the Multiplication component. Connect the R output of Subtraction (i. e., the first Subtraction component, connected to the Deconstruct Domain component) to the A input of the Division component.

brick_16
19. Insert a Series component. Connect the R output of Subtraction (i. e., the Subtraction component referred to in the preceding step) to the N input of Series. Connect the R output of Division (i. e., the same Division component referred to in the preceding step) to the C input of Series.

brick_17
20. On another area of the Canvas, insert the following components: Boolean Toggle, Evaluate Length, and Orient Direction. [The Orient Direction component is responsible for making multiple copies of the original “brick” at the correctly placed and oriented locations along the curved paths.]

brick_18
21. Connect the components: Output of Boolean Toggle to the N input of Evaluate Length; P output of Evaluate Length to the pB input of Orient Direction; T output of Evaluate Length to the dB input of Orient Direction.

brick_19
22. Copy-paste this entire group of components (i. e., Boolean Toggle, Evaluate Length, and Orient Direction) and set the new components below the original ones.

brick_20
23. Insert the following components: Panel (value of 1) and Vector XYZ. Connect the output of Panel to the X input of Vector XYZ, and connect the V output of Vector XYZ to the dA input on each of the Orient Direction components.

brick_21
24. Refer back to components placed earlier. Connect the Brep (Rhino “brick”) output to the G input on each of the Orient Direction components.

brick_22
25. Connect the S output of Series (i. e., the Series component placed in step 19) to the L input of the first Evaluate Length component).

brick_23
26. Connect the G output of Move (i. e., the Move component placed in step 8) to the C input of the first Evaluate Length component).

27. Connect the L output of Cull Nth (i. e., the Cull Nth component placed in step 16) to the L input of the second Evaluate Length component).

28. Connect the G output of Move (i. e., the Move component placed in step 12) to the C input of the second Evaluate Length component).

brick_24a
29. Connect the R output of Subtraction (i. e., the Subtraction component placed in step 5) to the S input of Series (i. e., the Series component placed in step 12).

brick_25a
30. Finally, connect the output on the Crv parameter (i. e., the Rhino “path”) to the G input of each of the Move parameters (i. e., the Move parameters from steps 8 and 12).

brick_26a
31. The definition is complete.

Step-by-Step: Lofted Surface Along Curve in Grasshopper

lofted_surface_all

1. In Rhino, use the Curve command to draw an arbitrary curve in 3D space.
2. Start Grasshopper.
3. Insert the Curve parameter.

lofted_surface_crv
4. Right-click on the Curve parameter and choose Set one curve. Click on the curve you drew in Rhino.
5. Right-click on the Curve parameter and choose Reparameterize. This forces Grasshopper to measure values along the curve starting with 0 and ending with 1.

lofted_surface_crv_reparameterized
6. Insert the Divide Curve component.

lofted_surface_divide_curve
7. Insert a Number Slider.

lofted_surface_slider
8. Edit the Slider values: Under Slider accuracy, set Integer Numbers. Under Numeric domain, set 1 as the Min and 20 as the Max.

lofted_surface_slider_values
9. Connect the components: Crv output connects to the C input on the Divide Curve component; Slider output connects to the N input on the Divide Curve component. [The first connection tells the Divide Curve component what curve to divide; the second connection tells the Divide Curve component how many divisions to make.]

lofted_surface_connect_01
10. Insert the Circle CNR (Center-Normal-Radius) component.

lofted_surface_circle_CNR
11. Connect the components: P output on the Divide Curve component connects to the C input on the Circle CNR component; T output on the Divide Curve component connects to the N input on the Circle CNR component. [The first connection tells the Circle CNR component to draw circles centered at each of the division points; the second connection tells the Circle CNR component to “tilt” the planes on which circles are drawn to align with the Rhino curve.]

lofted_surface_connect_02
12. Insert a Loft component.

lofted_surface_circle_loft
13. Connect the components: C output on the Circle CNR component connects to the C input on the Loft component. [This connection tells the Loft component to create a surface using the circles as “ribs.”]

lofted_surface_connect_03
14. Insert the Graph Mapper component and another Number Slider.

lofted_surface_circle_graph_mapper+slider
15. Right-click on the Graph Mapper component. From Graph types, choose SinC.

lofted_surface_circle_graph_mapper_sinC
16. Edit the Slider values: Under Numeric domain, set 1 as the Min and 50 as the Max.

lofted_surface_slider_values_02
17. Insert the Multiplication component.

lofted_surface_multiplication
18. Connect the components: t output on the Divide Curve component to the input on the Graph Mapper component; output on the Graph Mapper component to the A input on the Multiplication component; output on the Slider to the B input on the Multiplication component. [These connections produce a list of numbers which is then multiplied by the output of the Number Slider. The list of numbers is determined by the y-coordinates of the graph in the Graph Mapper corresponding to the given x-coordinates (i. e., the inputs to the Graph Mapper).]

lofted_surface_graph_mapper_connected
19. Connect the components: R output on the Multiplication component to the R input on the Circle CNR component. [This connection tells the Circle CNR component to draw circles at radii corresponding to the output of the Multiplication component.]

lofted_surface_multiplication_connected
20. The Grasshopper definition is complete. Experiment by (1) selecting different curves from Rhino; (2) changing the number of divisions (first Number Slider); (3) changing the shape of the graph in the Graph Mapper component (move the grips); (4) changing the graph type in the Graph Mapper component; (5) changing the multiplication value (second Number Slider).

 

Acknowledgements: This tutorial was inspired by a definition illustrated in the Mode Lab Grasshopper Primer (http://modelab.is/grasshopper-primer/). — Mike Christenson

Step-by-Step: Basic Mathematics in Grasshopper

1.   Start Rhino; type Grasshopper at the Command prompt.
2.   In Grasshopper, choose File > New Document.
3.   Double-click anywhere in the Grasshopper canvas to search for the Number Slider component.
4.   Insert a Number Slider into the Canvas.

basic_mathematics_slider
5.   Double-click on the Slider component to edit its properties.
6.   Under Numeric Domain, set the “Max” value to 100.

basic_mathematics_slider_properties
7.   Click OK.
8.   Single-click on the Slider and copy it to the Clipboard (ctrl-C).
9.   Paste the Slider (ctrl-V).

basic_mathematics_slider_copied
10.   Arrange the two Sliders vertically.

basic_mathematics_slider_aligned
11.   Double-click anywhere in the Grasshopper canvas to search for the Addition component.

basic_mathematics_search_addition
12.   Insert the Addition component into the Canvas.

basic_mathematics_slider_addition
13.   Repeat the previous two steps with the Subtraction, Multiplication, and Division components.

basic_mathematics_slider_all_operations
14.   Connect the first Slider to the “A” inputs of the components. Notice that the Slider automatically updates its label to “A”.

basic_mathematics_slider_A
15.   Repeat the previous step with the second Slider and the “B” inputs.

basic_mathematics_slider_A+B
16.   Double-click anywhere in the Grasshopper canvas to search for the Panel component.
17.   Insert a Panel into the Canvas.

basic_mathematics_slider_one_panel
18.   Single-click on the Panel and copy it to the Clipboard (ctrl-C).
19.   Paste the Panel three times (ctrl-V).
20.   Arrange the four panels vertically.

basic_mathematics_slider_all_panels
21.   Connect the “R” (result) outputs from the Addition, Subtraction, Multiplication, and Division components to the inputs on the panels.

basic_mathematics_slider_connected
22.   The Grasshopper definition is complete. Experiment with adjusting the two sliders and observe the results.

Step-by-Step: A Simple Grasshopper Definition

Creating Grasshopper definitions is rarely a straightforward, linear process. It usually involves having a general idea of what one wants to accomplish, and a sense of which components will be necessary; however, the process almost always involves extensive testing, false starts, discoveries, and iterations along the way.

As an example, consider creating a Grasshopper definition which can create elliptical towers:

elliptical

One way of creating this definition is shown in the following step-by-step procedure.


1. Start Rhino; type GRASSHOPPER to start Grasshopper.


2. Double-click in the Grasshopper canvas to search for and insert the Ellipse component (or Curve > Primitive > Ellipse).

ellipse_01

Notice that when the component is placed on the Grasshopper canvas, it is automatically previewed in Rhino, on the basis of its default values:

ellipse_02

To see the component’s default values, hover the mouse over the input labels (P, R1, and R2). P, the base plane, is by default the XY plane and is previewed as a red grid in Rhino. R1 and R2, the ellipse’s two radii, are be default both set to one (1.0). Their result is previewed as a red circle in Rhino.

However, we want the component to produce variable-sized ellipses. Therefore, we need to introduce variable input in the form of number sliders.


3. Double-click in the Grasshopper canvas to search for and insert the Number slider component (or Params > Input > Number Slider).

ellipse_03

 


4. Double-click on the label of the number slider (“Slider”) to adjust its values as shown below:

ellipse_04

This will allow the slider to generate values between 0 and 50, with a precision rounded to three decimal points. Its initial value is set to 10, but that value is variable.


5. Copy and paste the first slider to create another slider. Double-click on this slider and change its name to Radius 2.

ellipse_05


6. Connect the two sliders to the Ellipse component by dragging wires between them. Begin by clicking on the slider output node, hold down the mouse button, and release it on the input node of the Ellipse component.

ellipse_06

Notice how this affects the Rhino preview:

ellipse_07

The ellipse is now shown with radii of 10 units. Adjust the number sliders to see how the preview is affected.


7. Having created a base ellipse of variable size, we now need to begin stacking multiple copies of the ellipse. We’ll do this by copying the ellipse vertically. Grasshopper does not have a Copy component; instead, we use the Move component — with the knowledge that the original ellipse will still preview in its original location.

Double-click in the Grasshopper canvas to search for and insert the Move component (or Transform > Euclidean > Move):

ellipse_08

The Move component requires two forms of input, which you can see by hovering the mouse over the input labels (G and T). Input G (Geometry) requires a drawn or modeled object — such as an ellipse. Input T (Motion, or Translate) requires a direction/magnitude in the form of a vector. Notice that by default, input T is set to a vector 10 units long in the Z-direction (0.0,0.0,10.0).


8. Connect the E output on the Ellipse component to the G input on the Move component:

ellipse_09

Notice how this affects the Rhino preview:

ellipse_10

A new ellipse is previewed 10 units vertically above the original ellipse.

However, we need multiple ellipses, placed at a variable distance (i. e., floor-to-floor height) above the original ellipse. We will need to do something different for the T input on the Move component. Specifically, we will need to provide to this component as input a list of numbers corresponding to the vertical positions of the floors.


9. Double-click in the Grasshopper canvas to search for and insert the Series component (or Sets > Sequence > Series):

ellipse_11

The Series component generates a list of numbers according to input parameters. Hover the mouse over the input labels (S, N, and C) to find out what is required for input.

The S input requires a single number, the start of the list. Assuming we want the first floor of our tower to be on the XY plane, S can be set to 0 (zero). The simplest way to do this is to right-click on the S label and choose Set Number from the dropdown menu. (Note that by default, S is already set to zero.)

The N input refers to the step size — the floor-to-floor height. And the C input refers to the count of items in the list — simply, the number of floors in the tower. Both N and C can be controlled with number sliders.


10. Insert two number sliders with the following values (note that Number of Floors is set to Integer rounding):

ellipse_12

And then connect the sliders to the Series component as shown below:

ellipse_13


11. Hover the mouse over the S output on the Series component. You should see the list of numbers generated in accordance with the input values. Now, it would seem that we could simply connect the S output from Series to the T input on Move — but if we do this, Grasshopper will generate an error message at the Move component:

ellipse_14

The problem is that the Move component expects vectors as input at T; we have given a list of numbers, not vectors. To fix this, we need to insert a Unit Vector component between the Series and Move components.


12. Double-click in the Grasshopper canvas to search for and insert the Unit Z component (or Vector > Vector > Unit Z):

ellipse_15


13. Reconnect wires as shown below (note: you can manually disconnect wires by right-clicking on input or output nodes and selecting Disconnect):

ellipse_16

Once again, notice how this affects the Rhino preview:

ellipse_17

Adjust all four number sliders to see the effect on the Rhino preview.


14. That completes the basic definition. Additional steps might include:

Extruding the floors to a specified or variable thickness (as shown in the image at the beginning of this post);

Varying the elliptical radii along the height of the tower;

Constructing a “skin” on the tower.