topologicpy.CellComplex module
- class topologicpy.CellComplex.CellComplex
Bases:
objectMethods
Box([origin, width, length, height, uSides, ...])Creates a box with internal cells.
ByCells(cells[, transferDictionaries, ...])Creates a CellComplex by assembling the input Cells.
ByCellsCluster(cluster[, ...])Creates a cellcomplex by merging the cells within the input cluster.
ByDisjointedFaces(faces[, minOffset, ...])Creates a CellComplex from a list of disjointed faces.
ByFaces(faces[, transferDictionaries, ...])Creates a CellComplex from the input Faces while preserving their exact geometry.
ByFacesCluster(cluster[, ...])Creates a cellcomplex by merging the faces within the input cluster.
ByWires(wires[, triangulate, tolerance, ...])Creates a CellComplex by lofting through the input Wires.
ByWiresCluster(cluster[, triangulate, ...])Creates a CellComplex by lofting through Wires in the input Cluster.
Cells(cellComplex)Returns the cells of the input cellComplex.
Cube([origin, size, uSides, vSides, wSides, ...])Creates a cube with internal cells.
Decompose(cellComplex[, tiltAngle, ...])Decomposes the input cellComplex into its logical components.
Delaunay([vertices, tolerance])Triangulates the input vertices based on the Delaunay method.
Edges(cellComplex[, silent])Returns the edges of the input cellComplex.
ExternalBoundary(cellComplex[, silent])Returns the external boundary (shell) of the input cellComplex.
ExternalFaces(cellComplex)Returns the external faces of the input cellComplex.
Faces(cellComplex)Returns the faces of the input cellComplex.
InternalFaces(cellComplex)Returns the internal boundaries (faces) of the input cellComplex.
NonManifoldFaces(cellComplex)Returns the non-manifold faces of the input cellComplex.
Octahedron([origin, radius, direction, ...])Creates an octahedral CellComplex consisting of two Cells separated by the equatorial Face.
Prism([origin, width, length, height, ...])Creates a prismatic cellComplex with internal cells.
RemoveCollinearEdges(cellComplex[, ...])Removes any collinear edges in the input cellComplex.
Shells(cellComplex)Returns the shells of the input cellComplex.
Tetrahedron([origin, length, depth, ...])Creates a recursively subdivided regular tetrahedral CellComplex.
Torus([origin, majorRadius, minorRadius, ...])Creates a toroidal CellComplex.
Vertices(cellComplex)Returns the vertices of the input cellComplex.
Volume(cellComplex[, mantissa, silent])Returns the total volume of the input CellComplex.
Voronoi([vertices, cell, tolerance])Partitions the input cell based on the Voronoi method.
Wires(cellComplex)Returns the wires of the input cellComplex.
- static Box(origin=None, width: float = 1.0, length: float = 1.0, height: float = 1.0, uSides: int = 2, vSides: int = 2, wSides: int = 2, direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001)
Creates a box with internal cells.
- Parameters
- origintopologic_core.Vertex , optional
The origin location of the box. Default is None which results in the box being placed at (0, 0, 0).
- widthfloat , optional
The width of the box. Default is 1.
- lengthfloat , optional
The length of the box. Default is 1.
- heightfloat , optional
The height of the box.
- uSidesint , optional
The number of sides along the width. Default is 1.
- vSidesint, optional
The number of sides along the length. Default is 1.
- wSidesint , optional
The number of sides along the height. Default is 1.
- directionlist , optional
The vector representing the up direction of the box. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the box. This can be “bottom”, “center”, or “lowerleft”. It is case insensitive. Default is “center”.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.CellComplex
The created box.
- static ByCells(cells: list, transferDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a CellComplex by assembling the input Cells.
The active backend is asked to construct the CellComplex directly from the input Cells. The input Cells are converted to Faces only as a compatibility fallback for backends that do not expose a native
CellComplex.ByCellsconstructor.- Parameters
- cellslist
The input list of Cells.
- transferDictionariesbool, optional
If True, dictionaries from the source Cells are transferred to the corresponding Cells in the result. Default is False.
- tolerancefloat, optional
The desired tolerance. Default is 0.0001.
- silentbool, optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.CellComplex
The created CellComplex, or None on failure.
- static ByCellsCluster(cluster, transferDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a cellcomplex by merging the cells within the input cluster.
- Parameters
- clustertopologic_core.Cluster
The input cluster of cells.
- transferDictionariesbool , optional
If set to True, any dictionaries in the faces are transferred to the faces of the created CellComplex. Otherwise, they are not. Default is False.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.CellComplex
The created cellcomplex.
- static ByDisjointedFaces(faces: list, minOffset: float = 0, maxOffset: float = 1.0, minCells: float = 2, maxCells: float = 10, maxAttempts: int = 100, patience: int = 5, transferDictionaries: bool = False, exclusive: bool = True, tolerance: float = 0.0001, silent: bool = False)
Creates a CellComplex from a list of disjointed faces. The algorithm expands the faces by an offset to find intersections before building cells.
- Parameters
- faceslist of topologic_core.Face
The linput ist of faces.
- minOffsetfloat , optional
The minimum initial face offset to try. Default is 0.
- maxOffsetfloat , optional
The final maximum face offset to try. Default is 1.0.
- minCellsint , optional
The minimum number of cells to create. A CellComplex cannot have less than 2 cells. Default is 2.
- maxCellsint , optional
The maximum number of cells to create. Default is 10.
- maxAttemptsint , optional
The desired maximum number of attempts. Default is 100.
- patienceint , optional
The desired number of attempts to wait with no change in the created number of cells. Default is 5.
- transferDictionariesbool , optional
If set to True, face dictionaries are inhertied. Default is False.
- exclusivebool , optional
Applies only if transferDictionaries is set to True. If set to True, only one source face contributes its dictionary to a target face. Default is True.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.CellComplex
The created CellComplex
- static ByFaces(faces, transferDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a CellComplex from the input Faces while preserving their exact geometry.
The method first attempts to assemble the original Faces directly using the active backend. No preprocessing, polygonisation, triangulation, or vertex-based reconstruction is performed.
If direct assembly fails, overlapping coplanar planar Faces are resolved using native topology Boolean operations. Curved boundaries are therefore retained as curves, and non-planar analytic/B-Spline/NURBS Faces are passed through unchanged.
- Parameters
- faceslist
The input list of Faces.
- transferDictionariesbool , optional
If True, dictionaries from the source Faces are transferred to the corresponding Faces of the resulting CellComplex. Default is False.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.CellComplex
The created CellComplex, or None if construction fails.
- static ByFacesCluster(cluster, transferDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a cellcomplex by merging the faces within the input cluster.
- Parameters
- clustertopologic_core.Cluster
The input cluster of faces.
- transferDictionariesbool , optional
If set to True, any dictionaries in the faces are transferred to the faces of the created CellComplex. Otherwise, they are not. Default is False.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.CellComplex
The created cellcomplex.
- static ByWires(wires: list, triangulate: bool = True, tolerance: float = 0.0001, polyhedron: bool = True, silent: bool = False)
Creates a CellComplex by lofting through the input Wires.
When
polyhedronis True, the existing faceted construction is used. Whenpolyhedronis False, the section curves are preserved and each interval is constructed natively by the PythonOCC backend.- Parameters
- wireslist
The ordered input list of Wires. A minimum of two valid Wires is required.
- triangulatebool , optional
If
polyhedronis True, specifies whether generated Faces are triangulated. Default is True.- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- polyhedronbool , optional
If True, uses the historical faceted construction. If False, requests an exact curve-preserving PythonOCC CellComplex. Default is True.
- silentbool , optional
If True, suppresses error and warning messages. Default is False.
- Returns
- topologic_core.CellComplex
The created CellComplex, or None on failure.
- static ByWiresCluster(cluster, triangulate: bool = True, tolerance: float = 0.0001, polyhedron: bool = True, silent: bool = False)
Creates a CellComplex by lofting through Wires in the input Cluster.
- static Cells(cellComplex) list
Returns the cells of the input cellComplex.
- Parameters
- cellComplextopologic_core.CellComplex
The input cellComplex.
- Returns
- list
The list of cells.
- static Cube(origin=None, size: float = 1.0, uSides: int = 2, vSides: int = 2, wSides: int = 2, direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001)
Creates a cube with internal cells.
- Parameters
- origintopologic_core.Vertex , optional
The origin location of the cube. Default is None which results in the cube being placed at (0, 0, 0).
- sizefloat , optional
The size of the cube. Default is 1.
- uSidesint , optional
The number of sides along the width. Default is 1.
- vSidesint, optional
The number of sides along the length. Default is 1.
- wSidesint , optional
The number of sides along the height. Default is 1.
- directionlist , optional
The vector representing the up direction of the cube. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the cube. This can be “bottom”, “center”, or “lowerleft”. It is case insensitive. Default is “center”.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.CellComplex
The created cube.
- static Decompose(cellComplex, tiltAngle: float = 10.0, tolerance: float = 0.0001, silent: bool = False) dict
Decomposes the input cellComplex into its logical components. This method assumes that the positive Z direction is UP.
- Parameters
- cellComplextopologic_core.CellComplex
the input cellComplex.
- tiltAnglefloat , optional
The threshold tilt angle in degrees to determine if a face is vertical, horizontal, or tilted. The tilt angle is measured from the nearest cardinal direction. Default is 10.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- dictionary
A dictionary with the following keys and values: 1. “cells”: list of cells 2. “externalVerticalFaces”: list of external vertical faces 3. “internalVerticalFaces”: list of internal vertical faces 4. “topHorizontalFaces”: list of top horizontal faces 5. “bottomHorizontalFaces”: list of bottom horizontal faces 6. “internalHorizontalFaces”: list of internal horizontal faces 7. “externalInclinedFaces”: list of external inclined faces 8. “internalInclinedFaces”: list of internal inclined faces 9. “externalVerticalApertures”: list of external vertical apertures 10. “internalVerticalApertures”: list of internal vertical apertures 11. “topHorizontalApertures”: list of top horizontal apertures 12. “bottomHorizontalApertures”: list of bottom horizontal apertures 13. “internalHorizontalApertures”: list of internal horizontal apertures 14. “externalInclinedApertures”: list of external inclined apertures 15. “internalInclinedApertures”: list of internal inclined apertures
- static Delaunay(vertices: list = None, tolerance: float = 0.0001)
Triangulates the input vertices based on the Delaunay method. See https://en.wikipedia.org/wiki/Delaunay_triangulation.
- Parameters
- vertices: list , optional
The input list of vertices to use for delaunay triangulation. If set to None, the algorithm uses the vertices of the input cell parameter. if both are set to none, a unit cube centered around the origin is used.
- tolerancefloat , optional
the desired tolerance. Default is 0.0001.
- Returns
- topologic_core.CellComplex
The created delaunay cellComplex.
- static Edges(cellComplex, silent: bool = False) list
Returns the edges of the input cellComplex.
- Parameters
- cellComplextopologic_core.CellComplex
The input cellComplex.
- silent: bool , optional
if set to True, no error or warning messages are printed. Default is False.
- Returns
- list
The list of edges.
- static ExternalBoundary(cellComplex, silent: bool = False)
Returns the external boundary (shell) of the input cellComplex.
- Parameters
- cellComplextopologic_core.CellComplex
The input cellComplex.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Cell
The external boundary of the input cellComplex.
- static ExternalFaces(cellComplex) list
Returns the external faces of the input cellComplex.
- Parameters
- cellComplextopologic_core.CellComplex
The input cellComplex.
- Returns
- list
The list of external faces.
- static Faces(cellComplex) list
Returns the faces of the input cellComplex.
- Parameters
- cellComplextopologic_core.CellComplex
The input cellComplex.
- Returns
- list
The list of faces.
- static InternalFaces(cellComplex) list
Returns the internal boundaries (faces) of the input cellComplex.
- Parameters
- cellComplextopologic_core.CellComplex
The input cellComplex.
- Returns
- list
The list of internal faces of the input cellComplex.
- static NonManifoldFaces(cellComplex) list
Returns the non-manifold faces of the input cellComplex.
- Parameters
- cellComplextopologic_core.CellComplex
The input cellComplex.
- Returns
- list
The list of non-manifold faces of the input cellComplex.
- static Octahedron(origin=None, radius: float = 0.5, direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001, silent: bool = False)
Creates an octahedral CellComplex consisting of two Cells separated by the equatorial Face.
- static Prism(origin=None, width: float = 1.0, length: float = 1.0, height: float = 1.0, uSides: int = 2, vSides: int = 2, wSides: int = 2, direction: list = [0, 0, 1], placement: str = 'center', mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Creates a prismatic cellComplex with internal cells.
- Parameters
- origintopologic_core.Vertex , optional
The origin location of the prism. Default is None which results in the prism being placed at (0, 0, 0).
- widthfloat , optional
The width of the prism. Default is 1.
- lengthfloat , optional
The length of the prism. Default is 1.
- heightfloat , optional
The height of the prism.
- uSidesint , optional
The number of sides along the width. Default is 1.
- vSidesint , optional
The number of sides along the length. Default is 1.
- wSidesint , optional
The number of sides along the height. Default is 1.
- directionlist , optional
The vector representing the up direction of the prism. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the prism. This can be “bottom”, “center”, or “lowerleft”. It is case insensitive. Default is “center”.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.CellComplex
The created prism.
- static RemoveCollinearEdges(cellComplex, angTolerance: float = 0.1, tolerance: float = 0.0001, silent: bool = True)
Removes any collinear edges in the input cellComplex.
- Parameters
- cellComplextopologic_core.CellComplex
The input cellComplex.
- angTolerancefloat , optional
The desired angular tolerance. Default is 0.1.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is True.
- Returns
- topologic_core.CellComplex
The created cellComplex without any collinear edges.
- static Shells(cellComplex) list
Returns the shells of the input cellComplex.
- Parameters
- cellComplextopologic_core.CellComplex
The input cellComplex.
- Returns
- list
The list of shells.
- static Tetrahedron(origin=None, length: float = 1, depth: int = 1, direction: list = [0, 0, 1], placement: str = 'center', mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Creates a recursively subdivided regular tetrahedral CellComplex.
Each subdivision level partitions every tetrahedron into eight smaller tetrahedra. The four corner tetrahedra and the four tetrahedra obtained by splitting the central midpoint octahedron exactly fill the parent tetrahedron without overlaps or voids.
- static Torus(origin=None, majorRadius: float = 0.5, minorRadius: float = 0.125, uSides: int = 16, vSides: int = 8, direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001, silent: bool = False, polyhedron: bool = True)
Creates a toroidal CellComplex.
polyhedron=Truepreserves the existing faceted v0.9.68 constructionpolyhedron=Falsecreates exact OCCT toroidal sectors on PythonOCC
- static Vertices(cellComplex) list
Returns the vertices of the input cellComplex.
- Parameters
- cellComplextopologic_core.CellComplex
The input cellComplex.
- Returns
- list
The list of vertices.
- static Volume(cellComplex, mantissa: int = 6, silent: bool = False) float
Returns the total volume of the input CellComplex.
- static Voronoi(vertices: list = None, cell=None, tolerance: float = 0.0001)
Partitions the input cell based on the Voronoi method. See https://en.wikipedia.org/wiki/Voronoi_diagram.
- Parameters
- vertices: list , optional
The input list of vertices to use for voronoi partitioning. If set to None, the algorithm uses the vertices of the input cell parameter. if both are set to none, a unit cube centered around the origin is used.
- celltopologic_core.Cell , optional
The input bounding cell. If set to None, an axes-aligned bounding cell is created from the list of vertices. Default is None.
- tolerancefloat , optional
the desired tolerance. Default is 0.0001.
- Returns
- topologic_core.CellComplex
The created voronoi cellComplex.
- static Wires(cellComplex) list
Returns the wires of the input cellComplex.
- Parameters
- cellComplextopologic_core.CellComplex
The input cellComplex.
- Returns
- list
The list of wires.