The ergonomics of a stair is not only about the tread depth, the riser height, the stair slope, … It is also about the safety of your head when you walk the stair. Ever been in a situation when you rushed down the stair to the cellar and then bumped your head against one of the floor beams 😉
In this post I will explain you how to create your own Dynamo script for the “Clearance Height Check” of your stairs in a Autodesk Revit project. The Dynamo script (which can be downloaded at the bottom of this post) works on a selected stair and will verify the “Clearance Height” or “Headroom” between the tread top surfaces and the objects above. The results will then be displayed as colored lines.
The script consists of 7 main parts, organized in node groups. Each of the steps is described below.
Step 1 – Input
In this step you need to select the stair that you want to analyze. This can be a single or a multi-story stair.
The Safety Offset parameter is explained in Step 3 further in this post.
And of course you need to set a constraint for the “Clearance Height” in the last parameter.
Step 2 – Detection of top surfaces of treads and landings
When you import the stair geometry into Dynamo, it’s considered as one single solid. This means you can’t detect the individual treads (with the native nodes). In this case we use the Element.Faces node to detect all the surfaces of the solid. Each of these surfaces has a normal vector (Surface.NormalAtParameter). The surfaces with a Z-value of this vector equal to 1, are the top horizontal surfaces of the stair. In this case these are the treads and landings, but also the smaller end surfaces of the supports or stringers. In the first List.FilterByBoolMask these top surfaces are filtered (results is in the in output). In the second List.FilterByBoolMask the surfaces with an area smaller than the tread area (= width * tread depth) are filtered out (the in output represents the surfaces with a greater or equal area).
Now we have the references of the treads and landings which represent the bottom of our “Clearance Height” calculation.
Step 3 – Detecting the upper elements with ray bouncing
This part of the script will generate the “calculation” elements by
- creating a point in the middle of each top surface (Surface.PointAtParameter)
- translating the points vertically with a distance equal to the indicated “Safety Offset”. This is done to avoid the point being inwards the solid of the tread. In a later step we will add this 50 mm value to the resulting clearance height.
- using the points as origins for the RayBounce.ByOriginDirection which will cast rays in an upward direction until it meets an object on it’s way. The output of this node consists of Points, which are the start- and endpoints of the single ray (maxBounces=1 and Elements which represent the family instances that are hit by the ray.
- connecting the start- and endpoints by means of the PolyCurve.ByPoints node.
These polycurves can now be used to calculate the headroom and visualize the results in the next steps.
Step 4 – Visualization of environment
In this optional step, the elements that are hitted by the rays are displayed within the Dynamo GUI. Play with the Number Slider to manage the transparency of the objects.
Step 5 – Check the Clearance Height
The smallest but nevertheless the most important part of the script checks the length of each designed polycurve (from Step 3) and adds the Safety Offset value (50 mm) to the result. The output is verified with the Minimal Clearance Height, indicated in the Input group. This results in list with “true” and “false” values which then will be used for filtering.
Step 6 – Creation of analysis samples in Revit
The polycurves, created in step 3 can now be used to create “Model Lines” in Revit, in order to visualize the possible problems with clearance heights. As the ModelCurve.ByCurve can not accept polycurves, we need to explode these in lines first. Graphically you can’t see any difference as the “unexploded” and the “exploded” version still show a two-point line. But the data type is different…
Optionally you change the style of the model lines, to have better representation and filtering capabilities in Revit. Therefore the Archi-lab / Grimshaw package offers the Get Line Style by Name node that loads a line style to Dynamo which is used to change the initially created line.
Step 7 – Visualization of the results
This last step will change the appearance of the lines created either in Dynamo either in Revit, depending on the Clearance Height requirements. If the length of the polycurve +50 mm, hence the real headroom, doesn’t meet the minimal clearance, then the line is colored in red, otherwise it is colored in green. This graphical result can help you to solve the problem with the surrounding elements and re-run the script to see the new results.
The Dynamo script and the Revit sample file (originally the rac_advanced_sample_project.rvt) can be downloaded here.