Autodesk.Revit.DB.Line to curves

Is there a way to get the curves from Autodesk.Revit.DB.Line output?

There will be ways, and sometimes a curve can read a line anyway.

What have you tried?
Where has the line come from?
Is this in python and where are you up to?
Have you tried the out of the box nodes that get geometry from a Revit element?
Why do you need a curve?

Yes so I have this in python:

analytical = host.GetAnalyticalModel()
curveArray = analytical.GetCurves(AnalyticalCurveType.ActiveCurves)

and I output curveArray hoping for some useful lines/curves but my output is this:


but I was hoping for something like: Line(Startpoint = Point(X = and so on…)
Or some curves or points or something

A Line is a Curve. Curve is an abstract class inherited by all ‘curve’ types - abstract classes cant be instantiated directly while we’re on the subject, but its a non-issue thanks to polymorphism!

Also, you seem to be indicating you want a ProtoGeometry Curve (ProtoGeometry.Line) rather than a Revit API Line (and you can thank Dynamo for confusing the #!$% out what a ‘curve’ is); for that you can call ToProtoType() on your Line, e.g. myLine.ToProtoType()

1 Like

I would follow what Thomas has indicated to convert it to a curve, and output that out of python instead.

1 Like