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


#1

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:


#2

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


#3

That does it! Thanks.


#4

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)

#5

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 ?



#6

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:


#7

Thanks Kenny


#8

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