topologicpy.Topology module
- class topologicpy.Topology.MergingProcess(message_queue, sources, sinks, so_dicts)
Bases:
ProcessReceive message from other processes and merging the result
- Attributes
- authkey
daemonReturn whether process is a daemon
exitcodeReturn exit code of process or None if it has yet to stop
identReturn identifier (PID) of process or None if it has yet to start
- name
pidReturn identifier (PID) of process or None if it has yet to start
sentinelReturn a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination.
Methods
close()Close the Process object.
is_alive()Return whether process is alive
join([timeout])Wait until child process terminates
kill()Terminate process; sends SIGKILL signal or uses TerminateProcess()
run()Method to be run in sub-process; can be overridden in sub-class
start()Start child process
terminate()Terminate process; sends SIGTERM signal or uses TerminateProcess()
wait_message
- wait_message()
- class topologicpy.Topology.QueueItem(ID, sinkKeys, sinkValues)
Bases:
tuple- Attributes
- ID
Alias for field number 0
- sinkKeys
Alias for field number 1
- sinkValues
Alias for field number 2
Methods
count(value, /)Return number of occurrences of value.
index(value[, start, stop])Return first index of value.
- ID
Alias for field number 0
- sinkKeys
Alias for field number 1
- sinkValues
Alias for field number 2
- class topologicpy.Topology.SinkItem(ID, sink_str)
Bases:
tuple- Attributes
- ID
Alias for field number 0
- sink_str
Alias for field number 1
Methods
count(value, /)Return number of occurrences of value.
index(value[, start, stop])Return first index of value.
- ID
Alias for field number 0
- sink_str
Alias for field number 1
- class topologicpy.Topology.Topology
Bases:
objectMethods
AddApertures(topology, apertures[, ...])Adds the input list of apertures to the input topology or to its subtopologies based on the input subTopologyType.
AddContent(topology[, contents, ...])Adds the input contents to the input topology or to its subtopologies based on the input subTopologyType.
AddDictionary(topology, dictionary[, silent])Adds the input dictionary to the input topology.
AdjacentTopologies(topology, hostTopology[, ...])Returns the topologies, as specified by the input topology type, adjacent to the input topology within the input host topology.
Analyze(topology[, silent])Returns an analysis string that describes the input topology.
ApertureTopologies(topology[, ...])Returns the aperture topologies of the input topology.
Apertures(topology[, subTopologyType, silent])Returns the apertures of the input topology.
BREPString(topology[, version, silent])Returns the BRep string of the input topology.
Bend(topology[, origin, angle, direction, ...])Bends the input topology along its Z-axis.
BinByDictionaryKey(topologies, key[, ...])Bins a list of Topologic topologies into groups based on identical key/value pairs found in each topology's Dictionary.
BoundingBox(topology[, optimize, axes, ...])Returns a bounding topology for the input topology.
By3DMFile(file[, objectNames, layerNames, ...])Imports exact supported geometry from a Rhino
File3dmobject.By3DMPath(path[, objectNames, layerNames, ...])Imports exact supported geometry from a Rhino
.3dmfile path.ByBIMFile(file[, guidKey, colorKey, ...])Imports topologies from the input BIM (dotbimpy.file.File) file object.
ByBIMPath(path[, guidKey, colorKey, ...])Imports topologies from the input BIM file.
ByBIMString(string[, guidKey, colorKey, ...])Imports topologies from the input BIM file.
ByBREPFile(file[, ontology, silent])Imports a topology from a BREP file.
ByBREPPath(path[, ontology, silent])Imports a topology from a BREP file path.
ByBREPString(string[, ontology, silent])Creates a topology from the input brep string
ByDXFFile(file[, sides, tolerance, silent])Imports a list of topologies from a DXF file.
ByDXFPath(path[, sides, tolerance, silent])Imports a list of topologies from a DXF file path.
ByGeometry([vertices, edges, faces, ...])Create a topology by the input lists of vertices, edges, and faces.
ByIFCFile(file[, includeTypes, ...])Import an IFC file into a list of TopologicPy topologies using the pure-Python IFC importer.
ByIFCPath(path[, includeTypes, ...])Imports the topologies from an IFC file path.
ByJSONDictionary(jsonDictionary[, ontology, ...])Imports the topology from a JSON dictionary.
ByJSONFile(file[, ontology, tolerance, silent])Imports the topology from a JSON file.
ByJSONPath(path[, ontology, tolerance, silent])Imports the topology from a JSON file.
ByJSONString(string[, ontology, tolerance, ...])Imports the topology from a JSON string.
ByMeshData(dictionary[, ...])Create a cluster by the input python dictionary of vertices, edges, faces, and cells.
ByOBJFile(objFile[, mtlFile, defaultColor, ...])Imports topologies from an OBJ file object and an optional MTL file object.
ByOBJPath(objPath[, defaultColor, ...])Imports topologies from an OBJ file path and referenced MTL files.
ByOBJString(objString[, mtlString, ...])Imports TopologicPy topologies from OBJ and optional MTL strings.
ByOCCTShape(occtShape[, ontology, silent])Creates a topology from the input OCCT shape.
ByPDFFile(file[, wires, faces, ...])Import PDF file and convert its entities to topologies.
ByPDFPath(path[, wires, faces, ...])Import PDF file and convert its entities to topologies.
BySTEPPath(path[, unit, silent])Creates a topology from neutral STEP BREP geometry.
ByTPYPath(path[, tolerance, silent])Creates a topology from a TopologicPy TPY persistence archive.
ByXYZFile(file[, frameIdKey, vertexIdKey, ...])Imports the topology from an XYZ file path.
ByXYZPath(path[, frameIdKey, vertexIdKey, ...])Imports the topology from an XYZ file path.
CanonicalMatrix(topology[, n, normalize, ...])Returns the canonical transformation matrices of the input topology.
CellComplexes(topology[, silent])Returns the cellcomplexes of the input topology.
Cells(topology[, silent])Returns the cells of the input topology.
CenterOfMass(topology[, silent])Returns the geometric center of mass of the input topology.
Centroid(topology[, silent])Returns the geometric centroid of the input topology.
Cleanup([topology, silent])Cleans up all resources in which are managed by topologic library.
ClusterByKeys(topologies, *keys[, silent])Clusters the input list of topologies based on the input key or keys.
ClusterFaces(topology[, angTolerance, ...])Clusters the faces of the input topology by their direction.
Clusters(topology[, silent])Returns the clusters of the input topology.
Contains(topologyA, topologyB[, tolerance, ...])Returns True if the input topologyA contains the input topologyB.
Contents(topology[, silent])Returns the contents of the input topology
Contexts(topology[, silent])Returns the list of contexts of the input topology
ConvexHull(topology[, mantissa, tolerance, ...])Computes the convex hull of the input topology.
Copy(topology[, deep, silent, returnProvenance])Returns a copy of the input topology.
CoveredBy(topologyA, topologyB[, tolerance, ...])Returns True if the input topologyA is covered by the input topologyB.
Covers(topologyA, topologyB[, tolerance, silent])Returns True if the input topologyA covers the input topologyB.
Crosses(topologyA, topologyB[, tolerance, ...])Returns True if the input topologyA crosses the input topologyB.
Decompose(topology[, tiltAngle, ...])Decomposes the input topology into its logical components.
DeepCopy(topology[, silent])Returns an independent deep copy of the input topology.
Deform(topology, deformation[, origin, ...])Deforms the input topology through the active geometry backend.
Degree(topology, hostTopology[, silent])Returns the number of immediate supertopologies that use the input topology.
Diameter(topology[, mantissa, tolerance, silent])Computes the diameter of the convex hull of the given topology.
Dictionary(topology[, silent])Returns the dictionary of the input topology.
Difference(topologyA, topologyB[, tranDict, ...])Subtracts topologyB from topologyA.
Dimensionality(topology[, silent])Returns the dimensionality of the input topology.
Disjoint(topologyA, topologyB[, tolerance, ...])Returns True if the input topologyA is disjoint from the input topologyB.
Divide(topologyA, topologyB[, ...])Divides the input topology by the input tool and places the results in the contents of the input topology.
Edges(topology[, silent])Returns the edges of the input topology or graph.
Equals(topologyA, topologyB[, tolerance, silent])Returns True if the input topologyA is equal to the input topologyB.
Explode(topology[, origin, scale, ...])Explodes the input topology.
ExportTo3DM(topologies, path[, overwrite, ...])Exports topology to a Rhino
.3dmfile.ExportToBIM(topologies, path[, overwrite, ...])Exports the input topology to a BIM file.
ExportToBREP(topology, path[, overwrite, ...])Exports the input topology to a BREP file.
ExportToDXF(path[, overwrite, mantissa, silent])Exports the input topology to a DXF file.
ExportToJSON(topologies, path[, overwrite, ...])Exports the input list of topologies to a JSON file.
ExportToOBJ(*topologies, path[, nameKey, ...])Exports the input topology to a Wavefront OBJ file.
ExportToSTEP(topology, path[, overwrite, ...])Exports a topology to neutral STEP BREP geometry.
ExportToTPY(topology, path[, overwrite, ...])Exports a topology to TopologicPy's native TPY persistence format.
ExternalBoundary(topology[, silent])Returns the external boundary of the input topology.
Faces(topology[, silent])Returns the faces of the input topology.
Filter(topologies[, topologyType, ...])Filters the input list of topologies based on the input parameters.
Fix(topology[, topologyType, tolerance, silent])Attempts to fix or coerce the input topology to the requested topology type without replacing curved Edges or Face supporting surfaces.
Flatten(topology[, origin, direction, ...])Flattens the input topology such that the input origin is located at the world origin and the input topology is rotated such that the input vector is pointed in the Up direction (see Vector.Up()).
Geometry(topology[, transferDictionaries, ...])Returns the geometry of the input topology in mesh-data form.
HighestType(topology[, silent])Returns the highest topology type found in the input topology.
Impose(topologyA, topologyB[, tranDict, ...])Imposes topologyB on topologyA.
Imprint(topologyA, topologyB[, tranDict, ...])Imprints topologyB on topologyA.
Inherit(targets, sources[, keys, exclusive, ...])Transfers dictionary information from topologiesB to topologiesA based on co-location of internal vertices.
InternalVertex(topology[, timeout, ...])Returns a vertex guaranteed to be internal to the input topology.
Intersect(topologyA, topologyB[, tranDict, ...])Finds the intersection between the input operand topologies.
IsInstance(topology, type[, silent])Returns True if the input topology is an instance of the class specified by the input type string.
IsPlanar(topology[, mantissa, tolerance, silent])Returns True if the complete geometry of the input topology is planar.
IsSame(topologyA, topologyB[, silent])Returns True if the input topologies are the same topology.
IsSimilar(topologyA, topologyB[, ...])Calculates if the input topologies are similar.
IsVertexCongruent(topologyA, topologyB[, ...])Returns True if the input topologies are vertex congruent (have same number of vertices and all vertices are congruent within a tolerance).
JSONString(topologies[, mantissa, silent])Exports the input list of topologies to a JSON string
LargestFaces(topology[, ...])Returns the list of the largest faces found in the input topology.
Load(path[, silent])Loads a topology using the codec selected by the input extension.
LongestEdges(topology[, ...])Returns the list of the longest edges found in the input topology.
Merge(topologyA, topologyB[, tranDict, ...])Merges the input operand topologies.
MergeAll(*topologies[, tolerance, silent])Merges all input topologies.
Mesh(topology[, minSize, maxSize, ...])Uses gmsh to create indexed surface/volume mesh data.
MeshData(topology[, mode, ...])Creates mesh data from the input topology.
MeshToTopologies(vertices[, faces, tets, ...])Converts mesh data in the form of:
Move(topology[, x, y, z, ...])Moves the input topology.
NonPlanarFaces(topology[, tolerance, silent])Returns any nonplanar faces in the input topology
OBJString(*topologies[, nameKey, colorKey, ...])Exports the input topology to Wavefront OBJ and MTL strings.
OCCTShape(topology[, silent])Returns the OCCT shape of the input topology.
OntologyClass(topology[, defaultValue, silent])Returns the ontology class assigned to the input topology.
OntologyURI(topology[, defaultValue, silent])Returns the ontology URI assigned to the input topology.
OpenEdges(topology[, silent])Returns the edges that border only one face
OpenFaces(topology[, silent])Returns the faces that border no cells
OpenVertices(topology[, silent])Returns the vertices that border only one edge
Orient(topology[, origin, dirA, dirB, ...])Orients the input topology such that dirA is parallel to dirB.
OrientAndPlace(topology[, originA, originB, ...])Orients and places the input topology using a single affine transformation.
Overlaps(topologyA, topologyB[, tolerance, ...])Returns True if the input topologyA overlaps the input topologyB.
Place(topology[, originA, originB, ...])Places the input topology at the specified location.
PrincipalAxes(topology[, n, mantissa, silent])Returns the principal axes (vectors) of the input topology.
Proximity(topologyA, topologyB, ...[, ...])Returns the proximity label between two input topologies.
RemoveCollinearEdges(topology[, ...])Removes collinear edges from the input topology.
RemoveContent(topology, contents[, silent])Removes the input content list from the input topology
RemoveCoplanarFaces(topology[, epsilon, ...])Removes coplanar faces in the input topology.
RemoveEdges(topology[, edges, tolerance, silent])Removes the specified Edges from the input topology.
RemoveFaces(topology[, faces, tolerance, silent])Removes the specified Faces from the input topology.
RemoveFacesBySelectors(topology[, ...])Removes faces that contain the input list of selectors (vertices) from the input topology
RemoveVertices(topology[, vertices, ...])Removes the specified Vertices from the input topology.
ReplaceVertices(topology[, verticesA, ...])Replaces vertices in the first input list with the corresponding vertices in the second input list and rebuilds the input topology.
Rotate(topology[, origin, axis, angle, ...])Rotates the input topology while preserving its exact geometry.
RotateByEulerAngles(topology[, origin, ...])Rotate a topology using sequential Euler rotations.
RotateByQuaternion(topology[, origin, ...])Rotates the input topology using Quaternion rotations.
Save(topology, path[, overwrite, silent])Saves a topology using the codec selected by the output extension.
Scale(topology[, origin, x, y, z, ...])Scales the input topology
SelectSubTopology(topology, selector[, ...])Returns the subtopology within the input topology based on the input selector and the subTopologyType.
SelfMerge(topology[, transferDictionaries, ...])Self-merges the input topology and returns the cleanest logical topology represented by it.
SetDictionary(topology, dictionary[, silent])Sets the input topology's dictionary to the input dictionary.
SetOntology(topology[, ontologyClass, ...])Annotates the input topology with TopologicPy ontology metadata.
SetSnapshot(topology[, snapshot, timestamp, ...])Sets a date/time stamped snapshot and stores it in the input topology's content system.
SharedEdges(topologyA, topologyB[, silent])Returns the shared edges between the two input topologies
SharedFaces(topologyA, topologyB[, silent])Returns the shared faces between the two input topologies
SharedTopologies(topologyA, topologyB[, silent])Returns the shared topologies between the two input topologies
SharedVertices(topologyA, topologyB[, silent])Returns the shared vertices between the two input topologies
SharedWires(topologyA, topologyB[, silent])Returns the shared wires between the two input topologies
Shells(topology[, silent])Returns the shells of the input topology.
ShortestDistance(topologyA, topologyB[, ...])Returns the shortest Euclidean distance between two topologies.
ShortestEdge(topologyA, topologyB[, ...])Returns the shortest connecting edge between two topologies.
ShortestEdges(topology[, ...])Returns the list of the shortest edges found in the input topology.
Show(*topologies[, nameKey, opacityKey, ...])Shows the input topology on screen.
Slice(topologyA, topologyB[, tranDict, ...])Slices topologyA using topologyB.
SmallestFaces(topology[, ...])Returns the list of the smallest faces found in the input topology.
Snapshots(topology[, start, end, key, silent])Returns the list of the stored snapshots within the start and end timestamps.
SortBySelectors(topologies, selectors[, ...])Sorts the input list of topologies according to the input list of selectors.
SpatialRelationship(topologyA, topologyB[, ...])Returns the spatial relationship string between the two input topologies according to OGC / ISO 19107 / DE-9IM / RCC-8
Spin(topology[, origin, triangulate, ...])Spins the input topology around an axis to create a new topology.See https://en.wikipedia.org/wiki/Solid_of_revolution.
SubCombinations(topology[, subTopologyType, ...])Creates connected sub-combination topologies of the input topology.
SubTopologies(topology[, subTopologyType, ...])Returns the subtopologies of the input topology or graph as specified by the subTopologyType input string.
SuperTopologies(topology, hostTopology[, ...])Returns the supertopologies connected to the input topology.
SymDif(topologyA, topologyB[, tranDict, ...])Returns the symmetric difference (XOR) of the input operand topologies.
SymmetricDifference(topologyA, topologyB[, ...])Returns the symmetric difference (XOR) of the input operand topologies.
Taper(topology[, origin, ratioRange, ...])Tapers the input topology along its Z-axis.
Tessellate(topology[, quality, ...])Tessellates the input topology into an indexed triangular surface mesh.
Touches(topologyA, topologyB[, tolerance, ...])Returns True if the input topologyA touches the input topologyB.
TransferDictionaries(sources, sinks[, ...])Transfers the dictionaries from the list of sources to the list of sinks.
TransferDictionariesByKey(topologies, ...[, ...])Transfers dictionaries to input topologies by matching a shared dictionary key.
TransferDictionariesBySelectors(topology, ...)Transfers the dictionaries of the list of selectors to the subtopologies of the input topology based on the input parameters.
Transform(topology, matrix[, angTolerance, ...])Transforms the input topology by the input 4x4 affine transformation matrix.
Translate(topology[, x, y, z, ...])Translates (moves) the input topology.
TranslateByDirectionDistance(topology[, ...])Translates (moves) the input topology along the input direction by the specified distance.
Triangulate(topology[, ...])Triangulates the Faces of the input topology using only the active topology backend and reconstructs the corresponding Topologic topology.
Twist(topology[, origin, angleRange, ...])Twists the input topology along its Z-axis.
Type(topology[, silent])Returns the type of the input topology.
TypeAsString(topology[, silent])Returns the type of the input topology or graph as a string.
TypeID([name, silent])Returns the type id of the input name string.
UUID(topology[, namespace, uuidKey, ...])Returns the UUID of the input topology or graph.
Unflatten(topology[, origin, direction, ...])Unflattens the input topology such that the world origin is translated to the input origin and the input topology is rotated such that the Up direction (see Vector.Up()) is aligned with the input vector.
Union(topologyA, topologyB[, tranDict, ...])Unions the input operand topologies.
Vertices(topology[, silent])Returns the vertices of the input topology or graph.
VerticesCentroid(topology[, mantissa, silent])Returns the centroid of the vertices of the input topology.
View3D(*topologies[, uuid, nameKey, ...])Sends the input topologies to 3dviewer.net.
Wires(topology[, silent])Returns the wires of the input topology.
Within(topologyA, topologyB[, tolerance, silent])Returns True if the input topologyA is within the input topologyB.
XOR(topologyA, topologyB[, tranDict, ...])Returns the symmetric difference (XOR) of the input operand topologies.
- static AddApertures(topology, apertures, exclusive: bool = False, subTopologyType: str = None, tolerance: float = 0.001, silent: bool = False)
Adds the input list of apertures to the input topology or to its subtopologies based on the input subTopologyType.
- Parameters
- topologytopologic_core.Topology
The input topology.
- apertureslist
The input list of apertures.
- exclusivebool , optional
If set to True, one (sub)topology will accept only one aperture. Otherwise, one (sub)topology can accept multiple apertures. Default is False.
- subTopologyTypestr , optional
The subtopology type to which to add the apertures. This can be “cell”, “face”, “edge”, or “vertex”. It is case insensitive. If set to None, the apertures will be added to the input topology. Default is None.
- tolerancefloat , optional
The desired tolerance. Default is 0.001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The input topology with the apertures added to it.
- static AddContent(topology, contents=None, subTopologyType: str = None, tolerance: float = 0.0001, silent: bool = False)
Adds the input contents to the input topology or to its subtopologies based on the input subTopologyType.
- Parameters
- topologytopologic_core.Topology
The input topology.
- contentslist or topologic_core.Topology
The input content topology or list of content topologies.
- subTopologyTypestr , optional
The subtopology type to which to add the contents. This can be “cellcomplex”, “cell”, “shell”, “face”, “wire”, “edge”, or “vertex”. It is case insensitive. If set to None, the contents are added to the input topology. Default is None.
- 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.Topology
The input topology with the contents added to it.
- static AddDictionary(topology, dictionary, silent: bool = True)
Adds the input dictionary to the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- dictionarytopologic_core.Dictionary
The input dictionary.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The input topology with the input dictionary added to it.
- static AdjacentTopologies(topology, hostTopology, topologyType: str = None, silent: bool = False)
Returns the topologies, as specified by the input topology type, adjacent to the input topology within the input host topology.
- Parameters
- topologytopologic_core.Topology, topologic_core.Graph entity, TGraph vertex/edge index, or TGraph vertex/edge record
The input topology or graph entity.
- hostTopologytopologic_core.Topology or topologicpy.TGraph
The host topology or graph in which to search.
- topologyTypestr
The type of topology for which to search. This can be one of “vertex”, “edge”, “wire”, “face”, “shell”, “cell”, “cellcomplex”. It is case-insensitive. If it is set to None, the type will be inferred from the input topology where possible. Default is None.
- Returns
- adjacentTopologieslist
The list of adjacent topologies or TGraph records.
- static Analyze(topology, silent: bool = False)
Returns an analysis string that describes the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- Returns
- str
The analysis string.
- static ApertureTopologies(topology, subTopologyType: str = None, silent: bool = False)
Returns the aperture topologies of the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- subTopologyTypestring , optional
The subtopology type from which to retrieve the apertures. This can be “cell”, “face”, “edge”, or “vertex” or “all”. It is case insensitive. If set to “all”, then all apertures will be returned. If set to None, the apertures will be retrieved only from the input topology. Default is None.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of aperture topologies found in the input topology.
- static Apertures(topology, subTopologyType=None, silent: bool = False)
Returns the apertures of the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- subTopologyTypestring , optional
The subtopology type from which to retrieve the apertures. This can be “cell”, “face”, “edge”, or “vertex” or “all”. It is case insensitive. If set to “all”, then all apertures will be returned. If set to None, the apertures will be retrieved only from the input topology. Default is None.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of apertures belonging to the input topology.
- static BREPString(topology, version: int = 3, silent: bool = False)
Returns the BRep string of the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- versionint , optional
The desired BRep version number. Default is 3.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- str
The BREP string.
- static Bend(topology, origin=None, angle: float = 90.0, direction: list = [1, 0, 0], triangulate: bool = False, mantissa: int = 6, angTolerance: float = 0.01, tolerance: float = 0.0001, silent: bool = False, subdivisions: int = 8, degree: int = 3)
Bends the input topology along its Z-axis.
With the PythonOCC backend this is implemented by deforming NURBS control geometry. The minimum-Z section remains fixed and positive angles bend toward the input direction in the XY plane.
- Parameters
- topologytopologic_core.Topology
The input topology.
- origintopologic_core.Vertex , optional
Locates the neutral bend axis in XY. If None, the backend uses the topology centroid. Default is None.
- anglefloat , optional
Total bend angle in degrees from minimum to maximum Z. Default is 90.
- directionlist , optional
XY direction toward which a positive bend curves. The Z component is ignored. Default is [1, 0, 0].
- triangulatebool , optional
Retained for API consistency. The NURBS deformation path does not triangulate the topology. Default is False.
- mantissaint , optional
Retained for API consistency. NURBS control points are not rounded. Default is 6.
- angTolerancefloat , optional
Angular tolerance in degrees. Default is 0.01.
- tolerancefloat , optional
The desired geometric tolerance. Default is 0.0001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- subdivisionsint , optional
Minimum number of NURBS knot spans used by the backend. Default is 8.
- degreeint , optional
Minimum NURBS degree used by the backend. Default is 3.
- Returns
- topologic_core.Topology
The bent topology, or None if unsupported or unsuccessful.
- static BinByDictionaryKey(topologies: Iterable[Any], key: str, missing_label: str = '__MISSING__', return_counts: bool = False, silent: bool = False) Tuple[Dict[Any, List[Any]], Dict[Any, int]]
Bins a list of Topologic topologies into groups based on identical key/value pairs found in each topology’s Dictionary. Topologies that do not have the key are binned together under missing_label.
- Parameters
- topologiesIterable[topologic_core.Topology]
The input topologies to bin.
- keystr
The dictionary key to group by.
- missing_labelstr , optional
Identifier used for the group of topologies that lack key. Default is “__MISSING__”.
- return_countsbool , optional
If True, returns a second dictionary of group -> count. Default is False.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- groupsdict
A mapping from group identifier to list of topologies. - For present keys, the identifier is the original value if it is hashable (str/int/float/bool) or a stable, hashable structural surrogate for complex types (lists/dicts) that preserves equality semantics. - For missing keys, the identifier is missing_label.
- countsdict
A mapping from group identifier to group size. Returned only if return_counts=True; otherwise an empty dict.
Notes
This function avoids unnecessary method lookups and branches for speed.
Values that are lists/dicts are converted to stable, hashable surrogates so that
“identical” (by structure/content) values end up in the same bin. - If you need the original (potentially unhashable) values back for complex keys, you can inspect any representative item’s dictionary value in that group.
Examples
>>> groups, counts = BinByDictionaryKey(topologies, key="material", return_counts=True) >>> metal_group = groups.get("steel", []) >>> missing = groups.get("__MISSING__", [])
- static BoundingBox(topology, optimize: int = 0, axes: str = 'xyz', mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Returns a bounding topology for the input topology.
The PythonOCC backend uses OCCT’s precise AABB implementation for
optimize == 0(through the preserved V2 path) and a native oriented bounding box foroptimize > 0when all three rotation axes are enabled. Optimization levels 1-5 use OCCT’s fast OBB search and levels 6-10 request OCCT’s optimal OBB search. Axis-constrained optimization retains the existing algorithm.The returned topology preserves the established dictionary contract:
xrot,yrot, andzrotare the rotations which, when applied in Z, Y, X order about the box centre, align the oriented box with the world axes.
- static By3DMFile(file, objectNames: list = None, layerNames: list = None, transferDictionaries: bool = True, tolerance: float = None, silent: bool = False)
Imports exact supported geometry from a Rhino
File3dmobject.This is a convenience wrapper around
topologicpy.Rhino.Rhino.By3DMFile(). Curves and surfaces retain their NURBS control points, weights, degrees, and knots; B-reps retain their ordered trimming loops where supported by the active backend. No mesh fallback is performed.
- static By3DMPath(path: str, objectNames: list = None, layerNames: list = None, transferDictionaries: bool = True, tolerance: float = None, silent: bool = False)
Imports exact supported geometry from a Rhino
.3dmfile path.
- static ByBIMFile(file, guidKey: str = 'guid', colorKey: str = 'color', typeKey: str = 'type', defaultColor: list = [255, 255, 255, 1], defaultType: str = 'Structure', authorKey='author', dateKey='date', mantissa: int = 6, angTolerance: float = 0.001, tolerance: float = 0.0001, silent: bool = False)
Imports topologies from the input BIM (dotbimpy.file.File) file object. See https://dotbim.net/
- Parameters
- filedotbimpy.file.File
The input dotbim file.
- guidKeystr , optional
The key to use to store the the guid of the topology. Default is “guid”.
- colorKeystr , optional
The key to use to find the the color of the topology. Default is “color”. If no color is found, the defaultColor parameter is used.
- typeKeystr , optional
The key to use to find the the type of the topology. Default is “type”. If no type is found, the defaultType parameter is used.
- defaultColorlist , optional
The default color to use for the topology. Default is [255,255,255,1] which is opaque white.
- defaultTypestr , optional
The default type to use for the topology. Default is “Structure”.
- authorKeystr , optional
The key to use to store the author of the topology. Default is “author”.
- dateKeystr , optional
The key to use to store the creation date of the topology. This should be in the formate “DD.MM.YYYY”. If no date is found the date of import is used.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- angTolerancefloat , optional
The angle tolerance in degrees under which no rotation is carried out. Default is 0.001 degrees.
- 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
- list
The list of imported topologies
- static ByBIMPath(path, guidKey: str = 'guid', colorKey: str = 'color', typeKey: str = 'type', defaultColor: list = [255, 255, 255, 1], defaultType: str = 'Structure', authorKey='author', dateKey='date', mantissa: int = 6, angTolerance: float = 0.001, tolerance: float = 0.0001, silent: bool = False)
Imports topologies from the input BIM file. See https://dotbim.net/
- Parameters
- path :str
The path to the .bim file.
- guidKeystr , optional
The key to use to store the the guid of the topology. Default is “guid”.
- colorKeystr , optional
The key to use to find the the color of the topology. Default is “color”. If no color is found, the defaultColor parameter is used.
- typeKeystr , optional
The key to use to find the the type of the topology. Default is “type”. If no type is found, the defaultType parameter is used.
- defaultColorlist , optional
The default color to use for the topology. Default is [255,255,255,1] which is opaque white.
- defaultTypestr , optional
The default type to use for the topology. Default is “Structure”.
- authorKeystr , optional
The key to use to store the author of the topology. Default is “author”.
- dateKeystr , optional
The key to use to store the creation date of the topology. This should be in the formate “DD.MM.YYYY”. If no date is found the date of import is used.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- angTolerancefloat , optional
The angle tolerance in degrees under which no rotation is carried out. Default is 0.001 degrees.
- 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
- list
The list of imported topologies
- static ByBIMString(string, guidKey: str = 'guid', colorKey: str = 'color', typeKey: str = 'type', defaultColor: list = [255, 255, 255, 1], defaultType: str = 'Structure', authorKey: str = 'author', dateKey: str = 'date', mantissa: int = 6, angTolerance: float = 0.001, tolerance: float = 0.0001, silent: bool = False)
Imports topologies from the input BIM file. See https://dotbim.net/
- Parameters
- string :str
The input dotbim str (in JSON format).
- guidKeystr , optional
The key to use to store the the guid of the topology. Default is “guid”.
- colorKeystr , optional
The key to use to find the the color of the topology. Default is “color”. If no color is found, the defaultColor parameter is used.
- typeKeystr , optional
The key to use to find the the type of the topology. Default is “type”. If no type is found, the defaultType parameter is used.
- defaultColorlist , optional
The default color to use for the topology. Default is [255,255,255,1] which is opaque white.
- defaultTypestr , optional
The default type to use for the topology. Default is “Structure”.
- authorKeystr , optional
The key to use to store the author of the topology. Default is “author”.
- dateKeystr , optional
The key to use to store the creation date of the topology. This should be in the formate “DD.MM.YYYY”. If no date is found the date of import is used.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- angTolerancefloat , optional
The angle tolerance in degrees under which no rotation is carried out. Default is 0.001 degrees.
- 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
- list
The list of imported topologies
- static ByBREPFile(file, ontology: bool = False, silent: bool = False)
Imports a topology from a BREP file.
- Parameters
- filefile object
The BREP file.
- ontologybool , optional
If True, the returned topology is annotated with TopologicPy ontology metadata. Default is False.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The imported topology.
- static ByBREPPath(path, ontology: bool = False, silent: bool = False)
Imports a topology from a BREP file path.
- Parameters
- pathstr
The path to the BREP file.
- ontologybool , optional
If True, the returned topology is annotated with TopologicPy ontology metadata. Default is False.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The imported topology.
- static ByBREPString(string, ontology: bool = False, silent: bool = False)
Creates a topology from the input brep string
- Parameters
- stringstr
The input brep string.
- ontologybool , optional
If True, the returned topology is annotated with TopologicPy ontology metadata. Default is False.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The created topology.
- static ByDXFFile(file, sides: int = 16, tolerance: float = 0.0001, silent: bool = False)
Imports a list of topologies from a DXF file. This is an experimental method with limited capabilities.
- Parameters
- filea DXF file object
The DXF file object.
- sidesint , optional
The desired number of sides of splines. Default is 16.
- 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
- list
The list of imported topologies.
- static ByDXFPath(path, sides: int = 16, tolerance: float = 0.0001, silent: bool = False)
Imports a list of topologies from a DXF file path. This is an experimental method with limited capabilities.
- Parameters
- pathstr
The path to the DXF file.
- sidesint , optional
The desired number of sides of splines. Default is 16.
- 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
- list
The list of imported topologies.
- static ByGeometry(vertices=[], edges=[], faces=[], topologyType: str = None, tolerance: float = 0.0001, ontology: bool = False, silent: bool = False)
Create a topology by the input lists of vertices, edges, and faces.
- Parameters
- verticeslist
The input list of vertices in the form of [x, y, z].
- edgeslist , optional
The input list of edges in the form of [i, j] where i and j are vertex indices.
- faceslist , optional
The input list of faces in the form of [i, j, k, l, …] where the items in the list are vertex indices. The face is assumed to be closed, so the last vertex is connected to the first vertex automatically.
- topologyTypestr , optional
The desired highest topology type. The options are: “Vertex”, “Edge”, “Wire”, “Face”, “Shell”, “Cell”, “CellComplex”. It is case insensitive. If any of these options are selected, the returned topology will only contain this type either as a single topology or as a Cluster of these types of topologies. If set to None, a Cluster will be returned of vertices, edges, and/or faces. Default is None.
- ontologybool , optional
If True, the returned topology is annotated with TopologicPy ontology metadata. 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
- topologytopologic_core.Topology
The created topology.
- static ByIFCFile(file, includeTypes: list = [], excludeTypes: list = [], dictionaryMode: str = 'basic', clean: bool = False, scale: float = None, topologyType: str = None, circleSides: int = 24, ontology: bool = True, epsilon: float = 0.01, angTolerance: float = 0.1, tolerance: float = 0.0001, silent: bool = False) list
Import an IFC file into a list of TopologicPy topologies using the pure-Python IFC importer. See IFC.TopologiesByFile.
- Parameters
- filestr or ifcopenshell.file-like object
Prefer passing a path string. If an ifcopenshell file-like object is supplied, this method attempts to serialise it to STEP text.
- includeTypeslist , optional
The list of IFC entity types to include. If empty, all supported types are included. Default is [].
- excludeTypeslist , optional
The list of IFC entity types to exclude. Default is [].
- dictionaryModestr , optional
The dictionary import mode. Options are “none”, “basic”, and “full”. Default is “basic”.
- cleanbool , optional
If set to True, the imported topologies are cleaned. Default is False.
- scalefloat , optional
Deprecated raw-coordinate multiplier. Default is None, which converts IFC length units to metres. Explicit values override conversion.
- topologyTypestr , optional
The desired output topology type. If set to None, the method returns the most appropriate topology type for each imported product. Default is None.
- circleSidesint , optional
The number of sides used to approximate circular geometry. Default is 24.
- ontologybool , optional
If True, the returned topology is annotated with TopologicPy ontology metadata. Default is False.
- epsilonfloat , optional
The geometric epsilon used during import. Default is 0.01.
- angTolerancefloat , optional
The angular tolerance used during import. 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 False.
- Returns
- list
The created TopologicPy topologies.
- static ByIFCPath(path: str, includeTypes: list = [], excludeTypes: list = [], dictionaryMode: str = 'basic', clean: bool = False, scale: float = None, topologyType: str = None, circleSides: int = 24, ontology: bool = True, epsilon: float = 0.01, angTolerance: float = 0.1, tolerance: float = 0.0001, silent: bool = False) list
Imports the topologies from an IFC file path. See IFC.TopologiesByPath
- Parameters
- pathstr
The path to the input IFC file.
- includeTypeslist , optional
The list of IFC entity types to include. If empty, all supported types are included. Default is [].
- excludeTypeslist , optional
The list of IFC entity types to exclude. Default is [].
- dictionaryModestr , optional
The dictionary import mode. Options are “none”, “basic”, and “full”. Default is “basic”.
- cleanbool , optional
If set to True, the imported topologies are cleaned. Default is False.
- scalefloat , optional
Deprecated raw-coordinate multiplier. Default is None, which converts IFC length units to metres. Explicit values override conversion.
- topologyTypestr , optional
The desired output topology type. If set to None, the method returns the most appropriate topology type for each imported product. Default is None.
- circleSidesint , optional
The number of sides used to approximate circular geometry. Default is 24.
- ontologybool , optional
If True, the returned topology is annotated with TopologicPy ontology metadata. Default is False.
- epsilonfloat , optional
The geometric epsilon used during import. Default is 0.01.
- angTolerancefloat , optional
The angular tolerance used during import. 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 False.
- Returns
- list
The created list of topologies.
- static ByJSONDictionary(jsonDictionary: dict, ontology: bool = False, tolerance: float = 0.0001, silent: bool = False)
Imports the topology from a JSON dictionary.
- Parameters
- jsonDictionarydict
The input JSON dictionary.
- ontologybool , optional
If True, the returned topology is annotated with TopologicPy ontology metadata. 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
- list
The list of imported topologies. The list can contain 0, 1, or many topologies, but this method always returns a list.
- static ByJSONFile(file, ontology: bool = False, tolerance: float = 0.0001, silent: bool = False)
Imports the topology from a JSON file.
- Parameters
- filefile object
The input JSON file.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- ontologybool , optional
If True, the returned topology is annotated with TopologicPy ontology metadata. Default is False.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of imported topologies (Warning: the list could contain 0, 1, or many topologies, but this method will always return a list)
- static ByJSONPath(path, ontology: bool = False, tolerance: float = 0.0001, silent: bool = False)
Imports the topology from a JSON file.
- Parameters
- pathstr
The file path to the json file.
- ontologybool , optional
If True, the returned topology is annotated with TopologicPy ontology metadata. 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
- list
The list of imported topologies.
- static ByJSONString(string: str, ontology: bool = False, tolerance: float = 0.0001, silent: bool = False)
Imports the topology from a JSON string.
- Parameters
- stringstr
The input JSON string.
- ontologybool , optional
If True, the returned topology is annotated with TopologicPy ontology metadata. 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
- list
The list of imported topologies (Warning: the list could contain 0, 1, or many topologies, but this method will always return a list)
- static ByMeshData(dictionary, transferDictionaries: bool = False, ontology: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Create a cluster by the input python dictionary of vertices, edges, faces, and cells.
- Parameters
- dictionarydict
The input python dictionary of vertices, edges, faces, and cells in the form of: { ‘mode’: int, The expected mode of input face data:
0: The faces list is indexed into the vertices list. 1: The faces list is indexesd into the edges list.
‘vertices’: list, (list of coordinates) ‘edges’: list, (list of indices into the list of vertices) ‘faces’: list, (list of indices into the list of edges) ‘cells’: list, (list of indices into the list of faces) ‘vertex_dict’: list of dicts, ‘edge_dicts’: list of dicts, ‘face_dicts’, list of dicts, ‘cell_dicts’, list of dicts }
- transferDictionariesbool , optional
If set to True, the python dictionaries will be transferred to the coorespoding topologies. Default is False.
- ontologybool , optional
If True, the returned topology is annotated with TopologicPy ontology metadata. Default is False.
- 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.Cluster
The created cluster of vertices, edges, faces, and cells.
- static ByOBJFile(objFile, mtlFile=None, defaultColor: list = [255, 255, 255], defaultOpacity: float = 1.0, transposeAxes: bool = True, removeCoplanarFaces: bool = False, selfMerge: bool = True, ontology: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Imports topologies from an OBJ file object and an optional MTL file object.
- Parameters
- objFilefile object
The OBJ file object.
- mtlFilefile object , optional
The MTL file object. If None and objFile has a filesystem path, referenced MTL files are loaded automatically when possible. Default is None.
- defaultColorlist , optional
The default RGB color in the range 0-255. Default is [255, 255, 255].
- defaultOpacityfloat , optional
The default opacity. Default is 1.0.
- transposeAxesbool , optional
If True, converts OBJ coordinates from (x, y, z) to (x, -z, y). Default is True.
- removeCoplanarFacesbool , optional
If True, coplanar faces are merged after the OBJ faces have been constructed as valid Topologic faces. Default is False.
- selfMergebool , optional
If True, each imported group/object is self-merged to the highest logical topology type. Default is True.
- ontologybool , optional
If True, returned topologies are annotated with TopologicPy ontology metadata. Default is False.
- mantissaint , optional
The number of decimal places to which OBJ vertex coordinates are rounded. Default is 6.
- tolerancefloat , optional
The desired geometric tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The imported topologies, one per non-empty OBJ group/object.
- static ByOBJPath(objPath, defaultColor: list = [255, 255, 255], defaultOpacity: float = 1.0, transposeAxes: bool = True, removeCoplanarFaces: bool = False, selfMerge: bool = False, ontology: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Imports topologies from an OBJ file path and referenced MTL files.
- Parameters
- objPathstr
The path to the OBJ file.
- defaultColorlist , optional
The default RGB color in the range 0-255. Default is [255, 255, 255].
- defaultOpacityfloat , optional
The default opacity. Default is 1.0.
- transposeAxesbool , optional
If True, converts OBJ coordinates from (x, y, z) to (x, -z, y). Default is True.
- removeCoplanarFacesbool , optional
If True, coplanar faces are merged after the OBJ faces have been constructed as valid Topologic faces. Default is False.
- selfMergebool , optional
If True, each imported group/object is self-merged to the highest logical topology type. Default is False.
- ontologybool , optional
If True, returned topologies are annotated with TopologicPy ontology metadata. Default is False.
- mantissaint , optional
The number of decimal places to which OBJ vertex coordinates are rounded. Default is 6.
- tolerancefloat , optional
The desired geometric tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The imported topologies, one per non-empty OBJ group/object.
- static ByOBJString(objString: str, mtlString: str = None, defaultColor=None, defaultOpacity: float = 1.0, transposeAxes: bool = True, removeCoplanarFaces: bool = False, selfMerge: bool = False, ontology: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Imports TopologicPy topologies from OBJ and optional MTL strings.
Supported OBJ primitives are vertices (v), faces (f), polylines (l), and points (p). OBJ objects/groups (o/g) are returned as separate topologies. Texture coordinates and vertex normals are ignored.
- Parameters
- objStringstr
The OBJ file contents as a string.
- mtlStringstr , optional
The MTL file contents as a string. Default is None.
- defaultColorlist , optional
The default RGB color in the range 0-255. Default is [255, 255, 255].
- defaultOpacityfloat , optional
The default opacity. Default is 1.0.
- transposeAxesbool , optional
If True, converts OBJ coordinates from (x, y, z) to (x, -z, y). Default is True.
- removeCoplanarFacesbool , optional
If True, coplanar faces are merged using Topologic geometry/topology operations after all OBJ faces have been constructed. No boundary loops are inferred or reconstructed from OBJ indices. Default is False.
- selfMergebool , optional
If True, each imported group/object is self-merged to the highest logical topology type. Default is False.
- ontologybool , optional
If True, returned topologies are annotated with TopologicPy ontology metadata. Default is False.
- mantissaint , optional
The number of decimal places to which OBJ vertex coordinates are rounded. Default is 6.
- tolerancefloat , optional
The desired geometric tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
One topology per non-empty OBJ group/object.
- static ByOCCTShape(occtShape, ontology: bool = False, silent: bool = False)
Creates a topology from the input OCCT shape.
- Parameters
- occtShapeobject
The input OCCT shape.
- ontologybool , optional
If set to True, ontology metadata is added to the returned topology. Default is False.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The created topology, or None if the shape cannot be wrapped.
- static ByPDFFile(file, wires=False, faces=False, includeTypes: list = [], excludeTypes: list = [], edgeColorKey: str = 'edge_color', edgeWidthKey: str = 'edge_width', faceColorKey: str = 'face_color', faceOpacityKey: str = 'face_opacity', ontology: bool = False, tolerance=0.0001, silent=False)
Import PDF file and convert its entities to topologies.
- Parameters
- filefile
The input PDF file
- wiresbool , optional
If set to True, wires will be constructed when possible. Default is True.
- facesbool , optional
If set to True, faces will be constructed when possible. Default is True.
- includeTypeslist , optional
A list of PDF object types to include in the returned result. Default is [] which means all PDF objects will be included. The possible strings to include in this list are: [“line”, “curve”, “rectangle”, “quadrilateral”]
- excludeTypeslist , optional
A list of PDF object types to exclude from the returned result. Default is [] which mean no PDF object type will be excluded. The possible strings to include in this list are: [“line”, “curve”, “rectangle”, “quadrilateral”]
- edgeColorKeystr , optional
The dictionary key under which to store the edge color. Default is None.
- edgeWidthKeystr , optional
The dictionary key under which to store the edge width. Default is None.
- faceColorKeystr , optional
The dictionary key under which to store the face color. Default is None.
- faceOpacityKeystr , optional
The dictionary key under which to store the face opacity. Default is None.
- ontologybool , optional
If True, the returned topology is annotated with TopologicPy ontology metadata. 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
- list
- A list of Topologic entities (edges, wires, faces, clusters) with attached dictionaries.
- static ByPDFPath(path, wires=False, faces=False, includeTypes=[], excludeTypes=[], edgeColorKey='edge_color', edgeWidthKey='edge_width', faceColorKey='face_color', faceOpacityKey='face_opacity', tolerance=0.0001, silent=False)
Import PDF file and convert its entities to topologies.
- Parameters
- pathpath
The input path to the PDF file
- wiresbool , optional
If set to True, wires will be constructed when possible. Default is True.
- facesbool , optional
If set to True, faces will be constructed when possible. Default is True.
- includeTypeslist , optional
A list of PDF object types to include in the returned result. Default is [] which means all PDF objects will be included. The possible strings to include in this list are: [“line”, “curve”, “rectangle”, “quadrilateral”]
- excludeTypeslist , optional
A list of PDF object types to exclude from the returned result. Default is [] which mean no PDF object type will be excluded. The possible strings to include in this list are: [“line”, “curve”, “rectangle”, “quadrilateral”]
- edgeColorKeystr , optional
The dictionary key under which to store the edge color. Default is None.
- edgeWidthKeystr , optional
The dictionary key under which to store the edge width. Default is None.
- faceColorKeystr , optional
The dictionary key under which to store the face color. Default is None.
- faceOpacityKeystr , optional
The dictionary key under which to store the face opacity. Default is None.
- 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
- list
- A list of Topologic entities (edges, wires, faces, clusters) with attached dictionaries.
- static BySTEPPath(path, unit: str = 'MM', silent: bool = False)
Creates a topology from neutral STEP BREP geometry.
- Parameters
- pathstr or os.PathLike
The input STEP path.
- unitstr , optional
Coordinate unit used when importing. Default is
"MM".- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologicpy.Topology
The imported topology, or None if import fails.
- static ByTPYPath(path, tolerance: float = 0.0001, silent: bool = False)
Creates a topology from a TopologicPy TPY persistence archive.
- Parameters
- pathstr or os.PathLike
The input TPY path.
- tolerancefloat , optional
Geometric tolerance used by compatibility fallbacks when restoring relationships. Default is 0.0001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologicpy.Topology
The reconstructed topology, or None if loading fails.
- static ByXYZFile(file, frameIdKey: str = 'id', vertexIdKey: str = 'id', tolerance: float = 0.0001, silent: bool = False)
Imports the topology from an XYZ file path. This is a very experimental method. While variants of the format exist, topologicpy reads XYZ files that conform to the following: An XYZ file can be made out of one or more frames. Each frame will be stored in a sepatate topologic cluster. First line: total number of vertices in the frame. This must be an integer. No other words or characters are allowed on this line. Second line: frame label. This is free text and will be stored in the dictionary of each frame (topologic_core.Cluster) All other lines: vertex_label, x, y, and z coordinates, separated by spaces, tabs, or commas. The vertex label must be one word with no spaces. It is stored in the dictionary of each vertex.
Example: 3 Frame 1 A 5.67 -3.45 2.61 B 3.91 -1.91 4 A 3.2 1.2 -12.3 4 Frame 2 B 5.47 -3.45 2.61 B 3.91 -1.93 3.1 A 3.2 1.2 -22.4 A 3.2 1.2 -12.3 3 Frame 3 A 5.67 -3.45 2.61 B 3.91 -1.91 4 C 3.2 1.2 -12.3
- Parameters
- filefile object
The input XYZ file.
- frameIdKeystr , optional
The desired id key to use to store the ID of each frame in its dictionary. Default is “id”.
- vertexIdKeystr , optional
The desired id key to use to store the ID of each point in its dictionary. Default is “id”.
- 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
- list
The list of frames (topologic_core.Cluster).
- static ByXYZPath(path, frameIdKey='id', vertexIdKey='id', tolerance: float = 0.0001, silent: bool = False)
Imports the topology from an XYZ file path. This is a very experimental method. While variants of the format exist, topologicpy reads XYZ files that conform to the following: An XYZ file can be made out of one or more frames. Each frame will be stored in a sepatate topologic cluster. First line: total number of vertices in the frame. This must be an integer. No other words or characters are allowed on this line. Second line: frame label. This is free text and will be stored in the dictionary of each frame (topologic_core.Cluster) All other lines: vertex_label, x, y, and z coordinates, separated by spaces, tabs, or commas. The vertex label must be one word with no spaces. It is stored in the dictionary of each vertex.
Example: 3 Frame 1 A 5.67 -3.45 2.61 B 3.91 -1.91 4 A 3.2 1.2 -12.3 4 Frame 2 B 5.47 -3.45 2.61 B 3.91 -1.93 3.1 A 3.2 1.2 -22.4 A 3.2 1.2 -12.3 3 Frame 3 A 5.67 -3.45 2.61 B 3.91 -1.91 4 C 3.2 1.2 -12.3
- Parameters
- pathstr
The input XYZ file path.
- frameIdKeystr , optional
The desired id key to use to store the ID of each frame in its dictionary. Default is “id”.
- vertexIdKeystr , optional
The desired id key to use to store the ID of each point in its dictionary. Default is “id”.
- 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
- list
The list of frames (topologic_core.Cluster).
- static CanonicalMatrix(topology, n: int = 10, normalize: bool = False, mantissa: int = 6, silent: bool = False)
Returns the canonical transformation matrices of the input topology.
The PythonOCC fast path reuses
Topology.PrincipalAxesinstead of creating an n-by-n point grid on every face and running a second PCA. If any native prerequisite is unavailable, the preserved legacy implementation is used unchanged.
- static CellComplexes(topology, silent: bool = False)
Returns the cellcomplexes of the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of cellcomplexes.
- static Cells(topology, silent: bool = False)
Returns the cells of the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of cells.
- static CenterOfMass(topology, silent: bool = False)
Returns the geometric center of mass of the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Vertex
The center of mass, or None if it cannot be computed.
- static Centroid(topology, silent: bool = False)
Returns the geometric centroid of the input topology.
This is an alias for
Topology.CenterOfMass().- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Vertex
The centroid, or None if it cannot be computed.
- static Cleanup(topology=None, silent: bool = False)
Cleans up all resources in which are managed by topologic library. Use this to manage your application’s memory consumption. USE WITH CARE. This methods deletes dictionaries, contents, and contexts
- Parameters
- topologytopologic_core.Topology , optional
If specified the resources used by the input topology will be deleted. If not, ALL resources will be deleted.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The input topology, but with its resources deleted or None.
- static ClusterByKeys(topologies, *keys, silent: bool = False)
Clusters the input list of topologies based on the input key or keys.
- Parameters
- topologieslist
The input list of topologies.
- keysstr or list or comma-separated str input parameters
The key or keys in the topology dictionaries to use for clustering.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
A nested list of topologies where each element is a list of topologies with the same key values.
- static ClusterFaces(topology, angTolerance=2, tolerance=0.0001, silent: bool = False)
Clusters the faces of the input topology by their direction.
- Parameters
- topologytopologic_core.Topology
The input topology.
- 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 False.
- Returns
- list
The list of clusters of faces where faces in the same cluster have the same direction.
- static Clusters(topology, silent: bool = False)
Returns the clusters of the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of clusters.
- static Contains(topologyA, topologyB, tolerance: float = 0.0001, silent: bool = False)
Returns True if the input topologyA contains the input topologyB. Returns False otherwise.
Containment means that topologyB lies completely within topologyA and does not intersect the external boundary of topologyA.
- Parameters
- topologyAtopologic_core.Topology
The input containing topology.
- topologyBtopologic_core.Topology
The input contained topology.
- 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
- bool
True if topologyA contains topologyB. False otherwise. Returns None if either input is invalid.
- static Contents(topology, silent: bool = False)
Returns the contents of the input topology
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of contents of the input topology.
- static Contexts(topology, silent: bool = False)
Returns the list of contexts of the input topology
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of contexts of the input topology.
- static ConvexHull(topology, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Computes the convex hull of the input topology. Returns a Face in 2D (even embedded in 3D), or a Cell/Shell in 3D.
- Parameters
- topologytopologic_core.Topology
The input Topology.
- mantissaint, optional
Precision of the coordinates. Default is 6.
- tolerancefloat, optional
Tolerance value for geometric operations. Default is 0.0001.
- silentbool, optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The convex hull of the topology as a Face (2D) or Cell/Shell (3D).
- static Copy(topology, deep: bool = False, silent: bool = False, returnProvenance: bool = False)
Returns a copy of the input topology.
For non-TopologicCore backends, copying is delegated directly to the active backend. A shallow copy duplicates the native topology and parent dictionary. A deep copy additionally preserves dictionaries associated with native subtopologies.
The legacy BREP and JSON serialization mechanisms are retained only for the TopologicCore backend.
- Parameters
- topologytopologic_core.Topology
The input topology.
- deepbool , optional
If set to True, a deep copy is performed, including dictionaries associated with subtopologies. Otherwise, a shallow native copy is performed. Default is False.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- returnProvenancebool , optional
If True, return (result, Provenance) with exact native correspondence for the root and supported subtopologies, independently of dictionary transfer. Unsupported capture or a failed operation is explicitly reported by provenance.supported=False. Default is False.
- Returns
- topologic_core.Topology or tuple
A copy of the input topology, or None if the operation fails.
- static CoveredBy(topologyA, topologyB, tolerance: float = 0.0001, silent: bool = False)
Returns True if the input topologyA is covered by the input topologyB. Returns False otherwise.
CoveredBy is the inverse of Covers.
- Parameters
- topologyAtopologic_core.Topology
The input covered topology.
- topologyBtopologic_core.Topology
The input covering topology.
- 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
- bool
True if topologyA is covered by topologyB. False otherwise. Returns None if either input is invalid.
- static Covers(topologyA, topologyB, tolerance: float = 0.0001, silent: bool = False)
Returns True if the input topologyA covers the input topologyB. Returns False otherwise.
Coverage means that no part of topologyB lies outside topologyA. Boundary contact is allowed.
- Parameters
- topologyAtopologic_core.Topology
The input covering topology.
- topologyBtopologic_core.Topology
The input covered topology.
- 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
- bool
True if topologyA covers topologyB. False otherwise. Returns None if either input is invalid.
- static Crosses(topologyA, topologyB, tolerance: float = 0.0001, silent: bool = False)
Returns True if the input topologyA crosses the input topologyB. Returns False otherwise.
Crossing means that the two topologies intersect in a manner where their interiors intersect, but neither topology simply contains or covers the other. For one-dimensional topologies, crossing occurs when the intersection is an interior point of both topologies rather than a shared segment or endpoint contact.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- 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
- bool
True if topologyA crosses topologyB. False otherwise. Returns None if either input is invalid.
- static Decompose(topology, tiltAngle: float = 10.0, normalSpreadAngle: float = 30.0, tolerance: float = 0.0001, silent: bool = False) dict
Decomposes the input topology into its logical components.
This method assumes: 1. The input topology is either a Cell, a CellComplex, or a Cluster containing one or more Faces. 2. The positive Z direction [0, 0, 1] represents UP.
- Parameters
- topologytopologic_core.Topology
The input topology. This should be a Cell, CellComplex, or Cluster containing one or more Faces.
- tiltAnglefloat , optional
The threshold tilt angle in degrees used to classify a Face as vertical, horizontal, or inclined. The angle is measured from the nearest cardinal direction. Default is 10.
- normalSpreadAnglefloat , optional
The maximum angular deviation, in degrees, that sampled surface normals may have from their mean normal before a non-planar Face is classified as curved. Slightly curved Faces whose normals remain coherent are still classified as vertical, horizontal, or inclined. Default is 30.
- 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
- dict
A dictionary containing the decomposed Cells, Faces, and Apertures. The returned keys are:
“cells”
“externalVerticalFaces”
“internalVerticalFaces”
“topHorizontalFaces”
“bottomHorizontalFaces”
“internalHorizontalFaces”
“externalInclinedFaces”
“internalInclinedFaces”
“externalVerticalApertures”
“internalVerticalApertures”
“topHorizontalApertures”
“bottomHorizontalApertures”
“internalHorizontalApertures”
“externalInclinedApertures”
“internalInclinedApertures”
“freeVerticalFaces”
“freeHorizontalFaces”
“freeInclinedFaces”
“freeVerticalApertures”
“freeHorizontalApertures”
“freeInclinedApertures”
“verticalFaces”
“horizontalFaces”
“inclinedFaces”
Returns None if the input topology is invalid.
- static DeepCopy(topology, silent: bool = False)
Returns an independent deep copy of the input topology.
This is a convenience alias for
Topology.Copy(topology, deep=True). On PythonOCC, native OCCT geometry and subtopology dictionaries are copied through the backend’s exact shape-copy mapping. On TopologicCore, the existing serialized deep-copy fallback is used.- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
An independent deep copy, or None if copying fails.
- static Deform(topology, deformation, origin=None, parameters=None, subdivisions: int = 8, degree: int = 3, transferDictionaries: bool = True, tolerance: float = 0.0001, silent: bool = False)
Deforms the input topology through the active geometry backend.
The PythonOCC backend implements this as a NURBS control-geometry deformation. The public API deliberately contains no OpenCASCADE or PythonOCC-specific logic.
- Parameters
- topologytopologic_core.Topology
The input topology.
- deformationstr or callable
The deformation field. The PythonOCC backend currently supports the named fields
"taper","twist", and"bend". A callable may alternatively accept(x, y, z)or(x, y, z, context)and return three coordinates.- origintopologic_core.Vertex , optional
The deformation origin. If None, the backend determines an appropriate default. Default is None.
- parametersdict , optional
Parameters consumed by the named deformation field. Default is None.
- subdivisionsint , optional
Minimum number of NURBS knot spans introduced by the backend where additional control freedom is needed. Default is 8.
- degreeint , optional
Minimum NURBS degree used by the backend. Existing higher degrees are retained. Default is 3.
- transferDictionariesbool , optional
If True, dictionaries are transferred to corresponding result topologies. Default is True.
- tolerancefloat , optional
The desired geometric tolerance. Default is 0.0001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The deformed topology, or None if the active backend does not support NURBS control-geometry deformation or if the operation fails.
- static Degree(topology, hostTopology, silent: bool = False)
Returns the number of immediate supertopologies that use the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- hostTopologytopologic_core.Topology
The input host topology to which the input topology belongs.
- silentbool, optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- int
The degree of the topology, defined as the number of immediate supertopologies that use the input topology.
- static Diameter(topology, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Computes the diameter of the convex hull of the given topology. The diameter is the maximum distance between any two vertices on the convex hull.
- Parameters
- topologytopologic_core.Topology
The input topology
- 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
- float
The diameter of the convex hull of the topology.
- static Dictionary(topology, silent: bool = False)
Returns the dictionary of the input topology.
- Parameters
- topologytopologic_core.Topology or topologicpy.TGraph
The input topology or graph.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Dictionary
The dictionary of the input topology or graph.
- static Difference(topologyA, topologyB, tranDict: bool = False, tolerance: float = 0.0001, silent: bool = False, returnProvenance: bool = False)
Subtracts topologyB from topologyA. See https://en.wikipedia.org/wiki/Boolean_operation.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- tranDictbool , optional
If set to True the dictionaries of the operands are merged and transferred to the result. 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.Topology
the resultant topology.
- static Dimensionality(topology, silent: bool = False)
Returns the dimensionality of the input topology.
- Parameters
- topologytopologic_core.Topology or topologicpy.TGraph
The input topology or graph.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- int
The dimensionality of the input topology or graph.
- static Disjoint(topologyA, topologyB, tolerance: float = 0.0001, silent: bool = False)
Returns True if the input topologyA is disjoint from the input topologyB. Returns False otherwise.
Two topologies are disjoint if they do not intersect.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- 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
- bool
True if topologyA is disjoint from topologyB. False otherwise. Returns None if either input is invalid.
- static Divide(topologyA, topologyB, transferDictionary=False, addNestingDepth=False, silent: bool = False)
Divides the input topology by the input tool and places the results in the contents of the input topology.
- Parameters
- topologyAtopologic_core.Topology
The input topology to be divided.
- topologyBtopologic_core.Topology
the tool used to divide the input topology.
- transferDictionarybool , optional
If set to True the dictionary of the input topology is transferred to the divided topologies.
- addNestingDepthbool , optional
If set to True the nesting depth of the division is added to the dictionaries of the divided topologies.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The input topology with the divided topologies added to it as contents.
- static Edges(topology, silent: bool = False)
Returns the edges of the input topology or graph.
- Parameters
- topologytopologic_core.Topology or topologicpy.TGraph
The input topology or graph.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of edges.
- static Equals(topologyA, topologyB, tolerance: float = 0.0001, silent: bool = False)
Returns True if the input topologyA is equal to the input topologyB. Returns False otherwise.
Two topologies are considered equal if their symmetric difference is None within the specified tolerance. For CellComplex inputs, the external boundary is used for comparison.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- 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
- bool
True if topologyA is equal to topologyB. False otherwise. Returns None if either input is invalid.
- static Explode(topology, origin=None, scale: float = 1.25, typeFilter: str = None, axes: str = 'xyz', transferDictionaries: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Explodes the input topology. See https://en.wikipedia.org/wiki/Exploded-view_drawing.
- Parameters
- topologytopologic_core.Topology or topologicpy.TGraph
The input topology or graph.
- origintopologic_core.Vertex , optional
The origin of the explosion. If set to None, the centroid of the input topology will be used. Default is None.
- scalefloat , optional
The scale factor of the explosion. Default is 1.25.
- typeFilterstr , optional
The type of the subtopologies to explode. This can be any of “vertex”, “edge”, “face”, or “cell”. If set to None, a subtopology one level below the type of the input topology will be used. Default is None.
- axesstr , optional
Sets what axes are to be used for exploding the topology. This can be any permutation or substring of “xyz”. It is not case sensitive. Default is “xyz”.
- transferDictionariesbool , optional
If set to True, the dictionaries of the original subTopologies are transferred to the exploded topologies. Otherwise, they are not. Default is False.
- 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.Cluster
The exploded topology.
- static ExportTo3DM(topologies, path: str, overwrite: bool = False, version: int = 8, tolerance: float = 0.0001, silent: bool = False) bool
Exports topology to a Rhino
.3dmfile.This is a thin convenience wrapper around
topologicpy.Rhino.Rhino.ExportTo3DM(). An unchanged complete list returned byTopology.By3DMPath()is round-tripped losslessly.- Parameters
- topologieslist or topologic_core.Topology
The input topology or list of topologies.
- pathstr or os.PathLike
The output file path.
.3dmis appended when absent.- overwritebool, optional
If True, an existing file may be overwritten. Default is False.
- versionint, optional
Rhino archive version used for newly-created documents. Default is 8.
- tolerancefloat, optional
Model and tessellation tolerance. Default is 0.0001.
- silentbool, optional
If True, suppress warnings and errors. Default is False.
- Returns
- bool
True when the file was written successfully, otherwise False.
- static ExportToBIM(topologies, path: str, overwrite: bool = False, version: str = '1.0.0', guidKey: str = 'guid', colorKey: str = 'color', typeKey: str = 'type', defaultColor: list = [255, 255, 255, 1], defaultType: str = 'Structure', author: str = 'topologicpy', mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Exports the input topology to a BIM file. See https://dotbim.net/
- Parameters
- topologieslist or topologic_core.Topology
The input list of topologies or a single topology. The .bim format is restricted to triangulated meshes. No wires, edges, or vertices are supported.
- pathstr
The input file path.
- overwritebool , optional
If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won’t. Default is False.
- versionstr , optional
The desired version number for the BIM file. Default is “1.0.0”.
- guidKeystr , optional
The key to use to find the the guid of the topology. It is case insensitive. Default is “guid”. If no guid is found, one is generated automatically.
- colorKeystr , optional
The key to use to find the the color of the topology. It is case insensitive. Default is “color”. If no color is found, the defaultColor parameter is used.
- typeKeystr , optional
The key to use to find the the type of the topology. It is case insensitive. Default is “type”. If no type is found, the defaultType parameter is used.
- defaultColorlist , optional
The default color to use for the topology. Default is [255,255,255,1] which is opaque white.
- defaultTypestr , optional
The default type to use for the topology. Default is “Structure”.
- authorstr , optional
The author of the topology. Default is “topologicpy”.
- datestr , optional
The creation date of the topology. This should be in the formate “DD.MM.YYYY”. Default is None which uses the date of export.
- 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
- bool
True if the export operation is successful. False otherwise.
- static ExportToBREP(topology, path, overwrite=False, version=3, silent: bool = False)
Exports the input topology to a BREP file. See https://dev.opencascade.org/doc/occt-6.7.0/overview/html/occt_brep_format.html.
- Parameters
- topologytopologic_core.Topology
The input topology.
- pathstr
The input file path.
- overwritebool , optional
If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won’t. Default is False.
- versionint , optional
The desired version number for the BREP file. Default is 3.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- bool
True if the export operation is successful. False otherwise.
- ExportToDXF(path: str, overwrite: bool = False, mantissa: int = 6, silent: bool = False)
Exports the input topology to a DXF file. See https://en.wikipedia.org/wiki/AutoCAD_DXF. THe DXF version is ‘R2010’ This is experimental and only geometry is exported.
- Parameters
- topologieslist or topologic_core.Topology
The input list of topologies. This can also be a single topologic_core.Topology.
- pathstr
The input file path.
- overwritebool , optional
If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won’t. Default is False.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- bool
True if the export operation is successful. False otherwise.
- static ExportToJSON(topologies, path, overwrite: bool = False, silent: bool = False)
Exports the input list of topologies to a JSON file.
- Parameters
- topologieslist
The input list of topologies.
- pathstr
The path to the JSON file.
- overwritebool , optional
If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won’t. Default is False.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- bool
The status of exporting the JSON file. If True, the operation was successful. Otherwise, it was unsuccesful.
- static ExportToOBJ(*topologies, path, nameKey='name', colorKey='color', opacityKey='opacity', defaultColor=[256, 256, 256], defaultOpacity=0.5, transposeAxes: bool = True, triangulate: bool = False, mode: int = 0, meshSize: float = None, overwrite: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Exports the input topology to a Wavefront OBJ file. This is very experimental and outputs a simple solid topology.
- Parameters
- topologieslist or comma separated topologies
The input list of topologies.
- pathstr
The input file path.
- nameKeystr , optional
The topology dictionary key under which to find the name of the topology. Default is “name”.
- colorKeystr, optional
The topology dictionary key under which to find the color of the topology. Default is “color”.
- opacityKeystr , optional
The topology dictionary key under which to find the opacity of the topology. Default is “opacity”.
- defaultColorlist , optional
The default color to use if no color is stored in the topology dictionary. Default is [255,255, 255] (white).
- defaultOpacityfloat , optional
The default opacity to use of no opacity is stored in the topology dictionary. This must be between 0 and 1. Default is 1 (fully opaque).
- transposeAxesbool , optional
If set to True the Z and Y coordinates are transposed so that Y points “up”
- triangulatebool , optional
If set to True, all faces of the input geometry are triangulated. Otherwise, only faces with holes are triangulated. Default is False.
- modeint , optional
The desired mode of meshing algorithm (for triangulation). Several options are available: 0: Classic 1: MeshAdapt 3: Initial Mesh Only 5: Delaunay 6: Frontal-Delaunay 7: BAMG 8: Fontal-Delaunay for Quads 9: Packing of Parallelograms All options other than 0 (Classic) use the gmsh library. See https://gmsh.info/doc/texinfo/gmsh.html#Mesh-options WARNING: The options that use gmsh can be very time consuming and can create very heavy geometry.
- meshSizefloat , optional
The desired size of the mesh when using the “mesh” option. If set to None, it will be calculated automatically and set to 10% of the overall size of the face.
- overwritebool , optional
If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won’t. Default is False.
- 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
- bool
True if the export operation is successful. False otherwise.
- static ExportToSTEP(topology, path, overwrite: bool = False, schema: str = 'AP242DIS', unit: str = 'MM', assembly='auto', tolerance=None, silent: bool = False) bool
Exports a topology to neutral STEP BREP geometry.
STEP is a tolerance-based CAD interchange format rather than TopologicPy-native semantic persistence. Analytic curves, Bezier/ BSpline/NURBS curves and surfaces are transferred as BRep geometry without tessellation, subject to the capabilities of the STEP translator. TopologicPy dictionaries, Contents, Apertures, Contexts, and stable subtopology identity are not guaranteed to survive.
- Parameters
- topologytopologicpy.Topology
The input topology.
- pathstr or os.PathLike
The output STEP path.
- overwritebool , optional
If True, an existing file may be overwritten. Default is False.
- schemastr , optional
STEP schema. Default is
"AP242DIS".- unitstr , optional
STEP length unit. Default is
"MM".- assemblybool, int, or str , optional
STEP assembly mode. Accepted values are False, True, 0, 1, 2, or
"off","on","auto". Default is"auto".- tolerancefloat , optional
STEP writer tolerance. Default is None.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- bool
True if the STEP file was written successfully, otherwise False.
- static ExportToTPY(topology, path, overwrite: bool = False, includeSubtopologyDictionaries: bool = True, includeContents: bool = True, includeApertures: bool = True, tolerance: float = 0.0001, silent: bool = False) bool
Exports a topology to TopologicPy’s native TPY persistence format.
TPY preserves exact BREP geometry together with TopologicPy dictionaries and, by default, dictionaries on constituent subtopologies, Contents, Apertures, and Context parameters. The archive is a versioned ZIP/JSON container and does not use pickle.
- Parameters
- topologytopologicpy.Topology
The input topology.
- pathstr or os.PathLike
The output TPY path.
- overwritebool , optional
If True, an existing file may be overwritten. Default is False.
- includeSubtopologyDictionariesbool , optional
If True, dictionaries attached to constituent subtopologies are persisted. Default is True.
- includeContentsbool , optional
If True, Content topology relationships are persisted recursively. Default is True.
- includeAperturesbool , optional
If True, native Aperture relationships are persisted recursively. Default is True.
- tolerancefloat , optional
Geometric tolerance used by compatibility fallbacks when restoring relationships. Default is 0.0001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- bool
True if the TPY archive was written successfully, otherwise False.
- static ExternalBoundary(topology, silent: bool = False)
Returns the external boundary of the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The external boundary of the input topology.
- static Faces(topology, silent: bool = False)
Returns the faces of the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of faces.
- static Filter(topologies, topologyType: str = 'any', searchType: str = 'any', key: str = None, value=None, silent: bool = None)
Filters the input list of topologies based on the input parameters.
- Parameters
- topologieslist
The input list of topologies.
- topologyTypestr , optional
The type of topology to filter by. This can be one of “any”, “vertex”, “edge”, “wire”, “face”, “shell”, “cell”, “cellcomplex”, or “cluster”. It is case insensitive. Default is “any”.
- searchTypestr , optional
The type of search query to conduct in the topology’s dictionary. This can be one of “any”, “equal to”, “contains”, “starts with”, “ends with”, “not equal to”, or “does not contain”. It is case insensitive. Wildcard matching using shell-style patterns is supported in all search types through the use of “*” and “?”. Default is “any”.
- keystr , optional
The dictionary key to search within. Default is None which means it will filter by topology type only.
- valueany , optional
The value to search for at the specified key. Default is None which means it will filter by topology type only.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- dict
A dictionary with the following keys: - “filtered”: the filtered topologies. - “other”: the other topologies that did not meet the filter criteria.
- static Fix(topology, topologyType: str = 'CellComplex', tolerance: float = 0.0001, silent: bool = False)
Attempts to fix or coerce the input topology to the requested topology type without replacing curved Edges or Face supporting surfaces.
Existing subtopologies are reused whenever possible. The method may sew existing Edges into Wires, existing Faces into Shells or Cells, and existing Cells into CellComplexes. It does not construct Edges from Vertices or Faces from Wires because those operations can discard native curve and surface geometry.
- Parameters
- topologytopologic_core.Topology
The input topology.
- topologyTypestr , optional
The desired output topology type. Supported values are “vertex”, “edge”, “wire”, “face”, “shell”, “cell”, “cellcomplex”, and “cluster”. The value is case-insensitive. Default is “CellComplex”.
- tolerancefloat , optional
The desired topology tolerance. Default is 0.0001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The resulting topology. If the requested type cannot be achieved without reconstructing lower-dimensional geometry, the original topology is returned.
- static Flatten(topology, origin=None, direction: list = [0, 0, 1], transferDictionaries=True, mantissa: int = 6, silent: bool = False)
Flattens the input topology such that the input origin is located at the world origin and the input topology is rotated such that the input vector is pointed in the Up direction (see Vector.Up()).
- Parameters
- topologytopologic_core.Topology
The input topology.
- origintopologic_core.Vertex , optional
The input origin. If set to None, The object’s centroid will be used to place the world origin. Default is None.
- directionlist , optional
The input direction vector. The input topology will be rotated such that this vector is pointed in the positive Z axis.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- transferDictionariesbool , optional
If set to True, the dictionaries are transfered from the original object to the translated object. Default is True.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The flattened topology.
- static Geometry(topology, transferDictionaries: bool = False, triangulate: bool = False, mode: int = 0, meshSize: float = None, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Returns the geometry of the input topology in mesh-data form.
On PythonOCC, the default dictionary-free
mode == 0path uses a shared native OCCT extraction engine. Faces with holes are triangulated natively even whentriangulateis False, preserving the established Geometry contract. Dictionary-bearing and gmsh modes retain the proven implementation unchanged.
- static HighestType(topology, silent: bool = False)
Returns the highest topology type found in the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- Returns
- int
The highest type found in the input topology.
- static Impose(topologyA, topologyB, tranDict: bool = False, tolerance: float = 0.0001, silent: bool = False, returnProvenance: bool = False)
Imposes topologyB on topologyA. See https://en.wikipedia.org/wiki/Boolean_operation.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- tranDictbool , optional
If set to True the dictionaries of the operands are merged and transferred to the result. 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.Topology
the resultant topology.
- static Imprint(topologyA, topologyB, tranDict: bool = False, tolerance: float = 0.0001, silent: bool = False, returnProvenance: bool = False)
Imprints topologyB on topologyA. See https://en.wikipedia.org/wiki/Boolean_operation.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- tranDictbool , optional
If set to True the dictionaries of the operands are merged and transferred to the result. 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.Topology
the resultant topology.
- static Inherit(targets, sources, keys: list = None, exclusive: bool = True, tolerance: float = 0.0001, silent: bool = False)
Transfers dictionary information from topologiesB to topologiesA based on co-location of internal vertices.
- Parameters
- targetslist of topologic_core.Topology
The list of target topologies that will inherit the dictionaries.
- sourceslist of topologic_core. Topology
The list of source topologies from which to inherit dictionary information.
- exclusivebool , optional
If set to True, a target will inherit information only from the first eligible source. 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
- list
The list of target topologies with the dictionary information inherited from the list of source topologies.
- static InternalVertex(topology, timeout: int = 30, tolerance: float = 0.0001, silent: bool = False)
Returns a vertex guaranteed to be internal to the input topology.
The timeout parameter is retained for backward API compatibility but is not used. Python threads cannot safely interrupt a blocking topology-kernel operation; the previous thread-based timeout therefore did not provide a reliable hard timeout.
- Parameters
- topologytopologic_core.Topology
The input topology.
- timeoutint , optional
Retained for backward compatibility. It has no effect. Default is 30.
- 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.Vertex
An internal Vertex, or None if one cannot be computed.
- static Intersect(topologyA, topologyB, tranDict: bool = False, tolerance: float = 0.0001, silent: bool = False, returnProvenance: bool = False)
Finds the intersection between the input operand topologies. See https://en.wikipedia.org/wiki/Boolean_operation.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- tranDictbool , optional
If set to True the dictionaries of the operands are merged and transferred to the result. 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.Topology
The resultant topology.
- static IsInstance(topology, type: str, silent: bool = True)
Returns True if the input topology is an instance of the class specified by the input type string.
- Parameters
- topologytopologic_core.Topology
The input topology.
- typestr
The topology type string to compare against. Acceptable values are “vertex”, “edge”, “wire”, “face”, “shell”, “cell”, “cellcomplex”, “cluster”, “topology”, “context”, “aperture”, “dictionary”, “graph”, “tgraph”. It is case insensitive.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Vertex
A vertex guaranteed to be inside the input topology.
- static IsPlanar(topology, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Returns True if the complete geometry of the input topology is planar.
Unlike a vertex-only coplanarity test, this method also samples curved Edges and checks the actual supporting surfaces of Faces. Therefore a planar arc returns True, while a helix or cylindrical Face returns False even when its topological vertices alone would be insufficient to reveal the curvature.
- Parameters
- topologytopologic_core.Topology
The input topology.
- mantissaint , optional
The number of decimal places used when collecting sample-point coordinates. Default is 6.
- tolerancefloat , optional
The geometric coplanarity tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- bool
True if the complete topology lies in one plane, False otherwise. Returns None if the input or parameters are invalid.
- static IsSame(topologyA, topologyB, silent: bool = False)
Returns True if the input topologies are the same topology. Returns False otherwise.
- Parameters
- topologyAtopologic_core.Topology or topologicpy.TGraph
The first input topology or graph.
- topologyBtopologic_core.Topology or topologicpy.TGraph
The second input topology or graph.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- bool
True if the input topologies or graphs are the same. False otherwise.
- static IsSimilar(topologyA, topologyB, removeCoplanarFaces: bool = False, mantissa: int = 6, epsilon: float = 0.1, tolerance: float = 0.0001, silent: bool = False)
Calculates if the input topologies are similar. See https://en.wikipedia.org/wiki/Similarity_(geometry).
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- removeCoplanarFacesbool , optional
If set to True, coplanar faces are removed. Otherwise they are not. Default is False.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- epsilonfloat , optional
The desired epsilon (another form of percentage tolerance) for finding if two objects are similar. Should be in the range 0 to 1. Default is 0.1 (10%).
- 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
- tuple
True if the input topologies are similar, False otherwise, together with the matrix needed to transform topologyA to match topologyB. If the topologies are not similar, the transformation matrix is None.
- static IsVertexCongruent(topologyA, topologyB, mantissa: int = 6, epsilon: float = 0.1, tolerance: float = 0.0001, silent: bool = False)
Returns True if the input topologies are vertex congruent (have same number of vertices and all vertices are congruent within a tolerance). Returns False otherwise.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- epsilonfloat , optional
The desired accepted tolerance for the number of matched number of vertices. For example, an epsilon of 0.1 indicates that the algorithm will return True even if 10% of the vertices do not match. 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 False.
- Returns
- bool
True of the input topologies are vertex congruent. False otherwise.
- static JSONString(topologies, mantissa: int = 6, silent: bool = False)
Exports the input list of topologies to a JSON string
- Parameters
- topologieslist or topologic_core.Topology
The input list of topologies or a single topology.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- Returns
- bool
The status of exporting the JSON file. If True, the operation was successful. Otherwise, it was unsuccesful.
- static LargestFaces(topology, removeCoplanarFaces: bool = False, epsilon: float = 0.001, tolerance: float = 0.0001, silent: bool = False)
Returns the list of the largest faces found in the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- removeCoplanarFacesbool , optional
If set to True, coplanar faces are removed to find the true largest faces. Otherwise they are not. Default is False.
- epsilonfloat , optional
The desired epsilon (another form of tolerance) for finding if two faces are coplanar. Default is 0.01.
- 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
- ——-
- list
The list of the largest faces found in the input topology.
- static Load(path, silent: bool = False)
Loads a topology using the codec selected by the input extension.
- Parameters
- pathstr or os.PathLike
The input path. The filename extension selects the codec.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologicpy.Topology
The loaded topology, or None if loading fails.
- static LongestEdges(topology, removeCoplanarFaces: bool = False, epsilon: float = 0.001, tolerance: float = 0.0001, silent: bool = False)
Returns the list of the longest edges found in the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- removeCoplanarFacesbool , optional
If set to True, coplanar faces are removed to find the true longest straight edges. Otherwise they are not. Default is False.
- epsilonfloat , optional
The desired epsilon (another form of tolerance) for finding if two faces are coplanar. Default is 0.01.
- 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
- ——-
- list
The list of of the longest edges found in the input topology.
- static Merge(topologyA, topologyB, tranDict: bool = False, tolerance: float = 0.0001, silent: bool = False, returnProvenance: bool = False)
Merges the input operand topologies. See https://en.wikipedia.org/wiki/Boolean_operation.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- tranDictbool , optional
If set to True the dictionaries of the operands are merged and transferred to the result. 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.Topology
the resultant topology.
- static MergeAll(*topologies, tolerance: float = 0.0001, silent: bool = False)
Merges all input topologies.
- Parameters
- *topologiestopologic_core.Topology
The input topologies to merge.
- 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.Topology
The resulting merged topology.
- static Mesh(topology, minSize: float = 0.1, maxSize: float = 1.0, algorithm2D: int = 1, algorithm3D: int = 1, refineEdges: bool = True, refineFaces: bool = True, optimize: bool = True, meshDim: int = None, mantissa: int = 6, silent: bool = False, recombine: bool = None)
Uses gmsh to create indexed surface/volume mesh data.
Unlike
Topology.Tessellate(), this method is a general numerical mesher. Surfacefacesmay contain triangles or quads and volumecellsmay contain supported first-order gmsh elements. The returned data follows the sametopologicpy.mesh/1schema as Tessellate.- Parameters
- topologytopologicpy.Topology
The input topology.
- minSizefloat , optional
The minimum target element size. Default is 0.1.
- maxSizefloat , optional
The maximum target element size. Default is 1.0. A value equal to
minSizerequests a uniform target size.- algorithm2Dint , optional
The gmsh 2D algorithm selector: 1 MeshAdapt, 2 Automatic, 3 Initial mesh only, 4 Delaunay, 5 Frontal-Delaunay, 6 BAMG, 7 Frontal-Delaunay for Quads, 8 Packing of Parallelograms, or 9 Quasi-structured Quad. Default is 1.
- algorithm3Dint , optional
The gmsh 3D algorithm selector: 1 Delaunay, 2 Initial mesh only, 3 Frontal, 4 MMG3D, 5 R-tree, or 6 HXT. Default is 1.
- refineEdgesbool , optional
If True, the size field is refined near model edges. Default is True.
- refineFacesbool , optional
If True, the size field is refined near model faces. Default is True.
- optimizebool , optional
If True, gmsh optimization is requested after generation. Default is True.
- meshDimint , optional
2 for surface meshing, 3 for volume meshing, or None to select 3 when the topology contains Cells and 2 otherwise. Default is None.
- mantissaint , optional
Number of decimal places retained in returned coordinates. Default is 6.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- recombinebool , optional
If True, gmsh is asked to recombine surface triangles into quads. If None, quad-oriented 2D algorithms enable recombination automatically. Default is None.
- Returns
- dict
Mesh data with required keys
schema,vertices,faces,cells, andmetadata.facesmay contain three- or four-index elements. Transitional aliasesverts,tris,quads, andtetsare also included.
- static MeshData(topology, mode: int = 1, transferDictionaries: bool = False, mantissa: int = 6, silent: bool = False)
Creates mesh data from the input topology.
The PythonOCC dictionary-free path now reads the native OCCT triangulation directly and builds indexed vertices, edges, triangular faces, and cell-to-face connectivity without first copying, triangulating, rebuilding, and re-traversing a Topologic topology. Dictionary transfer and aggregate Graph/Cluster cases retain the V2 implementation.
- static MeshToTopologies(vertices: list, faces: list = [], tets: list = [], tolerance: float = 0.0001, silent: bool = False)
Converts mesh data in the form of:
vertices: List[(x, y, z)] faces : List[(i0, i1, i2)] # unique triangular faces, 0-based tets : List[(i0, i1, i2, i3)] # tetrahedra (3D only; [] for 2D, 0-based)
into a list of topologic vertices, faces, and cells. This method is designed to work in conjunction with the Topology.Mesh method.
- Parameters
- verticeslist
The list of vertices coordinates in the form: List[(x, y, z)].
- faceslist , optional
The list of unique triangular faces in the form: List[(i0, i1, i2)]
- tetslist , optional
The list of tetrahedral cells in the form: List[i0, i1, ,i2, i3, i4]
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool, optional
If set to True, warning and error messages are suppressed. Default is False.
- Returns
- dict
“vertices”: List[topologic_core.Vertex] “faces” : List[topologic_core.Face] # triangles “cells” : List[topologicy_core.Cell] # tetrahedra (3D) or [] (2D)
- static Move(topology, x=0, y=0, z=0, transferDictionaries: bool = True, silent: bool = False)
Moves the input topology.
- Parameters
- topologytopologic_core.topology
The input topology.
- xfloat , optional
The x distance value. Default is 0.
- yfloat , optional
The y distance value. Default is 0.
- zfloat , optional
The z distance value. Default is 0.
- transferDictionariesbool , optional
If set to True, the dictionaries are transfered from the original object to the translated object. Default is True.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The moved topology.
- static NonPlanarFaces(topology, tolerance: float = 0.0001, silent: bool = False)
Returns any nonplanar faces in the input topology
- Parameters
- topologytopologic_core.Topology
The input topology.
- 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
- list
The list of nonplanar faces.
- static OBJString(*topologies, nameKey='name', colorKey='color', opacityKey='opacity', defaultColor=[255, 255, 255], defaultOpacity=0.5, transposeAxes: bool = True, triangulate: bool = False, mode: int = 0, meshSize: float = None, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Exports the input topology to Wavefront OBJ and MTL strings.
- Parameters
- topologieslist or comma separated topologies
The input topology or list of topologies.
- nameKeystr , optional
The topology dictionary key under which to find the name of the topology. Default is “name”.
- colorKeystr, optional
The topology dictionary key under which to find the color of the topology. Default is “color”.
- opacityKeystr , optional
The topology dictionary key under which to find the opacity of the topology. Default is “opacity”.
- defaultColorlist , optional
The default color to use if no color is stored in the topology dictionary. Default is [255, 255, 255].
- defaultOpacityfloat , optional
The default opacity to use if no opacity is stored in the topology dictionary. Default is 0.5.
- transposeAxesbool , optional
If set to True, the Z and Y coordinates are transposed so that Y points up. Default is True.
- triangulatebool , optional
If set to True, all faces of the input geometry are triangulated. Otherwise, only faces with holes are triangulated. Default is False.
- modeint , optional
The desired mode of meshing algorithm (for triangulation). Several options are available: 0: Classic 1: MeshAdapt 3: Initial Mesh Only 5: Delaunay 6: Frontal-Delaunay 7: BAMG 8: Fontal-Delaunay for Quads 9: Packing of Parallelograms All options other than 0 (Classic) use the gmsh library. See https://gmsh.info/doc/texinfo/gmsh.html#Mesh-options WARNING: The options that use gmsh can be very time consuming and can create very heavy geometry.
- meshSizefloat , optional
The desired size of the mesh when using the “mesh” option. If set to None, it will be calculated automatically and set to 10% of the overall size of the face.
- 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
- tuple
Returns the OBJ and MTL strings as a tuple.
- static OCCTShape(topology, silent: bool = False)
Returns the OCCT shape of the input topology.
Under PythonOCC, a Cluster without a stored native shape is represented by a temporary compound of its members, including nested Clusters. This does not change the Cluster’s stored members or dictionaries.
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- object
The underlying OCCT shape, or None if one cannot be retrieved.
- static OntologyClass(topology, defaultValue=None, silent: bool = False)
Returns the ontology class assigned to the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- Ontology.Class
The ontology class of the input topology
- static OntologyURI(topology, defaultValue=None, silent: bool = False)
Returns the ontology URI assigned to the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- str
The ontology URI of the input topology
- static OpenEdges(topology, silent: bool = True)
Returns the edges that border only one face
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of edges
- static OpenFaces(topology, silent: bool = False)
Returns the faces that border no cells
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of faces
- static OpenVertices(topology, silent: bool = False)
Returns the vertices that border only one edge
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of vertices
- static Orient(topology, origin=None, dirA=[0, 0, 1], dirB=[0, 0, 1], tolerance: float = 0.0001, silent: bool = False)
Orients the input topology such that dirA is parallel to dirB.
- Parameters
- topologytopologic_core.Topology
The input topology.
- origintopologic_core.Vertex , optional
The origin about which the topology is oriented. If set to None, the centroid of the topology is used. Default is None.
- dirAlist , optional
The source direction vector. Default is [0, 0, 1].
- dirBlist , optional
The target direction vector. Default is [0, 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 False.
- Returns
- topologic_core.Topology
The oriented topology.
- static OrientAndPlace(topology, originA=None, originB=None, dirA=[0, 0, 1], dirB=[0, 0, 1], transferDictionaries: bool = True, tolerance: float = 0.0001, silent: bool = False)
Orients and places the input topology using a single affine transformation.
- Parameters
- topologytopologic_core.Topology
The input topology.
- originAtopologic_core.Vertex , optional
The source origin about which the topology is oriented. If set to None, the centroid of the topology is used. Default is None.
- originBtopologic_core.Vertex , optional
The target location of originA. If set to None, originA is used and no placement translation is applied. Default is None.
- dirAlist , optional
The source direction vector. Default is [0, 0, 1].
- dirBlist , optional
The target direction vector. Default is [0, 0, 1].
- transferDictionariesbool , optional
If set to True, dictionaries are transferred to the transformed topology. 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.Topology
The oriented and placed topology.
- static Overlaps(topologyA, topologyB, tolerance: float = 0.0001, silent: bool = False)
Returns True if the input topologyA overlaps the input topologyB. Returns False otherwise.
Overlap means that the two topologies have the same dimensionality, are not equal, and their intersection produces a distinct topology of the same dimensionality. Cases where one topology covers the other are not considered overlaps.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- 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
- bool
True if topologyA overlaps topologyB. False otherwise. Returns None if either input is invalid.
- static Place(topology, originA=None, originB=None, mantissa: int = 6, silent: bool = False)
Places the input topology at the specified location.
- Parameters
- topologytopologic_core.Topology
The input topology.
- originAtopologic_core.Vertex , optional
The old location to use as the origin of the movement. If set to None, the centroid of the input topology is used. Default is None.
- originBtopologic_core.Vertex , optional
The new location at which to place the topology. If set to None, the world origin (0, 0, 0) is used. Default is None.
- mantissaint , optional
The number of decimal places to round the coordinates to. Default is 6.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The placed topology.
- static PrincipalAxes(topology, n: int = 10, mantissa: int = 6, silent: bool = False)
Returns the principal axes (vectors) of the input topology.
On the PythonOCC backend, exact OCCT mass properties are used for non-degenerate Faces, Shells, Cells, and CellComplexes. Symmetric, degenerate, aggregate, or unsupported cases fall back to the preserved sampling/PCA implementation. The
nparameter is retained for API compatibility and for the fallback path.
- static Proximity(topologyA, topologyB, proximityValues, proximityLabels, useShortestDistance: bool = False, tolerance: float = 0.0001, silent: bool = False)
Returns the proximity label between two input topologies.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topolgoyBtopologic_core.Topology
The second input topology.
- proximityValueslist
A list of distance threshold values sorted in ascending order.
- proximityLabelslist
A list of proximity labels corresponding to the proximityValues list.
- useShortestDistancebool , optional
If set to True, the shortest distance between the two input topologies is used. Otherwise, the distance between their centroids is used. 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
- str or None
The proximity label corresponding to the first threshold greater than or equal to the computed distance, or None if no threshold is matched.
- static RemoveCollinearEdges(topology, angTolerance: float = 0.1, polyhedron: bool = True, tolerance: float = 0.0001, silent: bool = False)
Removes collinear edges from the input topology.
On PythonOCC,
polyhedron=Falseprotects curved Edges while still allowing redundant adjacent linear Edges to be unified. On TopologicCore, mixed curved/linear topology is conservatively left unchanged whenpolyhedron=Falsebecause its legacy reconstruction path can flatten curved geometry.- Parameters
- topologytopologic_core.Topology
The input topology.
- angTolerancefloat , optional
The desired angular tolerance. Default is 0.1.
- polyhedronbool , optional
If True, the input is assumed to contain only linear Edge geometry. If False, curved Edges are protected. 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.Topology
The input topology with redundant collinear Edges removed.
- static RemoveContent(topology, contents, silent: bool = False)
Removes the input content list from the input topology
- Parameters
- topologytopologic_core.Topology
The input topology.
- contentslist
The input list of contents.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The input topology with the input list of contents removed.
- static RemoveCoplanarFaces(topology, epsilon: float = 0.01, tolerance: float = 0.0001, silent: bool = False)
Removes coplanar faces in the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- epsilonfloat, optional
The desired epsilon for determining whether neighbouring faces are coplanar. Default is 0.01.
- 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.Topology
The input topology with adjacent coplanar faces merged.
- static RemoveEdges(topology, edges=None, tolerance: float = 0.0001, silent: bool = False)
Removes the specified Edges from the input topology.
Edges bounding Faces cause their incident Faces to be removed. Free Edges are removed directly. Under the PythonOCC backend, native OCCT editing is attempted first so surviving curves and surfaces remain exact. If native editing is unavailable (for example, for a lightweight shapeless Cluster), the established legacy fallback is used.
- Parameters
- topologytopologicpy.Topology
The input topology.
- edgestopologicpy.Edge or list, optional
The Edge or list of Edges to remove. Default is None.
- 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
- topologicpy.Topology
The resulting topology, or None if no topology remains.
- static RemoveFaces(topology, faces=None, tolerance: float = 0.0001, silent: bool = False)
Removes the specified Faces from the input topology.
Under the PythonOCC backend, native OCCT editing is attempted first so surviving analytic, Bezier, and BSpline/NURBS surfaces remain exact. If native editing is unavailable, the established legacy fallback is used.
- Parameters
- topologytopologicpy.Topology
The input topology.
- facestopologicpy.Face or list, optional
The Face or list of Faces to remove. Default is None.
- 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
- topologicpy.Topology
The resulting topology, or None if no topology remains.
- static RemoveFacesBySelectors(topology, selectors: list = [], tolerance: float = 0.0001, silent: bool = False)
Removes faces that contain the input list of selectors (vertices) from the input topology
- Parameters
- topologytopologic_core.Topology
The input topology.
- selectorslist
The input list of selectors (vertices).
- 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.Topology
The input topology with the identified faces removed.
- static RemoveVertices(topology, vertices=None, tolerance: float = 0.0001, silent: bool = False)
Removes the specified Vertices from the input topology.
Removal cascades through incident Edges and Faces. Under the PythonOCC backend, native OCCT editing is attempted first so surviving curves and surfaces remain exact. If native editing is unavailable, the established legacy fallback is used.
- Parameters
- topologytopologicpy.Topology
The input topology.
- verticestopologicpy.Vertex or list, optional
The Vertex or list of Vertices to remove. Default is None.
- 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
- topologicpy.Topology
The resulting topology, or None if no topology remains.
- static ReplaceVertices(topology, verticesA: list = [], verticesB: list = [], mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Replaces vertices in the first input list with the corresponding vertices in the second input list and rebuilds the input topology. The two lists must have the same length.
The original topology structure and topology type are preserved whenever possible. Structured topologies such as Faces with internal boundaries and heterogeneous Clusters are rebuilt hierarchically rather than through a flattened geometry representation.
- Parameters
- topologytopologic_core.Topology
The input topology.
- verticesAlist
The vertices in the input topology to replace.
- verticesBlist
The replacement vertices. Each vertex corresponds by index to a vertex in verticesA.
- mantissaint , optional
The number of decimal places to which coordinates are rounded. Default is 6.
- tolerancefloat , optional
The desired tolerance used to match vertices. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The rebuilt topology with the requested vertices replaced, or None if the operation fails.
- static Rotate(topology, origin=None, axis: list = [0, 0, 1], angle: float = 0, angTolerance: float = 0.001, transferDictionaries: bool = True, returnProvenance: bool = False, tolerance: float = 0.0001, silent: bool = False)
Rotates the input topology while preserving its exact geometry.
The operation is delegated directly to the active geometry backend. No vertex-based reconstruction fallback is performed. Therefore, analytic curves, B-Splines, NURBS curves, and NURBS surfaces are preserved by the rotation.
- Parameters
- topologytopologic_core.Topology
The input topology.
- origintopologic_core.Vertex , optional
The origin (centre) of rotation. If None, the world origin (0, 0, 0) is used. Default is None.
- axislist , optional
The rotation-axis vector. Default is [0, 0, 1].
- anglefloat , optional
The rotation angle in degrees. Default is 0.
- angTolerancefloat , optional
Angles with an absolute value below this tolerance are ignored. Default is 0.001 degrees.
- transferDictionariesbool , optional
If True, dictionaries are transferred to corresponding subtopologies. Default is True.
- returnProvenancebool , optional
If True, return (result, Provenance) with exact native correspondence for the root and supported subtopologies, independently of dictionary transfer. Unsupported capture or a failed operation is explicitly reported by provenance.supported=False. Default is False.
- tolerancefloat , optional
The desired geometric tolerance. Default is 0.0001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology or tuple
The rotated topology.
- static RotateByEulerAngles(topology, origin=None, roll: float = 0, pitch: float = 0, yaw: float = 0, transferDictionaries: bool = True, returnProvenance: bool = False, angTolerance: float = 0.001, tolerance: float = 0.0001, silent: bool = False)
Rotate a topology using sequential Euler rotations.
Applies roll about the fixed X-axis, pitch about the fixed Y-axis, and yaw about the fixed Z-axis, in that order. Angles are in degrees. All rotations use the same origin.
- Parameters
- topologytopologic_core.Topology
The input topology.
- origintopologic_core.Vertex, optional
Rotation centre. If None or invalid, use the world origin.
- rollfloat, optional
Rotation about the X-axis in degrees. Default is 0.
- pitchfloat, optional
Rotation about the Y-axis in degrees. Default is 0.
- yawfloat, optional
Rotation about the Z-axis in degrees. Default is 0.
- transferDictionariesbool, optional
Transfer dictionaries during each rotation. Default is True.
- returnProvenancebool, optional
If True, return (result, provenance). Compose the initial copy and all three rotation histories so origins can be traced to the input topology. Capture is independent of dictionary transfer. Unsupported capture or failure is reported through provenance.supported=False. Default is False.
- angTolerancefloat, optional
Rotations below this angle tolerance are ignored. Default is 0.001 degrees.
- tolerancefloat, optional
Geometric tolerance. Default is 0.0001.
- silentbool, optional
Suppress error and warning messages. Default is False.
- Returns
- topologic_core.Topology or tuple
The rotated topology, or (rotated topology, provenance). On failure, return None, or (None, unsupported provenance).
- static RotateByQuaternion(topology, origin=None, quaternion: list = [0, 0, 0, 1], transferDictionaries: bool = True, returnProvenance: bool = False, angTolerance: float = 0.001, tolerance: float = 0.0001, silent: bool = False)
Rotates the input topology using Quaternion rotations. See https://en.wikipedia.org/wiki/Quaternion
- Parameters
- topologytopologic_core.Topology
The input topology.
- origintopologic_core.Vertex , optional
The origin (center) of the rotation. If set to None, the world origin (0, 0, 0) is used. Default is None.
- quaternionlist or numpy array of size 4
The input Quaternion list. It should be in the form [x, y, z, w].
- transferDictionariesbool , optional
If set to True, the dictionaries are transfered from the original object to the rotated object. Default is True.
- returnProvenancebool, optional
If True, return (result, provenance). Compose the initial copy and all three rotation histories so origins can be traced to the input topology. Capture is independent of dictionary transfer. Unsupported capture or failure is reported through provenance.supported=False. Default is False.
- angTolerancefloat , optional
The angle tolerance in degrees under which no rotation is carried out. Default is 0.001 degrees.
- 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.Topology
The rotated topology.
- static Save(topology, path, overwrite: bool = False, silent: bool = False) bool
Saves a topology using the codec selected by the output extension.
At present, the unified TopologicPy persistence registry supports neutral STEP BREP exchange through
.stepand.stp.- Parameters
- topologytopologicpy.Topology
The input topology.
- pathstr or os.PathLike
The output path. The filename extension selects the codec.
- overwritebool , optional
If True, an existing file may be overwritten. Default is False.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- bool
True if the topology was saved successfully, otherwise False.
- static Scale(topology, origin=None, x=1, y=1, z=1, transferDictionaries: bool = True, returnProvenance: bool = False, tolerance: float = 0.0001, silent: bool = False)
Scales the input topology
- Parameters
- topologytopologic_core.Topology
The input topology.
- origintopologic_core.Vertex , optional
The origin (center) of the scaling. If set to None, the world origin (0, 0, 0) is used. Default is None.
- xfloat , optional
The ‘x’ component of the scaling factor. Default is 1.
- yfloat , optional
The ‘y’ component of the scaling factor. Default is 1.
- zfloat , optional
The ‘z’ component of the scaling factor. Default is 1..
- returnProvenancebool , optional
If True, return (result, Provenance) with exact native correspondence for the root and supported subtopologies, independently of dictionary transfer. Unsupported capture or a failed operation is explicitly reported by provenance.supported=False. Default is False.
- tolerancefloat , optional
The desired geometric tolerance. Default is 0.0001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology or tuple
The scaled topology.
- static SelectSubTopology(topology, selector, subTopologyType: str = 'vertex', silent: bool = False)
Returns the subtopology within the input topology based on the input selector and the subTopologyType.
- Parameters
- topologytopologic_core.Topology
The input topology.
- selectortopologic_core.Vertex
A vertex located on the desired subtopology.
- subTopologyTypestr , optional.
The desired subtopology type. This can be of “vertex”, “edge”, “wire”, “face”, “shell”, “cell”, or “cellcomplex”. It is case insensitive. Default is “vertex”.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The selected subtopology.
- static SelfMerge(topology, transferDictionaries: bool = False, ontology: bool = False, tolerance: float = 0.0001, silent: bool = False)
Self-merges the input topology and returns the cleanest logical topology represented by it.
For non-Cluster inputs, the topology is returned unchanged. For Cluster inputs, normalization is delegated to the active backend. The backend is responsible for de-duplicating direct constituents, removing redundant lower-dimensional constituents, and promoting the result to the highest appropriate topology type.
- Parameters
- topologytopologic_core.Topology
The input topology.
- transferDictionariesbool, optional
If True, the dictionary of the input Cluster is transferred to the normalized result. Default is False.
- ontologybool, optional
If True, the returned topology is annotated with TopologicPy ontology metadata. Default is False.
- tolerancefloat, optional
The desired tolerance. Default is 0.0001.
- silentbool, optional
If True, errors and warnings are suppressed. Default is False.
- Returns
- topologic_core.Topology or None
The normalized topology.
- static SetDictionary(topology, dictionary, silent: biool = False)
Sets the input topology’s dictionary to the input dictionary.
- Parameters
- topologytopologic_core.Topology, topologic_core.Graph, topologicpy.TGraph, dict
The input topology, graph, TGraph, TGraph vertex record, or TGraph edge record.
- dictionarytopologic_core.Dictionary or dict
The input dictionary.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology, topologic_core.Graph, topologicpy.TGraph, dict, or None
The input object with the input dictionary set in it.
- static SetOntology(topology, ontologyClass: str = None, category: str = None, label: str = None, uri: str = None, source: str = None, derivedFrom: str = None, generatedBy: str = None, annotateSubtopologies: bool = False, silent: bool = False)
Annotates the input topology with TopologicPy ontology metadata.
- Parameters
- topologytopologic_core.Topology
The input topology.
- ontologyClassstr , optional
The ontology class, for example “top:Face”, “top:Cell”, or “top:Space”. If set to None, the class is inferred from the Topologic type. Default is None.
- categorystr , optional
The semantic category. Default is None.
- labelstr , optional
A human-readable label. Default is None.
- uristr , optional
A stable URI or QName for the topology instance. Default is None.
- sourcestr , optional
A source file, URI, or process identifier. Default is None.
- derivedFromstr , optional
The source entity from which this topology was derived. Default is None.
- generatedBystr , optional
The method or process that generated the topology. Default is None.
- annotateSubtopologiesbool , optional
If True, vertices, edges, wires, faces, shells, cells, and cell complexes contained by the topology are also annotated. Default is False.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The annotated topology.
- static SetSnapshot(topology, snapshot=None, timestamp=None, key: str = 'timestamp', silent: bool = False)
Sets a date/time stamped snapshot and stores it in the input topology’s content system.
- Parameters
- topologytopologic_core.Topology
The input topology
- snapshottopologic_core.Topology
The snapshot topology to be stored.
- timestampdatetime
The date/time stamp to store in the snapshot’s dictionary
- keystr, optional
The dictionary key under which to store the timestamp.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The input topology with the snapshot stored in it.
Returns the shared edges between the two input topologies
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- Returns
- list
The list of shared edges.
Returns the shared faces between the two input topologies
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- Returns
- list
The list of shared faces.
Returns the shared topologies between the two input topologies
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- dict
A dictionary with the list of vertices, edges, wires, and faces. The keys are “vertices”, “edges”, “wires”, and “faces”.
Returns the shared vertices between the two input topologies
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of shared vertices.
Returns the shared wires between the two input topologies
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- Returns
- list
The list of shared wires.
- static Shells(topology, silent: bool = False)
Returns the shells of the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of shells.
- static ShortestDistance(topologyA, topologyB, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Returns the shortest Euclidean distance between two topologies.
For backends other than TopologicCore, a native backend distance implementation is used when available.
For TopologicCore, and for backends without a native distance operation, the distance is calculated using backend-independent geometric primitives. The compatibility calculation supports vertices, edges, faces with holes, shells, cells, cell complexes, and clusters.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- mantissaint , optional
Number of decimal places to which the distance is rounded. Default is 6.
- tolerancefloat , optional
The desired tolerance. Distances less than or equal to this value are returned as zero. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- float
The shortest distance between topologyA and topologyB. Returns None if the distance cannot be computed.
- static ShortestEdge(topologyA, topologyB, tolerance: float = 0.0001, silent: bool = False)
Returns the shortest connecting edge between two topologies.
This method deterministically finds the pair of closest points between topologyA and topologyB by examining their subtopologies, including vertices, edges, and faces. It then returns a new edge whose endpoints lie at these two closest points.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- tolerancefloat, optional
The numerical tolerance used for detecting near-zero distances and degeneracies. Default is 1e-6.
- silentbool, optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Edge or None
A new edge whose start and end vertices represent the closest points on topologyA and topologyB, respectively. Returns None if a valid distance cannot be computed.
Notes
Subtopologies are collected using Topology.Vertices, Topology.Edges, and Topology.Faces.
The returned edge is not required to belong to either input topology. It is a geometric representation of the shortest segment between them.
If the shortest distance is numerically zero, the start and end vertices of the returned edge may coincide or be extremely close.
- static ShortestEdges(topology, removeCoplanarFaces: bool = False, epsilon: float = 0.001, tolerance: float = 0.0001, silent: bool = False)
Returns the list of the shortest edges found in the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- removeCoplanarFacesbool , optional
If set to True, coplanar faces are removed to find the true shortest straight edges. Otherwise they are not. Default is False.
- epsilonfloat , optional
The desired epsilon (another form of tolerance) for finding if two faces are coplanar. Default is 0.01.
- 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
- ——-
- list
The list of the shortest edges found in the input topology.
- static Show(*topologies, nameKey='name', opacityKey='opacity', showVertices=True, vertexSize=None, vertexSizeKey=None, vertexColor='black', vertexColorKey=None, vertexBorderWidth=0, vertexBorderColor='black', vertexBorderWidthKey=None, vertexBorderColorKey=None, vertexLabelKey=None, showVertexLabel=False, vertexLabelFontSize=5, vertexGroupKey=None, vertexGroups=[], vertexMinGroup=None, vertexMaxGroup=None, showVertexLegend=False, vertexLegendLabel='Vertices', directed=False, arrowSize=0.1, arrowSizeKey=None, showEdges=True, edgeWidth=None, edgeWidthKey=None, edgeColor=None, edgeColorKey=None, edgeDash=False, edgeDashKey=None, edgeLabelKey=None, showEdgeLabel=False, edgeGroupKey=None, edgeGroups=[], edgeMinGroup=None, edgeMaxGroup=None, showEdgeLegend=False, edgeLegendLabel='Edges', showFaces=True, faceOpacity=0.5, faceOpacityKey=None, faceColor='#FAFAFA', faceColorKey=None, faceLabelKey=None, faceGroupKey=None, faceGroups=[], faceMinGroup=None, faceMaxGroup=None, showFaceLegend=False, faceLegendLabel='Faces', intensityKey=None, intensities=[], material='default', materialKey=None, flatShading=True, ambient=None, ambientKey=None, diffuse=None, diffuseKey=None, specular=None, specularKey=None, roughness=None, roughnessKey=None, width=950, height=500, xAxis=False, yAxis=False, zAxis=False, axisSize=1, backgroundColor='rgba(0,0,0,0)', marginLeft=0, marginRight=0, marginTop=20, marginBottom=0, camera=[-1.25, -1.25, 1.25], center=[0, 0, 0], up=[0, 0, 1], projection='perspective', renderer='notebook', showScale=False, cbValues=[], cbTicks=5, cbX=-0.15, cbWidth=15, cbOutlineWidth=0, cbTitle='', cbSubTitle='', cbUnits='', colorScale='Viridis', sagitta=0, absolute=False, sides=8, angle=0, showFigure=True, mantissa=6, tolerance=0.0001, silent=False)
Shows the input topology on screen.
- Parameters
- topologiestopologic_core.Topology or list
The input topology. This must contain faces and or edges. If the input is a list, a cluster is first created
- opacityKeystr , optional
The key under which to find the opacity of the topology. Default is “opacity”.
- showVerticesbool , optional
If set to True the vertices will be drawn. Otherwise, they will not be drawn. Default is True.
- vertexSizefloat , optional
The desired size of the vertices. Default is 1.1.
- vertexSizeKeystr , optional
The key under which to find the size of the vertex. Default is None.
- vertexColorstr , optional
The desired color of the output vertices. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “black”.
- vertexColorKeystr , optional
The key under which to find the color of the vertex. Default is None.
- vertexBorderWidthfloat , optional
The desired width of the borders of the output vertices. Default is 0.
- vertexBorderColorstr , optional
The desired color of the borders of the output vertices. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “black”.
- vertexLabelKeystr , optional
The dictionary key to use to display the vertex label. Default is None.
- showVertexLabelsbool , optional
If set to True, the vertex labels are shown permenantely on screen. Otherwise, they are not. Default is False.
- vertexLabelFontSizeint , optional
The font size of the vertex labels. Default is 5.
- vertexGroupKeystr , optional
The dictionary key to use to display the vertex group. Default is None.
- vertexGroupslist , optional
The list of vertex groups against which to index the color of the vertex. Default is [].
- vertexMinGroupint or float , optional
For numeric vertexGroups, vertexMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the minimum value in vertexGroups. Default is None.
- vertexMaxGroupint or float , optional
For numeric vertexGroups, vertexMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the maximum value in vertexGroups. Default is None.
- showVertexLegendbool, optional
If set to True, the legend for the vertices of this topology is shown. Otherwise, it isn’t. Default is False.
- vertexLegendLabelstr , optional
The legend label string used to identify vertices. Default is “Topology Vertices”.
- directedbool , optional
If set to True, arrowheads are drawn to show direction. Default is False.
- arrowSizeint, optional
The desired size of arrowheads for directed graphs. Default is 0.1.
- arrowSizeKey: str , optional
The edge dictionary key under which to find the arrowhead size. Default is None.
- showEdgesbool , optional
If set to True the edges will be drawn. Otherwise, they will not be drawn. Default is True.
- edgeWidthfloat , optional
The desired thickness of the output edges. Default is 1.
- edgeColorstr , optional
The desired color of the output edges. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “black”.
- edgeColorKeystr , optional
The key under which to find the color of the edge. Default is None.
- edgeDashbool , optional
If set to True, the edges are drawn as dashed lines. Default is False.
- edgeDashKeystr , optional
The key under which to find the boolean flag to draw edges as dashed lines. Default is None.
- edgeWidthKeystr , optional
The key under which to find the width of the edge. Default is None.
- edgeLabelKeystr , optional
The dictionary key to use to display the edge label. Default is None.
- showEdgeLabelsbool , optional
If set to True, the edge labels are shown permenantely on screen. Otherwise, they are not. Default is False.
- edgeGroupKeystr , optional
The dictionary key to use to display the edge group. Default is None.
- edgeGroupslist , optional
The list of edge groups against which to index the color of the edge. Default is [].
- edgeMinGroupint or float , optional
For numeric edgeGroups, edgeMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the minimum value in edgeGroups. Default is None.
- edgeMaxGroupint or float , optional
For numeric edgeGroups, edgeMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the maximum value in edgeGroups. Default is None.
- showEdgeLegendbool, optional
If set to True, the legend for the edges of this topology is shown. Otherwise, it isn’t. Default is False.
- edgeLegendLabelstr , optional
The legend label string used to identify edges. Default is “Topology Edges”.
- showFacesbool , optional
If set to True the faces will be drawn. Otherwise, they will not be drawn. Default is True.
- faceOpacityfloat , optional
The desired opacity of the output faces (0=transparent, 1=opaque). Default is 0.5.
- faceOpacityKeystr , optional
The key under which to find the opacity of the face. Default is None.
- faceColorstr , optional
The desired color of the output faces. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “#FAFAFA”.
- faceColorKeystr , optional
The key under which to find the color of the face. Default is None.
- faceLabelKeystr , optional
The dictionary key to use to display the face label. Default is None.
- faceGroupKeystr , optional
The dictionary key to use to display the face group. Default is None.
- faceGroupslist , optional
The list of face groups against which to index the color of the face. This can bhave numeric or string values. This should match the type of value associated with the faceGroupKey. Default is [].
- faceMinGroupint or float , optional
For numeric faceGroups, minGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the faceGroupKey. If set to None, it is set to the minimum value in faceGroups. Default is None.
- faceMaxGroupint or float , optional
For numeric faceGroups, maxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the faceGroupKey. If set to None, it is set to the maximum value in faceGroups. Default is None.
- showFaceLegendbool, optional
If set to True, the legend for the faces of this topology is shown. Otherwise, it isn’t. Default is False.
- faceLegendLabelstr , optional
The legend label string used to idenitfy edges. Default is “Topology Faces”.
- widthint , optional
The width in pixels of the figure. The default value is 950.
- heightint , optional
The height in pixels of the figure. The default value is 950.
- xAxisbool , optional
If set to True the x axis is drawn. Otherwise it is not drawn. Default is False.
- yAxisbool , optional
If set to True the y axis is drawn. Otherwise it is not drawn. Default is False.
- zAxisbool , optional
If set to True the z axis is drawn. Otherwise it is not drawn. Default is False.
- backgroundColorstr , optional
The desired color of the background. This can be any plotly color string and may be specified as: - A hex string (e.g. ‘#ff0000’) - An rgb/rgba string (e.g. ‘rgb(255,0,0)’) - An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’) - An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’) - A named CSS color. The default is “rgba(0,0,0,0)”.
- marginLeftint , optional
The size in pixels of the left margin. The default value is 0.
- marginRightint , optional
The size in pixels of the right margin. The default value is 0.
- marginTopint , optional
The size in pixels of the top margin. The default value is 20.
- marginBottomint , optional
The size in pixels of the bottom margin. The default value is 0.
- cameralist , optional
The desired location of the camera). Default is [-1.25, -1.25, 1.25].
- centerlist , optional
The desired center (camera target). Default is [0, 0, 0].
- uplist , optional
The desired up vector. Default is [0, 0, 1].
- projectionstr , optional
The desired type of projection. The options are “orthographic” or “perspective”. It is case insensitive. Default is “perspective”
- rendererstr , optional
The desired renderer. See Plotly.Renderers(). If set to None, the code will attempt to discover the most suitable renderer. Default is None.
- intensityKeystr , optional
If not None, the dictionary of each vertex is searched for the value associated with the intensity key. This value is then used to color-code the vertex based on the colorScale. Default is None.
- intensitieslist , optional
The list of intensities against which to index the intensity of the vertex. Default is [].
- materialstr , optional
The type of object material. Case in-sensitive. Supported pre-built materials are: Preset Ambient Diffuse Specular Roughness Description ————————————————————– chalk 1.0 0.4 0.0 1.0 Very soft shading, low contrast concrete 0.85 0.75 0.05 0.9 Highly matte, micro-rough surface, minimal specular reflection eggshell 0.65 0.85 0.25 0.45 Slight sheen, soft highlights without gloss glossy 0.5 0.9 0.6 0.1 Highly polished appearance matte 0.9 0.7 0.0 1.0 Flat, non-reflective surfaces metallic 0.3 0.8 0.9 0.2 Strong, sharp reflections plastic 0.6 0.9 0.2 0.4 Soft highlights, good shape readability Default is a matte material that uses facenormalepsilon=0.
- materialKeystr , optional
The dictionary key under which the material string is stored. Default is None.
- flatShadingbool , optional
If set to True, the model is rendered with flat shading with no clear light source. Default is True.
- ambientfloat , optional
Controls the strength of ambient light applied uniformly to the surface. Higher values reduce shading contrast by increasing overall brightness. Typical range is [0, 1]. This over-rides the material pre-sets. Default is 0.6.
- ambientKeystr , optional
The dictionary key under which the ambient value (float) is stored. Default is None.
- diffusefloat , optional
Controls the strength of diffuse (Lambertian) lighting based on the angle between the light direction and the surface normal. Higher values enhance shape perception through shading. Typical range is [0, 1]. This over-rides the material pre-sets. Default is None.
- diffuseKeystr , optional
The dictionary key under which the diffuse value (float) is stored. Default is None.
- specularfloat , optional
Controls the intensity of specular (mirror-like) highlights on the surface. Higher values produce sharper and brighter highlights, giving a glossy appearance. Typical range is [0, 1]. This over-rides the material pre-sets. Default is None.
- specularKeystr , optional
The dictionary key under which the specular value (float) is stored. Default is None.
- roughnessfloat , optional
Controls the spread of specular highlights on the surface. Lower values result in sharp, concentrated highlights (smooth surfaces), while higher values produce broader, softer highlights (rough surfaces). Typical range is [0, 1]. This over-rides the material pre-sets. Default is None.
- roughnessKeystr , optional
The dictionary key under which the roughness value (float) is stored. Default is None.
- showScalebool , optional
If set to True, the colorbar is shown. Default is False.
- cbValueslist , optional
The input list of values to use for the colorbar. Default is [].
- cbTicksint , optional
The number of ticks to use on the colorbar. Default is 5.
- cbXfloat , optional
The x location of the colorbar. Default is -0.15.
- cbWidthint , optional
The width in pixels of the colorbar. Default is 15
- cbOutlineWidthint , optional
The width in pixels of the outline of the colorbar. Default is 0.
- cbTitlestr , optional
The title of the colorbar. Default is “”.
- cbSubTitlestr , optional
The subtitle of the colorbar. Default is “”.
- cbUnits: str , optional
The units used in the colorbar. Default is “”
- colorScalestr , optional
The desired type of plotly color scales to use (e.g. “viridis”, “plasma”). Default is “viridis”. For a full list of names, see https://plotly.com/python/builtin-colorscales/.
- showFigurebool , optional
If set to True, the figure will be shown and a None is returned. If not, the figure will be returned, but not shown. Default is True.
- mantissaint , optional
The desired length of the mantissa for the values listed on the colorbar. 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
- Plotly figure
The created plotly figure.
- static Slice(topologyA, topologyB, tranDict: bool = False, tolerance: float = 0.0001, silent: bool = False, returnProvenance: bool = False)
Slices topologyA using topologyB. See https://en.wikipedia.org/wiki/Boolean_operation.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- tranDictbool , optional
If set to True the dictionaries of the operands are merged and transferred to the result. 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.Topology
the resultant topology.
- static SmallestFaces(topology, removeCoplanarFaces: bool = False, epsilon: float = 0.001, tolerance: float = 0.0001, silent: bool = False)
Returns the list of the smallest faces found in the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- removeCoplanarFacesbool , optional
If set to True, coplanar faces are removed to find the true smallest faces. Otherwise they are not. Default is False.
- epsilonfloat , optional
The desired epsilon (another form of tolerance) for finding if two faces are coplanar. Default is 0.01.
- 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
- ——-
- list
The list of the smallest faces found in the input topology.
- static Snapshots(topology, start=None, end=None, key='timestamp', silent: bool = False)
Returns the list of the stored snapshots within the start and end timestamps.
- Parameters
- topologytopologic_core.Topology
The input topology.
- startdatetime
The start date/time.
- enddatetime
The end date/time.
- keystr , optional
The dictionary key under which the timestampe is store. Default is “timestamp”.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of the snapshots that fit the input parameters.
- static SortBySelectors(topologies, selectors, exclusive: bool = False, bvhThreshold: int = 256, tolerance: float = 0.0001, silent: bool = False)
Sorts the input list of topologies according to the input list of selectors.
- Parameters
- topologieslist
The input list of topologies.
- selectorslist
The input list of selectors. These should be vertices.
- exclusivebool , optional
If set to True, each topology can be selected by at most one selector. Default is False.
- bvhThresholdint , optional
BVH acceleration is used only when len(topologies) * len(selectors) is greater than or equal to this value. Set to 0 to always attempt BVH. Default is 256.
- 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
- dict
A dictionary containing the list of sorted and unsorted topologies. The keys are “sorted” and “unsorted”.
- static SpatialRelationship(topologyA, topologyB, include: list = ['contains', 'coveredBy', 'covers', 'crosses', 'disjoint', 'equals', 'overlaps', 'touches', 'within', 'proximity'], proximityValues=[1, 5, 10], proximityLabels=['near', 'intermediate', 'far'], useShortestDistance: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Returns the spatial relationship string between the two input topologies according to OGC / ISO 19107 / DE-9IM / RCC-8
- Parameters
- topologyAtopologic_core.Topology
The first input topology
- topologyBtopologic_core. Topology
The second input topology.
- includelist , optional
The type(s) of spatial relationships to search for. Default is [“contains”, “coveredBy”, “covers”, “crosses”, “disjoint”, “equals”, “overlaps”, “touches”,”within”]. - Contains: The inverse of “within,” where geometry A contains geometry B. The interior and boundary of B are completely contained within the interior of A. - CoveredBy: The inverse of “covers.” Geometry A is covered by geometry B, with A’s surface lying entirely on B’s surface. - Covers: Geometry B lies entirely on the surface of geometry A. This is a weaker version of Contains() as it allows for B to touch A’s boundary. - Crosses: The geometries have some interior points in common, but not all of the interior of one is contained in the interior of the other. This often describes a line crossing a polygon or another line. - Disjoint: The boundary and interior of the two geometries do not intersect at all. - Equals: The two geometries are exactly the same, representing the same set of points. - Intersects: The geometries have at least one point in common. Intersects is the most general relationship, and if any other relationship (except disjoint) is true, then Intersects() is also true. - Overlaps: The intersection of the two geometries results in a new, distinct geometry of the same dimension. For example, two overlapping polygons produce a new polygon. - Touches: The geometries share at least one point on their boundaries but their interiors do not intersect. - Within: The interior and boundary of geometry A are completely contained within the interior of geometry B. - Proximity: Classifies the shortest distance between the objects according to proximityValues and proximityLabels.
- proximityValues: list , optional
The list of maximum distance values that specify the desired proximityLabel. This list must be sorted in ascending order and have the same number of elements as the proximityLabels list. Objects that are further than the largest specified distance are not classified and not included. An object is considered to fall within the range if it is less than or equal to the value in this list. If you wish ALL objects to be classified specifiy the last number in this list to be larger than the largest distance that can exist between any two objects in the list. Default is [1, 5, 10]
- proximityLabels: list , optional
The list of range labels (e.g. “near”, “intermediate”, “far”) that correspond to the proximityValues list. The list must have the same number of elements as the proximityValues list. Default is [“near”, “intermediate”, “far”]
- useShortestDistancebool , optional
If set to True, the shortest distance between the two input topologies is used. Otherwise, the distance between their centroids is used. Default is False.
- mantissaint , optional
The desired length of the mantissa. 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
- str
The found spatial relationship. One of [“contains”, “disjoint”, “equals”, “overlaps”, “touches”, “within”, “covers”, “coveredBy”] or “unknown”
- static Spin(topology, origin=None, triangulate: bool = True, direction: list = [0, 0, 1], angle: float = 360, sides: int = 16, tolerance: float = 0.0001, silent: bool = False)
Spins the input topology around an axis to create a new topology.See https://en.wikipedia.org/wiki/Solid_of_revolution.
- Parameters
- topologytopologic_core.Topology
The input topology.
- origintopologic_core.Vertex
The origin (center) of the spin.
- triangulatebool , optional
If set to True, the result will be triangulated. Default is True.
- directionlist , optional
The vector representing the direction of the spin axis. Default is [0, 0, 1].
- anglefloat , optional
The angle in degrees for the spin. Default is 360.
- sidesint , optional
The desired number of sides. Default is 16.
- 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.Topology
The spun topology.
- static SubCombinations(topology, subTopologyType=None, minSize: int = 2, maxSize: int = None, maxCombinations: int = 100, timeLimit: int = 10, removeCoplanarFaces: bool = False, removeCollinearEdges: bool = False, tolerance: float = 0.001, silent: bool = False)
Creates connected sub-combination topologies of the input topology. Warning: This is prone to combinatorial explosion.
- Parameters
- topologytopologic_core.Topology or topologicpy.TGraph
The input topology. This cannot be vertex or edge.
- subTopologyTypestr , optional except when topology is a Cluster
The type of subTopology to include in the combinations.
- minSizeint , optional
The minimum number of subtopologies to include in a combination. This number cannot be less than 2. Default is 2.
- maxSizeint , optional
The maximum number of subtopologies to include in a combination. Default is None which means the maximum will be set to the number of subtopologies minus 1.
- maxCombinationsint , optional
The maximum number of combinations to create. Default is 100.
- timeLimitint , optional
The time limit in seconds. Default is 10 seconds.
- removeCoplanarFacesbool , optional
If set to True, coplanar faces are removed. Otherwise they are not. Default is False.
- removeCollinearEdgesbool , optional
If set to True, collinear edges are removed. Otherwise they are not. Default is False.
- tolerancefloat , optional
The desired tolerance. Default is 0.001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of created sub-combinations.
- static SubTopologies(topology, subTopologyType='vertex', silent: bool = False)
Returns the subtopologies of the input topology or graph as specified by the subTopologyType input string.
- Parameters
- topologytopologic_core.Topology or topologicpy.TGraph
The input topology or graph.
- subTopologyTypestr , optional
The requested subtopology type. This can be one of “vertex”, “edge”, “wire”, “face”, “shell”, “cell”, “cellcomplex”, “cluster”, or “aperture”. It is case insensitive. Default is “vertex”.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of subtopologies.
- static SuperTopologies(topology, hostTopology, topologyType: str = None, silent: bool = False) list
Returns the supertopologies connected to the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- hostTopologytopologic_core.Topology
The host to topology in which to search for their supertopologies.
- topologyTypestr , optional
The topology type to search for. This can be any of “edge”, “wire”, “face”, “shell”, “cell”, “cellcomplex”, “cluster”. It is case insensitive. If set to None, the immediate supertopology type is searched for. Default is None.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of supertopologies connected to the input topology.
- static SymDif(topologyA, topologyB, tranDict: bool = False, tolerance: float = 0.0001, silent: bool = False, returnProvenance: bool = False)
Returns the symmetric difference (XOR) of the input operand topologies. See https://en.wikipedia.org/wiki/Boolean_operation.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- tranDictbool , optional
If set to True the dictionaries of the operands are merged and transferred to the result. 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.Topology
the resultant topology.
- static SymmetricDifference(topologyA, topologyB, tranDict: bool = False, tolerance: float = 0.0001, silent: bool = False, returnProvenance: bool = False)
Returns the symmetric difference (XOR) of the input operand topologies. See https://en.wikipedia.org/wiki/Boolean_operation.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- tranDictbool , optional
If set to True the dictionaries of the operands are merged and transferred to the result. 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.Topology
the resultant topology.
- static Taper(topology, origin=None, ratioRange: list = [0, 1], triangulate: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False, subdivisions: int = 8, degree: int = 3)
Tapers the input topology along its Z-axis.
With the PythonOCC backend this is implemented by deforming NURBS control geometry rather than rebuilding geometry from vertices.
- Parameters
- topologytopologic_core.Topology
The input topology.
- origintopologic_core.Vertex , optional
The taper axis passes through the X and Y coordinates of this vertex. If None, the backend uses the topology centroid. Default is None.
- ratioRangelist , optional
Taper ratios at the minimum and maximum Z extents. A value of 0 means no taper, 1 approaches the taper axis, and negative values taper outward. Values above 1 are clamped to 1. Default is [0, 1].
- triangulatebool , optional
Retained for backward compatibility. The NURBS deformation path does not triangulate the topology. Default is False.
- mantissaint , optional
Retained for backward compatibility. NURBS control points are not rounded. Default is 6.
- tolerancefloat , optional
The desired geometric tolerance. Default is 0.0001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- subdivisionsint , optional
Minimum number of NURBS knot spans used by the backend. Default is 8.
- degreeint , optional
Minimum NURBS degree used by the backend. Default is 3.
- Returns
- topologic_core.Topology
The tapered topology, or None if unsupported or unsuccessful.
- static Tessellate(topology, quality: str = 'medium', linearDeflection: float = None, angularDeflection: float = None, relative: bool = True, parallel: bool = True, weld: bool = True, weldTolerance: float = 0.0001, remesh: bool = True, mantissa: int = 6, silent: bool = False)
Tessellates the input topology into an indexed triangular surface mesh.
Unlike
Topology.Triangulate(), this method returns mesh data and does not reconstruct Topologic Faces. Under the PythonOCC backend, the actual OCCT BRep is tessellated directly, so analytic, Bezier, and BSpline/NURBS geometry is preserved until the tessellation step.- Parameters
- topologytopologicpy.Topology
The input topology.
- qualitystr , optional
Relative quality preset:
"coarse","medium", or"fine". Default is"medium".- linearDeflectionfloat , optional
Maximum linear deviation. If
relativeis True, the value is interpreted as a fraction of the topology bounding-box diagonal. If None, the selected quality preset is used.- angularDeflectionfloat , optional
Maximum angular deflection in degrees. If None, the selected quality preset is used.
- relativebool , optional
If True,
linearDeflectionis interpreted relative to the topology bounding-box diagonal. Default is True.- parallelbool , optional
If True, OCCT may tessellate Faces in parallel. Default is True.
- weldbool , optional
If True, coincident tessellation vertices are shared. Default is True.
- weldTolerancefloat , optional
Coordinate tolerance used when welding vertices. Default is 0.0001.
- remeshbool , optional
If True, cached OCCT triangulations are cleared before remeshing. Default is True.
- mantissaint , optional
Number of decimal places retained in returned coordinates. Default is 6.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- dict
Mesh data with keys
schema,vertices,faces,cells, andmetadata.facescontains triangles only andcellsis empty. Compatibility aliasesverts,tris,quads, andtetsare also returned.
- static Touches(topologyA, topologyB, tolerance: float = 0.0001, silent: bool = False)
Returns True if the input topologyA touches the input topologyB. Returns False otherwise.
Two topologies are considered to touch when their boundaries are in contact while their interiors do not intersect. For equal-dimensional two- and three-dimensional topologies, boundary contact is determined using shortest distance rather than relying solely on Boolean intersection, since some backends may not return lower-dimensional intersections for edge- or vertex-only contact.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- 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
- bool
True if topologyA touches topologyB. False otherwise. Returns None if either input is invalid.
- static TransferDictionaries(sources, sinks, tolerance=0.0001, numWorkers=None, silent: bool = False)
Transfers the dictionaries from the list of sources to the list of sinks.
- Parameters
- sourceslist
The list of topologies from which to transfer the dictionaries.
- sinkslist
The list of topologies to which to transfer the dictionaries.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- numWorkersint, optional
Number of workers run in parallel to process. Default is None which sets the number to twice the number of CPU cores.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- dict
Returns a dictionary with the lists of sources and sinks. The keys are “sinks” and “sources”.
- static TransferDictionariesByKey(topologies, dictionaries, key: str, silent: bool = False)
Transfers dictionaries to input topologies by matching a shared dictionary key.
This method reads the dictionary of each input topology and indexes the topology by the value stored at the input key. It then reads each input dictionary and, when the same key value is found, transfers that dictionary to the matching topology.
- Parameters
- topologieslist
The target topologies that will receive dictionaries.
- dictionarieslist
The source dictionaries. Each item can be either a Topologic dictionary or a Python dictionary. Nested dictionaries are not extracted or handled.
- keystr
The dictionary key whose value is used to match source dictionaries to target topologies.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The updated list of topologies. Topologies without a matching dictionary are returned unchanged.
Examples
updated_faces = Topology.TransferByKey(faces, face_dictionaries, “id”)
updated_spaces = Topology.TransferByKey(spaces, room_dictionaries, “GlobalId”)
- static TransferDictionariesBySelectors(topology, selectors, tranVertices=False, tranEdges=False, tranFaces=False, tranCells=False, tolerance=0.0001, numWorkers=None, silent: bool = False)
Transfers the dictionaries of the list of selectors to the subtopologies of the input topology based on the input parameters.
- Parameters
- topologytopologic_core.Topology
The input topology.
- selectorslist
The list of input selectors from which to transfer the dictionaries.
- tranVerticesbool , optional
If True transfer dictionaries to the vertices of the input topology.
- tranEdgesbool , optional
If True transfer dictionaries to the edges of the input topology.
- tranFacesbool , optional
If True transfer dictionaries to the faces of the input topology.
- tranCellsbool , optional
If True transfer dictionaries to the cells of the input topology.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- numWorkersint , optional
Number of workers run in parallel to process. If you set it to 1, no parallel processing will take place. The default is None which causes the algorithm to use twice the number of cpu cores in the host computer.
- Returns
- ——-
- Topology
The input topology with the dictionaries transferred to its subtopologies.
- static Transform(topology, matrix: list, angTolerance: float = 0.001, transferDictionaries: bool = True, tolerance: float = 0.0001, silent: bool = False)
Transforms the input topology by the input 4x4 affine transformation matrix.
The complete affine transformation is delegated to the active Core backend. The legacy Scale -> Rotate -> Translate reconstruction fallback is used only when the active backend is TopologicCore.
- Parameters
- topologytopologic_core.Topology
The input topology.
- matrixlist
The input 4x4 affine transformation matrix in row-major form:
- [
[a00, a01, a02, tx], [a10, a11, a12, ty], [a20, a21, a22, tz], [0, 0, 0, 1]
]
- angTolerancefloat , optional
The angular tolerance in degrees below which a rotation is ignored by the legacy TopologicCore fallback. Default is 0.001.
- transferDictionariesbool , optional
If set to True, the dictionary of the input topology is transferred to the transformed topology. 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.Topology
The transformed topology.
- static Translate(topology, x=0, y=0, z=0, transferDictionaries: bool = True, returnProvenance: bool = False, silent: bool = False)
Translates (moves) the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- xfloat , optional
The x translation value. Default is 0.
- yfloat , optional
The y translation value. Default is 0.
- zfloat , optional
The z translation value. Default is 0.
- transferDictionariesbool , optional
If set to True, dictionaries are transferred from the original topology and its subtopologies to the translated topology. Default is True.
- returnProvenancebool , optional
If True, return (result, Provenance) with exact native correspondence for the root and supported subtopologies, independently of dictionary transfer. Unsupported capture or a failed operation is explicitly reported by provenance.supported=False. Default is False.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology or tuple
The translated topology.
- static TranslateByDirectionDistance(topology, direction: list = [0, 0, 0], distance: float = 0, transferDictionaries: bool = True, silent: bool = False)
Translates (moves) the input topology along the input direction by the specified distance.
- Parameters
- topologytopologic_core.topology
The input topology.
- directionlist , optional
The direction vector in which the topology should be moved. Default is [0, 0, 0]
- distancefloat , optional
The distance by which the toplogy should be moved. Default is 0.
- transferDictionariesbool , optional
If set to True, the dictionaries are transfered from the original object to the translated object. Default is True.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The translated topology.
- static Triangulate(topology, transferDictionaries: bool = False, mode: int = 0, meshSize: float = None, tolerance: float = 0.0001, silent: bool = False)
Triangulates the Faces of the input topology using only the active topology backend and reconstructs the corresponding Topologic topology.
Topology.Triangulateis a topological conversion operation. It does not perform numerical gmsh meshing. UseTopology.Mesh()for gmsh 2D/3D numerical meshing andTopology.Tessellate()for indexed surface tessellation data.- Parameters
- topologytopologic_core.Topology
The input topology.
- transferDictionariesbool , optional
If True, dictionaries on source Faces are transferred to the triangular Faces. Default is False.
- modeint , optional
Deprecated compatibility parameter. It is ignored. Historical gmsh algorithm selection has moved to
Topology.Mesh. Default is 0.- meshSizefloat , optional
Deprecated compatibility parameter. It is ignored. Use
Topology.Meshfor numerical mesh sizing. Default is None.- 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.Topology
The triangulated topology.
- static Twist(topology, origin=None, angleRange: list = [45, 90], triangulate: bool = False, mantissa: int = 6, angTolerance: float = 0.01, tolerance: float = 0.0001, silent: bool = False, subdivisions: int = 8, degree: int = 3)
Twists the input topology along its Z-axis.
When supported by the active backend, this is implemented by deforming native control geometry rather than rebuilding geometry from vertices. If
triangulateis True, the input topology is triangulated first and that triangulated topology is passed to the deformation backend. Its resulting topology type and subtopology counts are therefore preserved.- Parameters
- topologytopologic_core.Topology
The input topology.
- origintopologic_core.Vertex , optional
The twist axis passes through the X and Y coordinates of this vertex. If None, the backend uses the topology centroid. Default is None.
- angleRangelist , optional
Twist angles in degrees at the minimum and maximum Z extents. Default is [45, 90].
- triangulatebool , optional
If True, triangulate the input topology before twisting. This is useful when a varying twist would make polygonal Faces non-planar. Default is False.
- mantissaint , optional
Retained for backward compatibility. NURBS control points are not rounded. Default is 6.
- angTolerancefloat , optional
Angular tolerance in degrees. Default is 0.01.
- tolerancefloat , optional
The desired geometric tolerance. Default is 0.0001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- subdivisionsint , optional
Minimum number of NURBS knot spans used by the backend. Default is 8.
- degreeint , optional
Minimum NURBS degree used by the backend. Default is 3.
- Returns
- topologic_core.Topology
The twisted topology, or None if unsupported or unsuccessful.
- static Type(topology, silent: bool = False)
Returns the type of the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- int
The type of the input topology.
- static TypeAsString(topology, silent: bool = False)
Returns the type of the input topology or graph as a string.
- Parameters
- topologytopologic_core.Topology or topologicpy.TGraph
The input topology or graph.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- str
The type of the topology or graph as a string.
- static TypeID(name: str = None, silent: bool = False) int
Returns the type id of the input name string.
- Parameters
- namestr , optional
- The input class name string. This could be one of:
“vertex”, “edge”, “wire”, “face”, “shell”, “cell”, “cellcomplex”, “cluster”, “aperture”, “context”, “dictionary”, “graph”, “tgraph”, “topology”
It is case insensitive. Default is None.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- int
The type id of the input topologyType string.
- static UUID(topology, namespace: str = 'topologicpy', uuidKey: str = 'uuid', deterministic: bool = False, silent: bool = False)
Returns the UUID of the input topology or graph.
If deterministic is False, this method returns an existing UUID stored in the topology dictionary. If no UUID exists, a new UUID v4 is created, stored in the topology dictionary, and returned. This is the fast path.
If deterministic is True, this method computes a UUID v5 from the topology’s geometry and dictionaries. This is slower because it traverses the full topology or graph.
- Parameters
- topologytopologic_core.Topology or topologicpy.TGraph
The input topology or graph.
- namespacestr , optional
The namespace string to use when deterministic is True. Default is “topologicpy”.
- uuidKeystr , optional
The dictionary key under which the UUID is stored. Default is “uuid”.
- deterministicbool , optional
If set to True, compute a deterministic content-derived UUID. If set to False, return or create a persistent stored UUID. Default is False.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- str
The UUID string of the input topology or graph.
- static Unflatten(topology, origin=None, direction=[0, 0, 1], transferDictionaries: bool = True, silent: bool = False)
Unflattens the input topology such that the world origin is translated to the input origin and the input topology is rotated such that the Up direction (see Vector.Up()) is aligned with the input vector.
- Parameters
- topologytopologic_core.Topology
The input topology.
- origintopologic_core.Vertex , optional
The input origin. If set to None, The object’s centroid will be used to translate the world origin. Default is None.
- vectorlist , optional
The input direction vector. The input topology will be rotated such that this vector is pointed in the positive Z axis.
- transferDictionariesbool , optional
If set to True, the dictionaries are transfered from the original object to the translated object. Default is True.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The flattened topology.
- static Union(topologyA, topologyB, tranDict: bool = False, tolerance: float = 0.0001, silent: bool = False, returnProvenance: bool = False)
Unions the input operand topologies. See https://en.wikipedia.org/wiki/Boolean_operation.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- tranDictbool , optional
If set to True the dictionaries of the operands are merged and transferred to the result. 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.Topology
The resultant topology.
- static Vertices(topology, silent: bool = True)
Returns the vertices of the input topology or graph.
- Parameters
- topologytopologic_core.Topology or topologicpy.TGraph
The input topology or graph.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is True.
- Returns
- list
The list of vertices.
- static VerticesCentroid(topology, mantissa: int = 6, silent: bool = False)
Returns the centroid of the vertices of the input topology.
This method computes the arithmetic mean of the coordinates of all vertices found in the input topology. It does not compute the geometric centroid by length, area, or volume.
- Parameters
- topologytopologic_core.Topology
The input topology.
- mantissaint , optional
The number of decimal places to round the output coordinates to. Default is 6.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Vertex or None
The centroid of the vertices of the input topology.
- static View3D(*topologies, uuid=None, nameKey='name', colorKey='color', opacityKey='opacity', defaultColor=[256, 256, 256], defaultOpacity=0.5, transposeAxes: bool = True, mode: int = 0, meshSize: float = None, overwrite: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Sends the input topologies to 3dviewer.net. The topologies must be 3D meshes.
- Parameters
- topologieslist or comma separated topologies
The input list of topologies.
- uuidUUID , optional
The UUID v5 to use to identify these topologies. Default is a UUID based on the topologies themselves.
- nameKeystr , optional
The topology dictionary key under which to find the name of the topology. Default is “name”.
- colorKeystr, optional
The topology dictionary key under which to find the color of the topology. Default is “color”.
- opacityKeystr , optional
The topology dictionary key under which to find the opacity of the topology. Default is “opacity”.
- defaultColorlist , optional
The default color to use if no color is stored in the topology dictionary. Default is [255,255, 255] (white).
- defaultOpacityfloat , optional
The default opacity to use of no opacity is stored in the topology dictionary. This must be between 0 and 1. Default is 1 (fully opaque).
- transposeAxesbool , optional
If set to True the Z and Y coordinates are transposed so that Y points “up”
- modeint , optional
The desired mode of meshing algorithm (for triangulation). Several options are available: 0: Classic 1: MeshAdapt 3: Initial Mesh Only 5: Delaunay 6: Frontal-Delaunay 7: BAMG 8: Fontal-Delaunay for Quads 9: Packing of Parallelograms All options other than 0 (Classic) use the gmsh library. See https://gmsh.info/doc/texinfo/gmsh.html#Mesh-options WARNING: The options that use gmsh can be very time consuming and can create very heavy geometry.
- meshSizefloat , optional
The desired size of the mesh when using the “mesh” option. If set to None, it will be calculated automatically and set to 10% of the overall size of the face.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- overwritebool , optional
If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won’t. Default is False.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- bool
True if the export operation is successful. False otherwise.
- static Wires(topology, silent: bool = False)
Returns the wires of the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of wires.
- static Within(topologyA, topologyB, tolerance: float = 0.0001, silent: bool = False)
Returns True if the input topologyA is within the input topologyB. Returns False otherwise.
Within is the inverse of Contains.
- Parameters
- topologyAtopologic_core.Topology
The input contained topology.
- topologyBtopologic_core.Topology
The input containing topology.
- 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
- bool
True if topologyA is within topologyB. False otherwise. Returns None if either input is invalid.
- static XOR(topologyA, topologyB, tranDict: bool = False, tolerance: float = 0.0001, silent: bool = False, returnProvenance: bool = False)
Returns the symmetric difference (XOR) of the input operand topologies. See https://en.wikipedia.org/wiki/Boolean_operation.
- Parameters
- topologyAtopologic_core.Topology
The first input topology.
- topologyBtopologic_core.Topology
The second input topology.
- tranDictbool , optional
If set to True the dictionaries of the operands are merged and transferred to the result. 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.Topology
the resultant topology.
- class topologicpy.Topology.WorkerProcess(message_queue, sources, sinks, so_dicts, tolerance=0.0001)
Bases:
ProcessTransfers the dictionaries from a subset of sources to the list of sinks.
- Attributes
- authkey
daemonReturn whether process is a daemon
exitcodeReturn exit code of process or None if it has yet to stop
identReturn identifier (PID) of process or None if it has yet to start
- name
pidReturn identifier (PID) of process or None if it has yet to start
sentinelReturn a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination.
Methods
close()Close the Process object.
is_alive()Return whether process is alive
join([timeout])Wait until child process terminates
kill()Terminate process; sends SIGKILL signal or uses TerminateProcess()
run()Method to be run in sub-process; can be overridden in sub-class
start()Start child process
terminate()Terminate process; sends SIGTERM signal or uses TerminateProcess()
- run()
Method to be run in sub-process; can be overridden in sub-class
- class topologicpy.Topology.WorkerProcessPool(num_workers, message_queue, sources, sinks, so_dicts, tolerance=0.0001)
Bases:
objectCreate and manage a list of Worker processes. Each worker process transfers the dictionaries from a subset of sources to the list of sinks.
Methods
join
startProcesses
stopProcesses
- join()
- startProcesses()
- stopProcesses()