How to check railing in the stair

Good day everyone,
I have the same problem like this tread, Get geometry of stair path

My goal is to create railing according to the stair path, but I need to get the stair path first (like floor boundary line), then after that I will create the railing according to the path. It’s like to check whether the railing is already installed on the stair or not. if not, then I will install the railing, if already installed, then the output will be true or something else. Does anyone knows how the approach?
image

thank you

you can use this:

import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

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

doc = DocumentManager.Instance.CurrentDBDocument
view = doc.ActiveView

toList = lambda x : x if hasattr(x, '__iter__') else [x]

stairs = toList(UnwrapElement(IN[0]))
railtype = UnwrapElement(IN[1])

TransactionManager.Instance.EnsureInTransaction(doc)

for s in stairs:
	rail_id = s.GetAssociatedRailings()
	if len(rail_id) == 0:
		Architecture.Railing.Create(doc,s.Id,railtype[0].Id,0)

TransactionManager.Instance.TransactionTaskDone()

OUT = 1
1 Like

actually, that is what I want as my goal. But, how to get the stair path like the blue line
image