I used StructuralFaming.BeamByCurve Nodes in Dynamo (Revit 2024) to Create the structuralFramingType that is line based. But now I wanna create it by Pyhon Codes(using Python Script Nodes in Dynamo) with Coordinates xyz. So First, I create Lines with Start Points and End Points and so the follow Steps corresponding to Codes Below. But when I run it. The Output Result is ‘EmptyList’. Plz help me. In StructuralFraming.BeamByCurve, there are Three inputs that are curve, level, structuralFramingType. However what I want is ‘curve’ input is replaced by Coords xyz that I said before. Level is fixed that named ‘1F’ and structuralFramingType is variable thing so I wanna find the correct familyInstance and use it that already loaded in Revit Project.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
# 입력값 가져오기
StartPoints = IN[0]
EndPoints = IN[1]
# Level 가져오기 (1F로 고정)
level = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels).WhereElementIsElementType().FirstElement()
# Enable to Get Information about Loaded Family Data in the Revit Project
collector = FilteredElementCollector(doc)
collector.OfCategory(BuiltInCategory.OST_StructuralFraming)
familyTypes = collector.OfClass(FamilySymbol).ToElements()
# Transaction 시작
TransactionManager.Instance.EnsureInTransaction(doc)
# Beam 생성
# Create foundationInstances of Pillar Foundation
# FamilySymbol 가져오기 (원하는 FamilyName 및 FamilyType으로 필터링)
Framing_Name = "PSC_거더_표준패밀리_NonRadius"
Framing_Type = "PSC_거더_표준패밀리_NonRadius"
beams = []
for typ in familyTypes:
typeName = typ.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM).AsString()
# Check if family matches with the given Name and Type.
if typ.Family.Name == Framing_Name and typeName == Framing_Type:
if typ.IsActive == False:
typ.Activate()
doc.Regenerate()
for i in range(len(StartPoints)):
# Dynamo 점을 XYZ 형식으로 변환
start_point_xyz = XYZ(StartPoints[i].X, StartPoints[i].Y, StartPoints[i].Z)
end_point_xyz = XYZ(EndPoints[i].X, EndPoints[i].Y, EndPoints[i].Z)
# Line 요소 생성
line = Line.CreateBound(start_point_xyz, end_point_xyz)
structuralType = Structure.StructuralType.Structural
# StructuralFraming.BeamByCurve 메서드를 사용하여 Beam 생성
beam = StructuralFraming.BeamByCurve(doc, line, familyTypes, level)
beams.append(beam)
# Transaction 종료
TransactionManager.Instance.TransactionTaskDone()
# 결과 출력 (선택 사항)
OUT = beams