topologicpy.CellComplex module

class topologicpy.CellComplex.CellComplex

Bases: object

Methods

Box([origin, width, length, height, uSides, ...])

Creates a box with internal cells.

ByCells(cells[, transferDictionaries, ...])

Creates a cellcomplex by merging 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 after using Shapely to remove coplanar face overlaps.

ByFacesCluster(cluster[, ...])

Creates a cellcomplex by merging the faces within the input cluster.

ByFacesTopologic([tolerance, silent])

Creates a CellComplex from the input faces after removing coplanar overlaps using only TopologicPy / Topologic boolean operations.

ByWires(wires[, triangulate, tolerance])

Creates a cellcomplex by lofting through the input wires.

ByWiresCluster(cluster[, triangulate, tolerance])

Creates a cellcomplex by lofting through the 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 octahedron.

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 recursive tetrahedron cellComplex with internal cells.

Torus([origin, majorRadius, minorRadius, ...])

Creates a torus.

Vertices(cellComplex)

Returns the vertices of the input cellComplex.

Volume(cellComplex[, mantissa])

Returns the 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=False, tolerance: float = 0.0001, silent: bool = False)

Creates a cellcomplex by merging the input cells.

Parameters
cellslist

The list of input cells.

transferDictionariesbool , optional

If set to True, any dictionaries in the cells are transferred to the 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 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 after using Shapely to remove coplanar face overlaps.

This method is intended as a faster pre-processing pathway for cases where CellComplex.ByFaces is slow because the input contains overlapping coplanar faces. Non-coplanar faces are passed through unchanged.

Parameters
faceslist

The input list of topologic_core.Face objects.

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 or None

The created CellComplex.

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.

ByFacesTopologic(tolerance: float = 0.0001, silent: bool = False)

Creates a CellComplex from the input faces after removing coplanar overlaps using only TopologicPy / Topologic boolean operations.

The method keeps larger coplanar faces first and trims later faces by subtracting already accepted coplanar regions. This avoids dissolving coplanar subdivisions into a single merged face.

Parameters
faceslist

The input list of topologic_core.Face objects.

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 or None

The created CellComplex.

static ByWires(wires: list, triangulate: bool = True, tolerance: float = 0.0001)

Creates a cellcomplex by lofting through the input wires.

Parameters
wireslist

The input list of wires. The list should contain a minimum of two wires. All wires must have the same number of edges.

triangulatebool , optional

If set to True, the faces will be triangulated. Default is True.

tolerancefloat , optional

The desired tolerance. Default is 0.0001.

Returns
topologic_core.CellComplex

The created cellcomplex.

static ByWiresCluster(cluster, triangulate: bool = True, tolerance: float = 0.0001)

Creates a cellcomplex by lofting through the wires in the input cluster.

Parameters
clustertopologic_core.Cluster

The input cluster of wires.

triangulatebool , optional

If set to True, the faces will be triangulated. Default is True.

tolerancefloat , optional

The desired tolerance. Default is 0.0001.

Returns
topologic_core.CellComplex

The created cellcomplex.

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)

Creates an octahedron. See https://en.wikipedia.org/wiki/Octahedron.

Parameters
origintopologic_core.Vertex , optional

The origin location of the octahedron. Default is None which results in the octahedron being placed at (0, 0, 0).

radiusfloat , optional

The radius of the octahedron’s circumscribed sphere. Default is 0.5.

directionlist , optional

The vector representing the up direction of the octahedron. Default is [0, 0, 1].

placementstr , optional

The description of the placement of the origin of the octahedron. 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 octahedron.

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)

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.

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=[0, 0, 1], placement='center', mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)

Creates a recursive tetrahedron cellComplex with internal cells.

Parameters
origintopologic_core.Vertex , optional

The origin location of the tetrahedron. Default is None which results in the tetrahedron being placed at (0, 0, 0).

lengthfloat , optional

The length of the edge of the tetrahedron. Default is 1.

depthint , optional

The desired maximum number of recrusive subdivision levels.

directionlist , optional

The vector representing the up direction of the tetrahedron. Default is [0, 0, 1].

placementstr , optional

The description of the placement of the origin of the tetrahedron. 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 tetrahedron.

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)

Creates a torus.

Parameters
origintopologic_core.Vertex , optional

The origin location of the torus. Default is None which results in the torus being placed at (0, 0, 0).

majorRadiusfloat , optional

The major radius of the torus. Default is 0.5.

minorRadiusfloat , optional

The minor radius of the torus. Default is 0.1.

uSidesint , optional

The number of sides along the longitude of the torus. Default is 16.

vSidesint , optional

The number of sides along the latitude of the torus. Default is 8.

directionlist , optional

The vector representing the up direction of the torus. Default is [0, 0, 1].

placementstr , optional

The description of the placement of the origin of the torus. 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.Cell

The created torus.

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) float

Returns the volume of the input cellComplex.

Parameters
cellComplextopologic_core.CellComplex

The input cellComplex.

manitssa: int , optional

The number of decimal places to round the result to. Default is 6.

Returns
float

The 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.