Convert Revit.DB.Line to Dynamo curve

Hi Everyone!

I’m trying to get the stairs path line on Dynamo. But, I can’t use the “ToProtoType()” attribute on Revit.DB.Line
Can someone help me?

Has resolved in topic.
How convert the line to a curve - Revit - Dynamo (dynamobim.com)

Hello,
an instance of CurveLoop is a IEnumerable<Curve> so, you need to iterate on it to convert curves are inside this collection

import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

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

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

elem = UnwrapElement(IN[0])
elemsStair = [doc.GetElement(x) for x in  elem.GetStairsRuns()]
stairPathCurvLoop = elemsStair[0].GetStairsPath()

OUT = [x.ToProtoType() for x in stairPathCurvLoop]

1 Like