Hi
I use Revit Node library to create new Elements.
I push: Line, Level and FamilyType but Dynamo Python show Error
But the same arguments and create by Dynamo Node work fine.
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('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
p1 = XYZ()
p2 = XYZ(2,0,0)
line = Line.CreateBound(p1,p2).ToProtoType()
#get familytype
ftype = Revit.Elements.FamilyType.ByFamilyNameAndTypeName("UB-Universal Beams","UB305x165x40")
#get level
Alllevel = FilteredElementCollector(doc).OfClass(Level).WhereElementIsNotElementType().ToElements()
level = Alllevel[1]
#OUT = line,level,ftype
#Create beam
beam = Revit.Elements.StructuralFraming.BeamByCurve(line,level,ftype)
OUT = beam
ExpectedLevel.dyn (16.0 KB)