How to get the sub component of List of stairs

I found the python script in this forum but it works only for single stair.
Can anyone who good at python can suggest how to modify the script so it works for list of stair?
or any simple package recommended to do this task.

Can you paste the actual code rather than a screen grab?

import clr
from Autodesk.Revit.DB import *

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:
for landing in landingids:
staircomps = [runs + landings]
return staircomps

OUT = map(getRunsLandings(stairs))

above is the actual code.

Hello @netinaiV49EE,

You can change the last line of code here to use a List Comprehension to get the result you are after :slight_smile:

This is basically running a For Loop inside a single line.

OUT = [getRunsLandings(stair) for stair in stairs]

Great, It works Thanks !!

1 Like