How to create the railing not in all of the floors

Hello,
I would like to ask about how to create railing in the opening element such as floor. I have tried [Railings- Auto place by selecting surface] the node, but it will create in all of the floors, in every rooms. I want to make the railing as a protector, so the railing will be created if there is no wall in all of the edges or there are in the two sides but no in the other two sides.
image

1 Like


@Patton , hi

The path i would get by investigating your geometry in a clever :wink:

2022-06-30_17h14_29

2.) part works partly

import clr

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

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

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

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

doc = DocumentManager.Instance.CurrentDBDocument
railType = UnwrapElement(IN[0])
curves = IN[1]
level = UnwrapElement(IN[2])

TransactionManager.Instance.EnsureInTransaction(doc)
revitCurves=[]
for curve in curves:
	revitCurves.append(curve.ToRevitType())

curveloop = CurveLoop.Create(revitCurves)

Autodesk.Revit.DB.Architecture.Railing.Create(doc,curveloop, railType.Id,level.Id)

TransactionManager.Instance.TransactionTaskDone()

code has error :confused:


2022-06-30_17h34_35

You’re missing import Autodesk library. Add the below line after “clr.AddReference(‘RevitAPI’)”
import Autodesk

2022-06-30_17h44_52

so whats going on here? @Kulkul

That’s because you have wrong input type at IN[0]. Railing is System Family. Use the below method to feed Railing Type:

1 Like

i can just get placed railing types… and a new error occure!

You should connect only one “Element of Type” which you want from the names list. Currently you’re connecting Names list.


it remains @Kulkul
RailingPath_V01.dyn (42.1 KB)

Thank you for your help. But I still can not make the railing also.


The end of my node is null

1 Like

Looks like you didn’t follow my instructions. Here is the graphical explanation:

import sys
import clr

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

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

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

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

doc = DocumentManager.Instance.CurrentDBDocument
railType = UnwrapElement(IN[0])
curves = IN[1]
level = UnwrapElement(IN[2])

TransactionManager.Instance.EnsureInTransaction(doc)
revitCurves=[]
for curve in curves:
	revitCurves.append(curve.ToRevitType())

curveloop = CurveLoop.Create(revitCurves)

railing = Autodesk.Revit.DB.Architecture.Railing.Create(doc,curveloop,railType.Id,level.Id)

TransactionManager.Instance.TransactionTaskDone()
OUT = railing
1 Like

Hi @Patton

Possible to share relevant rvt and dyn file?

ImportCAD_20222905.rvt (6.8 MB)
Railing 2.dyn (44.4 KB)

I tried to use dyn above. please check it

How can you get the node without any error? Can you share your node?
I still get an error.