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.
1 Like
@Patton , hi
The path i would get by investigating your geometry in a clever
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
You’re missing import Autodesk library. Add the below line after “clr.AddReference(‘RevitAPI’)”
import Autodesk
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
You should connect only one “Element of Type” which you want from the names list. Currently you’re connecting Names list.
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
How can you get the node without any error? Can you share your node?
I still get an error.