icon

[Frage] Issues with LibraryElements x Path2D in Allplan 2025 [Gelöst]

Schlagworte:
  • Allplan
  • 2025
  • PythonParts
  • LibraryElements
  • Path2D

Hi,

in Allplan 2024(and older), I used this code to extract profile geometry from a collection of library elements.

def make_profile_area_from_lib(path:str,name:str,
                                   type:AllplanBasisElements.LibraryElementType,
                                   placement_mat:AllplanGeo.Matrix3D,doc):
    """
    Erstellt Profil Polygon aus Bibliothekselement. Mit Polygonisierung.

    Args:
        path: Pfad zum Element
        name: Name des Elements
        type: Type des Elements
        placement_mat: Platzierungsmatrix
        doc: Documentadapter des aktuellen Dokuments

    Returns:
        Polygon3D
    """
    lib_ele_prop = AllplanBasisElements.LibraryElementProperties(path, "",name,type,placement_mat)
    be=AllplanBasisElements.LibraryElement(lib_ele_prop)
    path2d,poly3d=AllplanGeo.Path2D(),AllplanGeo.Polygon3D()
    for geo in be.GetGeometryElements(doc):  
        if isinstance(geo,AllplanGeo.Arc2D):
            err,poly=AllplanGeo.PolygonizeEqually(geo,geo.GetStartPoint(),geo.GetEndPoint(),3)
            path2d+=poly
        else:path2d+=geo
    err,path3d=AllplanGeo.ConvertTo3D(path2d)

In 2025 it`s not working anymore. In 2024, same code with same libraryelements is working fine.
Any ideas? Thank you.

Lösung anzeigen Lösung verbergen

Update:

It has to be something with the order of the element connection within the symbol. I was able to fix the issue by sorting and re-chaining all the lines and arcs to the correct order before adding them to a path2d.
Still weird. It doesn`t look like intented behavior when all my symbols have invalid orders and need to be redrawn or preprocessed with rather obscure sorting algorithms.I had no issues in past version changes.

Update 2:
More testing shows that the problem is the PolygonizeEqually function.It seems like something has changed there. I marked the problem as solved, but I would be happy for a comment on the issue. Do I have to change my usage of PolygonizeEqually (if yes,how?), or is there something wrong with the function?

Update:

It has to be something with the order of the element connection within the symbol. I was able to fix the issue by sorting and re-chaining all the lines and arcs to the correct order before adding them to a path2d.
Still weird. It doesn`t look like intented behavior when all my symbols have invalid orders and need to be redrawn or preprocessed with rather obscure sorting algorithms.I had no issues in past version changes.

Update 2:
More testing shows that the problem is the PolygonizeEqually function.It seems like something has changed there. I marked the problem as solved, but I would be happy for a comment on the issue. Do I have to change my usage of PolygonizeEqually (if yes,how?), or is there something wrong with the function?