Stairs Easy

From TOI-Pedia

Introduction

LEVEL: BEGINNER
Expected Time: 75 min
Possible result of this tutorial

In this tutorial, you will learn how to create an easy staircase. During this tutorial, you will use most of the nodes and functions used in the beginner tutorials before. Although this tutorial is called easy, it is still recommended that you have a basic understanding of Grasshopper before you proceed.

The Design

The design of this staircase will be based on two lines. These two lines shape the outer boundaries of the stair. The two lines do not need to be parallel. The staircase will have the following parameters:

  • The shape (two curves created in Rhino)
  • Amount of threads
  • Thickness of threads
  • Width of threads
  • Thickness of the railing base

If you have finished the script in this tutorial, of course you can also add a real railing, as explained in Tutorial 3 - Railing and Tutorial 8 - Ramp Easy.

Step 1 - Creating the Thread Lines

Result of step 1

In the first step of this tutorial, we will build the thread lines between two curves you created in Rhino. One of the main problems in these kind of scripts, is that we are working with varying directions. Therefore, a large part of this tutorial is finding out the right methods to make the script always work.

Create two lines in Rhino. Set them on a curve parameter in Grasshopper.

First, create two lines in Rhino. The two lines do not have to be parallel. It is recommended that you pre-define the landings you will use, to check if the script is working properly.

  • Add two landings, for example Rhino » Standard » Box
  • Create the outer boundaries of the staircase Rhino » Standard » Single Line
  • Set the lines on two curve parameters in Grasshopper Params » Geometry » Curve

Your Rhino viewport and Grasshopper script should look like the right image.

Different directions of the lines.

The next step is that we need to make sure that the lines are drawn in the same direction. Of course you could do that in Rhino, but it would be way more useful if our script does that automatically. In the right image, you can see an example of two lines that are not drawn in the same direction. However, in our case we want the curve to always go up.

Create an SDL line in the origin.

Create a SDL line in the origin of the worldview. This will be the guide of our lines.

  • Create a XYZ point without input Vector » Point » Construct Point
  • Connect an SDL line to the Point output Curve » Line » Line SD


Flip the lines according to the SDL line.

Add two Flip Curve nodes to the canvas. Based on the created guide curve, this function will make sure the lines go up.

  • Add two Flip Curve functions to the curve output Curve » Util » Flip Curve


Divide one curve in horizontal frames.

Now we will divide one of the lines by horizontal planes. This will define the amount of threads. For the count, use the amount of threads you need for the staircase.

  • Connect Horizontal Frames to one of the curves Curve » Division » Horizontal Frames
  • Add a number slider to the Count input Params » Input » Number Slider


Find the intersection between the frames and the other curve.

The next step is to find the intersection between the frames of the first curve, with the other curve. You might think we could just do this by adding another Horizontal Frames function. However, that would mean that the endpoints of the thread lines could be on different heights when the curves do not have the same shape.

  • Find the Curve|Plane intersection with the created frames and the other curve Intersect » Mathematical » CurvePlane


Flatten the resulting Points.

Since the intersections are calculated individually, the output of the intersections is a grafted list. Therefore, we need to flatten the Points output.

  • Flatten the Points output RMB on Points output » Flatten


Create a line between the intersection points and the frames origins.

Finally, we can create a line between the found points. Use the Frames as first point and the intersection points as second point. Grasshopper is smart enough to use the origin point of a frame, when you are connecting it to a point input.

  • Create thread lines between the curves Curve » Primitive » Line


Step 2 - Extruding the Threads

Align the frames with the thread lines.

In the second step of this tutorial, we are going to create the section of the threads and then extrude them. First, let's align the created frames at the end of the thread lines, based on the direction of the lines.

  • Align the created frames to the thread lines Vector » Plane » Align Plane


Deconstruct the frames.

Next, we need to rebuild this frame to make it vertical. We have done this previously in Tutorial 8 - Ramp Easy.

  • Deconstruct the Plane output of the Align Plane node Vector » Plane » Deconstruct Plane


Construct new planes.

Use the output to create new vertical planes. Y becomes X and Z becomes Y.

  • Construct new planes based on the deconstructed planes Vector » Plane » Construct Plane


Create rectangles on the vertical planes

Now we create a rectangular section of the threads on the created planes. Use a negative node for the Y size to create the threads in the right direction. By adding a numerical input between 0 and 1 to the Radius, you can round the corners of the rectangles.

  • Add a rectangle to the created planes Curve » Primitive » Rectangle
  • Connect a negative node to the Y Size Maths » Operators » Negative
  • Add Number Sliders to the X Size, Negative and Radius input. Params » Input » Number Slider

