Stairs Intermediate

From TOI-Pedia


Expected Time: 75 min
Possible result of this tutorial

As is often the case, there are many ways of building stairs. This is just one example of creating a straight stair along the y-axis of the coordinate world system. The definition needs to be adjusted (or the stairs rotated) for other directions. This definition allows for entering possible constraints defined by Building Codes such as the maximum consecutive steps before placing a landing.


The variables are:

  • Total Rise
  • Riser Height
  • Tread Depth
  • Maximum Consecutive Steps
  • Length of the Landing

Once the basic set-up is complete, you can define the following variables:

  • Nose Length
  • Thickness Tread
  • Thickness Riser
  • Width of Treads & Risers
For a good spiral staircase tutorial see:

Basic Components

Create an SDL line

This definition is set-up to first define the total height, divided by an approximate riser height to obtain the number of steps. You could also have divided the total height by the number of steps instead. However, this way we can constrain the minimum-maximum riser height easily on the Number Slider, whereas doing this with the step count is more complicated.

So, let's set-up this first step. First, create a line. Define the direction with a Z-vector and use a XY plane as origin point.

  • Create a SDL line Curve » Primitive » SDL Line
  • Define the Start with an XY Plane Vector » Plane » XY Plane
  • Connect a Z-Unit Vector to the Direction input Vector » Vector » Unit Z
  • Specify the Length with a Number Slider Params » Input » Number Slider

In this tutorial, you will see that the Relay component is used to make the script easier to read. Double-Click on a wire to create a Relay and rename it.


Shatter the line in steps

Now we will calculate the number of steps by dividing the total height by the approximate riser height.

  • Create a Number Slider for the approximate riser height Params » Input » Number Slider
  • Divide the total height by the approximate riser height Maths » Operators » Division

To get an integer number, we can round the result. In this case, it is easiest to use the Nearest output. Next, we can divide the curve in its calculated amount of risers.

  • Round the result Maths » Operators » Round
  • Divide the SDL line by its amount of risers Curve » Division » Divide Curve

Finally, we can shatter the line in segments with the Shatter component.

  • Shatter the SDL Line Curve » Division » Shatter


Create a Serie of Thread Depths

Next, using the number of steps, you generate a series to determine the depth of each step. Later we will use this series to move each of the line segments in the y-direction.

  • Create a Number Slider for the Thread Depth Params » Input » Number Slider
  • Create a Serie of numbers with the Thread Depth as Step input and the Nearest output for the Count Sets » Sequence » Series

Setting Up Domain

Current stage of the model

If you wanted to make a simple continuous stairs, your definition would be straigthforward and almost done. What complicates this, is the necessity for a landing. This varies by code, depending on the country, exterior/interior, public/private buildings, etc. As an example, we will place a landing every 7 steps (meaning; every 7th step will be a landing).

To do this, we use the series component from the treads. We need to group the tread distances into groups of 7 steps. Then we add the length of the landing to every group. As the total number of steps needed to cover a height of 4500mm in our example we have to create the domains 0-6, 7-13, 14-20 and the leftover 21-26. To keep this parametric and working for all other instances as well, we need do some "tree gymnastics" to set up these domains.

Tree Gymnastics

Partition the Stair Thread Depths

First we will have to partition our steps in a maximum amount of steps before a landing is placed.

  • Define a max amount of steps with a Number Slider Params » Input » Number Slider
  • Partition the Series component in the last chapter with the max amount of steps Sets » List » Partition List

Review the Data Tree and create a new serie of numbers

So far we have only grouped the steps, or more precisely; the distances of the thread depth. We will use this to move each of the risers along the y-direction. But first we need to add a landing length to each of the groups. If the landing length is 1000mm, we need to create a series of (0,1000,2000,3000) to place the landings in between the groups. To clarify, we need to add 0 to the 1st group, 1000 to the 2nd group, 2000 to the 3rd group, etc.

