StructuralFraming.BeamByCurve in Python Node

Hi All,

I get this error

TypeError: expected FamilyType, got FamilySymbol

if I try to use StructuralFraming.BeamByCurve inside a Python Node.

I’m using the same code inside th All Family Types Of Category (Clockwork)

Any Idea why?

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

import System

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

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

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

Curves=IN[0]
Lvl=IN[1]

cat=Revit.Elements.Category.ByName("OST_StructuralFraming")

Beams,OUT=[],[]

collector = FilteredElementCollector(doc).OfClass(FamilySymbol)
bic = System.Enum.ToObject(BuiltInCategory,cat.Id)
collector.OfCategory(bic)

Beams.append(collector.ToElements())

#OUT=Beams


for curve in Curves:
	beam=Revit.Elements.StructuralFraming.BeamByCurve(curve,Lvl,Beams[0][5])
	#beam=Revit.Elements.StructuralFraming.BeamByCurve(curve,Lvl,IN[2])
	OUT.append(beam)

You’re calling a method from Dynamo’s Revit wrapper class which expects a FamilyType (a wrapped Family Symbol). Try calling .ToDSType(True) on the FamilySymbol to wrap it and see if that works. I would also improve the FilteredElemsntCollector so it finds and returns the specific FamilySymbol, rather than indexing blindly since it’s likely to return an unreliable result if the order of objects change or if new types are added to the project.

1 Like

Thanks @Thomas_Mahon!