Remember that the Radius input should be between 0 and 1

Resulting sections of threads
  • Turn off the preview of all nodes, except for the thread lines and the rectangle node. RMB on nodes » Preview Off

Your Rhino viewport should now look like the picture on the left.

Extrude the threads along the thread lines.

The next step is to extrude the created sections along the thread lines.

  • Extrude the sections along the thread lines Surface » Freeform » Extrude Along


Cull Index on resulting extrusions.

As you can see, the lowest thread is also included. Therefore we need to cull the first item of the Extrusion output list.

  • Connect the Extrusion output to a Cull Index node Sets » Sequence » Cull Index


Type 0 as integer of the cull index.
  • Enter index 0 by right-clicking on the Indices input RMB on Indices input » Set Integer » Type 0 » Commit Changes


Cap the culled list.

Note that the created surface are still open. Therefore we should add a cap node to close them.

  • Cap the culled surface list Surface » Util » Cap Holes


Resulting threads

Your Rhino model should now look like the right image.

Step 3 - Creating the Railing Base

Result of step 3

In the final obligated step of this tutorial, a railing base will be added that holds the created threads. The width of the railing base is based on the width of the threads. The thickness can be changed with a number slider.

Extrude the original Rhino curves.

First connect the original Rhino curves to the base input of an extrusion node.

  • Extrude the original curves Surface » Freeform » Extrude


Add an amplitude to the direction of the extrusion.

Now add an amplitude to the canvas. This amplitude will be based on the Y-axis of the deconstructed planes created previously. The Amplitude of this vector will be equal to the X Size of the rectangle. Check the right image if you are unsure how to do this.

Proceed carefully:

  • Add an Amplitude to the canvas Vector » Vector » Amplitude
  • Connect the Amplitude output to a List Item, leave the index at 0 Sets » List » List Item
  • Add an amplitude to the Direction input of the extrusion
  • Connect the Y-Axis output of the Deconstruct Planes node to the Vector input of the Amplitude node
  • Connect the Number Slider of the rectangle X-size to the Amplitude input
  • Connect the List Item output to the Direction input of the Extrude node


Current stage of the script.

Your model should now look like the right picture.

Extrude the created extrusions.

Following, we now have to give thickness to the created extrusions. These thicknesses should go in two different directions, but both to the center of the staircase.

  • Add an extrusion node to the Extrusion output Surface » Freeform » Extrude
  • Add an Amplitude to the canvas Vector » Vector » Amplitude
  • Connect the Amplitude output to a List Item Set » List » List Item
  • Zoom in on the List Item output and click on +1 Zoom to List Item » +1
  • Merge the outputs of the List Item component Set » Tree » Merge
  • Connect the output of the Merge component to the Direction input of the Extrusion node


Define the direction and thickness.

As Vector input of the amplitude we can use the original thread lines. The amplitude is a bit more difficult, because one of them should be negative. First connect a Number Slider to the Amplitude. After that, connect a negative version of that Number Slider to the Amplitude, holding shift.

  • Connect the Thread lines to the Vector input of the Amplitude
  • Connect a positive and negative version of a Number Slider to the Amplitude Params » Input » Number Slider


Merge and flatten the results.

Use a merge node to combine the railing bases and the threads into one list. Make sure you flatten the outputted Result.

  • Merge the capped threads and the thickness extrusions Sets » Tree » Merge
  • Flatten the outputted Result RMB on Result » Flatten


Create a solid union.

Connect the output to a solid union. This will join all the objects into one object.

  • Join all objects with a solid union Intersection » Shape » Solid Union


Add a geometry parameter.

For good practice, add a geometry parameter.

  • Add a geometry parameter at the end of the script Params » Geometry » Geometry


Set off the preview of all nodes except the final geometry parameter. Rename all your sliders. Your final script should now look like the following illustration.

Final script (click on image for fullscreen) Some small changes may be visible to make sure the script works in all cases.


Step 4 (optional) - Adding a railing

Staircase

As described in Tutorial 8 - Ramp Easy, you can also add a railing to the staircase. You may have to do some small changes, but see it as a challenge to implement the railing script!

Remember to Credit the Author when using this script for your projects!

Final script combined with Tutorial 3 - Railing (click on image for fullscreen)


Congratulations, you just finished all tutorials of the beginner section!

Personal tools
Actions
Navigation
Tools