First, we need to know how much "groups" of steps there are to add a landing to. Since the Partition List grafts our data in different group, we cannot use the standard List Length component to do this. To obtain the number of groups we have, we need to analyze the Data Tree.

  • Add a Tree Statistics component to the Chunks output Sets » Tree » Tree Statistics
  • Create a Number Slider that defines the Landing Length Params » Input » Number Slider
  • Use the Tree Statistics Count output and the Landing Length to create a new Serie of numbers Sets » Sequence » Series

Graft en simplify the Series output

To make sure the new Data Tree with numbers can interact correctly with our original chunks, we need to Simplify and Graft the output of the series.

  • Simplify the Series output RMB on Series output » Simplify
  • Graft the Series output RMB on Series output » Graft

Add the results together and simplify the Chunks input

Use an addition node to add the Serie of grafted and simplified numbers to the original chunks.

  • Add the Chunks and Series output together Maths » Operators » Addition
  • Simplify the Chunks input (A)

Since we haven't applied any transformations yet, none of the previous steps are visible. That's why we call it tree gymnastics, we've only altered the structure of the data. In the following steps we will use this to actually transform the geometry and complete the stairs.

Create Risers and Treads

Move the risers to the correct location

Now we will place all the risers at their right location. Change the result from the previous chapter in a Y-vector. Next, move all the riser lines with this vector. Make sure you flatten the Motion input, since the Geometry input is just one list of riser lines.

  • Use the Result output as input for a Unit Y vector Vector » Vector » Unit Y
  • Move the shattered segments (riser lines) Transform » Euclidian » Move
  • Flatten the Motion input of the move component RMB on Motion input » Flatten

Current stage of the model

Your Rhino model should now look like the following illustration:

Shift the list of risers

In the next step we connect the top and bottom of each riser with the next.

  • Shift the list of Riser with 1 index Sets » List » Shift List
  • Set the Shift input to 1 RMB on Shift input » Set one value » Enter 1
  • Find the End Points of the original and shifted riser list Curve » Analysis » Endpoints

Create the stair steps

Create a line from the End of the original riser list to the Start of the shifted riser list.

  • Create the steps Curve » Primitive » Line

Cull the last line

Unfortunately, this will also create a line from the first to the last riser. We can remove this with the Cull Index Node.

  • Connect the Line output to a Cull Index Node Sets » Sequence » Cull Index
  • Set the Indices input to 1 RMB on Indices input » Set one value » Enter -1

Finalizing Stairs

Current stage of the model

If you've made it this far, the last part is easy. We are going to extrude the stairs in the x-direction to generate surfaces. We will add a nose length and thickness to the steps and risers. These are the 4 additional variables mentioned at the beginning of this exercise.

Extend the thread lines for the nose

For the nose, we can extend the thread line on one side.

  • Add a Number Slider to define the nose length Params » Input » Number Slider
  • Connect an Extend Curve node to the Cull Index Curve » Util » Extend Curve
  • Extend the Curve by connecting the Number Slider to the Start input.

Extrude the stair to give it a width

Now we have to extrude all the created lines. First extrude Extended Curve and the original riser lines in the x direction to give the stair a width.

  • Add a Number slider for the stair width Params » Input » Number Slider
  • Connect the Number Slider to a Unit X Vector Vector » Vector » Unit X
  • Extrude the Extended Curve and original riser lines Surface » Freeform » Extrude

Current stage of the model

Your Rhino model should now look like the following illustration:

Give the surfaces a thickness

As one of the last steps, extrude the two extrusions again. The Extended Curve Extrusion should go in the Z direction. The riser extrusion should go in the Y direction.

  • Add a Number slider for the material thickness width Params » Input » Number Slider
  • Connect the Number Slider to a Unit Y and Z Vector Vector » Vector » Unit X
  • Extrude the Extended Curve and original riser lines Surface » Freeform » Extrude

Finalize your model

This is the last step to complete your stair!

  • Join both extrusions with a Brep Join Surface » Util » Brep Join
  • Flatten the Breps input RMB on Breps input » Flatten
  • Finalize your script with a Geometry Parameter Params » Geometry » Geometry

Final stage of the model

Your final model should look like the following illustration (after disabling the preview of all components, except the final geometry parameter)

Final Script (Click on image for Full Screen)

Personal tools