How to extract Stair runs and landings from Stair Object using Dynamo?

Hi all,

I want to be able to find the corresponding runs and landings for a Stair object and take the property data from the Stair object and copy to the runs and landings. The latter part I think will be a simple GetParameter SetParameter exercise. However I can’t seem to find a way to find the runs and landings? :confused:

Hey,

Try this?

#thanks to paul wintour

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

stair = UnwrapElement(IN[0])

runs = []
landings = []
runids = stair.GetStairsRuns()
landingids = stair.GetStairsLandings()
for run in runids:
	runs.append(doc.GetElement(run))
for landing in landingids:
	landings.append(doc.GetElement(landing))

OUT =  runs, landings

image

Hope that helps,

Mark

That does it! Thanks.

Great :slight_smile: slightly improved…

#thanks to paul wintour

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

stairs = IN[0]

def isInstance(check):
	if isinstance(check, (list)): return check
	else: return [check]

def getRunsLandings(stair):
	runs = []
	landings = []
	stair = isInstance(stair)
	stair = UnwrapElement(stair)
	for s in stair:
		runids = s.GetStairsRuns()
		landingids = s.GetStairsLandings()
		for run in runids:
			runs.append(doc.GetElement(run))
		for landing in landingids:
			landings.append(doc.GetElement(landing))
		staircomps = [runs + landings]
		return staircomps

OUT = getRunsLandings(stairs)
3 Likes

Thank Mark for the script

I run it on Multistorey Stairs, seem like it is only getting the first level stair run…
is it only work on continuous stair ?

image
image

Multistory stairs are a different breed than normal stairs. Basically it is just a single set of runs/landings and then copied along the levels, so you will only get a single set when trying to get them this way.

You should read through this post, it should have the information you want:

3 Likes

Thanks Kenny

Yep that is correct. I spent endless amounts of time trying to get to the bottom of this. With the help of @kennyb6 we got pretty close but it is a major limitation of the Revit API. To get all the landings you would need to do it geometrically.

Feel free to vote up the idea though: https://forums.autodesk.com/t5/revit-ideas/get-subelements-of-multistory-stair/idi-p/8431553

3 Likes

This doesn’t work for list of stair
Can you improve this script so it can handle stair list ?

1 Like

Hi Mark, Azbaz, Paul originally…

Works a charm, but I guess only for selecting one stair at a time? (sorry just saw this is a question above me…also when I run it I only get back StairsRun, no landings.)

Is it a slight tweak to allow it to work with Select Model Elements? I’m selecting 3 stairs and one 1 StairsRun is returned.