# Stairs Intermediate

## Contents

## Introduction

**LEVEL: INTERMEDIATE**

Expected Time: 75 min

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

## Basic Components

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
- Define the Start with an XY Plane
- Connect a Z-Unit Vector to the Direction input
- Specify the Length with a 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.*

### Riser-Height

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
- Divide the total height by the approximate riser height

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
- Divide the SDL line by its amount of risers

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

- Shatter the SDL Line

### Tread-Depth

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
- Create a Serie of numbers with the Thread Depth as Step input and the Nearest output for the Count

## Setting Up Domain

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

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
- Partition the Series component in the last chapter with the max amount of steps

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
- Create a Number Slider that defines the Landing Length
- Use the Tree Statistics Count output and the Landing Length to create a new Serie of numbers

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
- Graft the Series output

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

- Add the Chunks and Series output together
- 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

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
- Move the shattered segments (riser lines)
- Flatten the Motion input of the move component

Your Rhino model should now look like the following illustration:

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

- Shift the list of Riser with 1 index
- Set the Shift input to 1
- Find the End Points of the original and shifted riser list

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

- Create the steps

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
- Set the Indices input to 1

## Finalizing Stairs

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.

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

- Add a Number Slider to define the nose length
- Connect an Extend Curve node to the Cull Index
- Extend the Curve by connecting the Number Slider to the Start input.

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
- Connect the Number Slider to a Unit X Vector
- Extrude the Extended Curve and original riser lines

Your Rhino model should now look like the following illustration:

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
- Connect the Number Slider to a Unit Y and Z Vector
- Extrude the Extended Curve and original riser lines

This is the last step to complete your stair!

- Join both extrusions with a Brep Join
- Flatten the Breps input
- Finalize your script with a Geometry Parameter

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