Retrieve Geometry of Autodesk.Revit.DB.PropertyLine

Hi,

I can´t find any method to retrieve the geometry of Autodesk.Revit.DB.PropertyLine after I collected the Revit elements via

PropertyLines_collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_SiteProperty).WhereElementIsNotElementType().

Any hint?

Assuming you’re in Python, what have you tried?

Does geo = [pl.get_Geometry(Options()) for pl in PropertyLines_collector] work?

2 Likes

Thanks Jacob. One solid step forwards. Yes, I´m in Python. I had tried this with the wrong syntax. Now I get a Autodesk.Revit.DB.GeometryElement, how to convert it to the constituent array of curve?

Look at what you can do with the element. Try OUT = dir(geo[0]) to see what you have for options.

that´s where I get stranded…I see no conversion method available

__subclasshook__

__str__

__sizeof__

__setattr__

__repr__

__reduce_ex__

__reduce__

__new__

__ne__

__iter__

__init__

__hash__

__getattribute__

__format__

__exit__

__eq__

__enter__

__doc__

__delattr__

__contains__

__class__

Visibility

ToString

ReleaseUnmanagedResources

ReleaseManagedResources

ReferenceEquals

MemberwiseClone

MaterialElement

IsReadOnly

IsElementGeometry

Id

GraphicsStyleId

GetType

GetTransformed

GetHashCode

GetEnumerator

GetBoundingBox

Equals

Dispose

Closest I thought was geo.GetType() but it returns Autodesk.Revit.DB.GeometryElement.

Is there a way to get the primitive geometry? I suppose it should be an array of curves

Hi

you need to iterate on the GeometryElement

There are some examples in the forum

https://forum.dynamobim.com/search?q=get_Geometry%20%40c.poupin

2 Likes

indeed! iterating a RevitElement makes the RevitObject available so that the geometry can be extracted as a primitive (in my case, with Rhino.Inside). Thanks a lot!

Below the correct code

PropertyLines_collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_SiteProperty).WhereElementIsNotElementType()

if PropertyLines_collector.GetElementCount() == 0:
        msg = "MISSING ! at least one PropertyLine is needed"
        show_error(msg)
else:
        for propLine in PropertyLines_collector:
            propLine_element = propLine.get_Geometry(Options())
            lines = []
            #iterate to resolve the enumerable RevitElement into RevitObject
            for propLine in propLine_element:
                #get the RevitObject geometry
                lines.append(GeometryDecoder.ToCurve(propLine))