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?
#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
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:
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.
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.