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:
-
elem
(Polyhedron3D
) –Get the points from this polyhedron
-
face
(PolyhedronFace
) –Get the points from this face
Returns:
-
tuple[bool, VecSizeTList, Point3DList]
–tuple(true, if the extraction went well, Vertices of the faces points, Resulting points)
GetFootprint
staticmethod
GetFootprint(polyhedron: Polyhedron3D) -> Polygon2D
Get footprint of polyhedron
Parameters:
-
polyhedron
(Polyhedron3D
) –Polyhedron
Returns:
-
Polygon2D
–Footprint polygon
GetNextEdge
overloaded
GetNextEdge(
elem: Polyhedron3D, face: PolyhedronFace
) -> tuple[bool, VecSizeTList, Point3DList]
Get the next connected edge
Parameters:
-
elem
(Polyhedron3D
) –Get the vertices for a face of this polyhedron
-
face
(PolyhedronFace
) –Get the vertices of this face
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)
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:
-
polyhedron
(Polyhedron3D
) –Polyhedron.
-
bottomPlane
(Plane3D
) –Bottom plane.
-
topPlane
(Plane3D
) –Top plane.
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:
-
polyhedron
(Polyhedron3D
) –Polyhedron
Returns:
-
tuple[eGeometryErrorCode, Polyhedron3D, bool]
–tuple(Error code, Polyhedron, Flag whether polyhedron was changed)
RepairPolyhedron
staticmethod
RepairPolyhedron(
polyhedron: Polyhedron3D,
) -> tuple[bool, bool, bool, eGeometryErrorCode, Polyhedron3D]
Repair a polyhedron
Parameters:
-
polyhedron
(Polyhedron3D
) –Polyhedron
Returns:
-
tuple[bool, bool, bool, eGeometryErrorCode, Polyhedron3D]
–tuple(cross loop changed, split faces at edged changed, normals changed, geometry error code, Polyhedron)
RepairPolyhedronCrossLoopFaces
staticmethod
RepairPolyhedronCrossLoopFaces(polyhedron: Polyhedron3D) -> eGeometryErrorCode
Repair cross loop (8-shaped) faces in polyhedron
Parameters:
-
polyhedron
(Polyhedron3D
) –Polyhedron
Returns:
-
eGeometryErrorCode
–Error code
SimplifyPolyhedron
staticmethod
SimplifyPolyhedron(polyhedron: Polyhedron3D) -> bool
Simplify polyhedron
Parameters:
-
polyhedron
(Polyhedron3D
) –Polyhedron to simplify
Returns:
-
bool
–true if simplification is successful
SplitFacesAtEdges
staticmethod
SplitFacesAtEdges(
polyhedron: Polyhedron3D,
) -> tuple[eGeometryErrorCode, Polyhedron3D, bool]
Split faces at edges from another faces
Parameters:
-
polyhedron
(Polyhedron3D
) –Polyhedron to modify
Returns:
-
tuple[eGeometryErrorCode, Polyhedron3D, bool]
–tuple(Error code, Polyhedron to modify, Flag whether polyhedron was changed)
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:
-
polyhedron
(Polyhedron3D
) –Polyhedron
Returns:
-
tuple[bool, Polyhedron3D]
–nullopt if the polyhedron is valid(already normalized) or not possible to normalize, otherwise it returns normalized polyhedron