Stairs Easy
Introduction
Expected Time: 75 min
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
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.
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
- Create the outer boundaries of the staircase
- Set the lines on two curve parameters in Grasshopper
Your Rhino viewport and Grasshopper script should look like the right image.
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 a SDL line in the origin of the worldview. This will be the guide of our lines.
- Create a XYZ point without input
- Connect an SDL line to the Point output
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
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
- Add a number slider to the Count input
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
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
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
Step 2 - Extruding the Threads
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
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
Use the output to create new vertical planes. Y becomes X and Z becomes Y.
- Construct new planes based on the deconstructed 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
- Connect a negative node to the Y Size
- Add Number Sliders to the X Size, Negative and Radius input.
Remember that the Radius input should be between 0 and 1
- Turn off the preview of all nodes, except for the thread lines and the rectangle node.
Your Rhino viewport should now look like the picture on the left.
The next step is to extrude the created sections along the thread lines.
- Extrude the sections along the thread lines
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
- Enter index 0 by right-clicking on the Indices input
Note that the created surface are still open. Therefore we should add a cap node to close them.
- Cap the culled surface list
Your Rhino model should now look like the right image.
Step 3 - Creating the Railing Base
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.
First connect the original Rhino curves to the base input of an extrusion node.
- Extrude the original curves
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
- Connect the Amplitude output to a List Item, leave the index at 0
- 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
Your model should now look like the right picture.
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
- Add an Amplitude to the canvas
- Connect the Amplitude output to a List Item
- Zoom in on the List Item output and click on +1
- Merge the outputs of the List Item component
- Connect the output of the Merge component to the Direction input of the Extrusion node
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
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
- Flatten the outputted Result
Connect the output to a solid union. This will join all the objects into one object.
- Join all objects with a solid union
For good practice, add a geometry parameter.
- Add a geometry parameter at the end of the script
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.
Step 4 (optional) - Adding a railing
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!
- Download the final Stairs Script here: Download Stairs Script
Remember to Credit the Author when using this script for your projects!
Congratulations, you just finished all tutorials of the beginner section!