Skip to content

PolyhedronUtil

Canonical path: NemAll_Python_Geometry.PolyhedronUtil

Polyhedron utilities

CalcMatrix2GroundView staticmethod

CalcMatrix2GroundView(
    inputPolyhedron: Polyhedron3D, faceIndex: int
) -> tuple[eGeometryErrorCode, Matrix3D]

Calculates the 3DMatrix that is neccessary to project the Face of a polyhedron onto a groundview. It considers the orientation of the normalvector. so the bottom face of a cuboid has different matrix then the top face (turnd 180) Function is token from old Allplan classic Geomatry calculations

Parameters:

  • inputPolyhedron (Polyhedron3D) –

    The Polyhedron with the requested face

  • faceIndex (int) –

    The faceindex we that has to be projected into Groundview

Returns:

  • tuple[eGeometryErrorCode, Matrix3D]

    tuple(Ok or Error, The resul tmatrix. Calc the coords of the poyhedron with that matrix and you get the projection to groundview so that the requested face is complanar to Ground view)

GetFacePoints staticmethod

GetFacePoints(
    elem: Polyhedron3D, face: PolyhedronFace
) -> tuple[bool, VecSizeTList, Point3DList]

Get the points of a polyhedron face

Parameters:

Returns:

GetFootprint staticmethod

GetFootprint(polyhedron: Polyhedron3D) -> Polygon2D

Get footprint of polyhedron

Parameters:

Returns:

GetNextEdge overloaded

GetNextEdge(
    elem: Polyhedron3D, face: PolyhedronFace
) -> tuple[bool, VecSizeTList, Point3DList]

Get the next connected edge

Parameters:

Returns:

  • tuple[bool, VecSizeTList, Point3DList]

    tuple(true if returned values are valid, Vertices of the already added faces points, Already added faces points)

GetNextEdge(
    elem: Polyhedron3D, edges: GeometryEdgeList, verticeHandle: int
) -> tuple[bool, VecSizeTList, Point3DList]

Get the last connected edge

Parameters:

  • elem (Polyhedron3D) –

    Get the vertices for a face of this polyhedron

  • edges (GeometryEdgeList) –

    All edges from the given polyhedron

  • verticeHandle (int) –

    Vertice index of the last added point

Returns:

  • tuple[bool, VecSizeTList, Point3DList]

    tuple(true if returned values are valid, Vertices of the already added faces points, Already added polyhedron points)

MergePlanarFaces staticmethod

MergePlanarFaces(polyhedron: Polyhedron3D)

Merge planar faces

Parameters:

ReorderPolyhedronFaces overloaded

ReorderPolyhedronFaces(
    polyhedron: Polyhedron3D, bottomPlane: Plane3D, topPlane: Plane3D
)

Reorder polyhedron faces according to planes.

Reorders given polyhedron faces according to planes. The face laying in bottomPlane goes first and face laying in topPlane goes second. Order of other faces is not guaranteed.

Old interface: normalizeArchitectural3d

Parameters:

ReorderPolyhedronFaces(polyhedron: Polyhedron3D, direction: Vector3D)

Reorder polyhedron faces according to direction.

Reorders given polyhedron faces according to given direction. The face with normal most similar to the direction goes first and face with normal most opposite to the direction goes second. Order of other faces is not guaranteed.

Parameters:

  • polyhedron (Polyhedron3D) –

    Polyhedron.

  • direction (Vector3D) –

    Direction vector for face ordering.

RepairFaceNormals staticmethod

RepairFaceNormals(
    polyhedron: Polyhedron3D,
) -> tuple[eGeometryErrorCode, Polyhedron3D, bool]

Create solid polyhedron from closed sheet or void

Parameters:

Returns:

RepairPolyhedron staticmethod

RepairPolyhedron(
    polyhedron: Polyhedron3D,
) -> tuple[bool, bool, bool, eGeometryErrorCode, Polyhedron3D]

Repair a polyhedron

Parameters:

Returns:

RepairPolyhedronCrossLoopFaces staticmethod

RepairPolyhedronCrossLoopFaces(polyhedron: Polyhedron3D) -> eGeometryErrorCode

Repair cross loop (8-shaped) faces in polyhedron

Parameters:

Returns:

SimplifyPolyhedron staticmethod

SimplifyPolyhedron(polyhedron: Polyhedron3D) -> bool

Simplify polyhedron

Parameters:

Returns:

  • bool

    true if simplification is successful

SplitFacesAtEdges staticmethod

SplitFacesAtEdges(
    polyhedron: Polyhedron3D,
) -> tuple[eGeometryErrorCode, Polyhedron3D, bool]

Split faces at edges from another faces

Parameters:

Returns:

SplitNonPlanarFaces staticmethod

SplitNonPlanarFaces(
    polyhedron: Polyhedron3D, mergePlanarFaces: bool = True
) -> bool

Split non-planar faces

Parameters:

  • polyhedron (Polyhedron3D) –

    Polyhedron to modify

  • mergePlanarFaces (bool, default: True ) –

    Flag whether planar faces should be merged

Returns:

  • bool

    true if polyhedron modified

TryToNormalizePolyhedron staticmethod

TryToNormalizePolyhedron(polyhedron: Polyhedron3D) -> tuple[bool, Polyhedron3D]

Try to normalize polyhedron

Parameters:

Returns:

  • tuple[bool, Polyhedron3D]

    nullopt if the polyhedron is valid(already normalized) or not possible to normalize, otherwise it returns normalized polyhedron

Placeholder