topologicpy.Wire module
- class topologicpy.Wire.Wire
Bases:
objectMethods
Arc(startVertex, middleVertex, endVertex[, ...])Creates a circular-arc Wire through three vertices.
ArcByEdge(edge[, sagitta, absolute, sides, ...])Creates a circular-arc Wire from a linear chord Edge and a sagitta.
Bisectors(wire[, offset, offsetKey, ...])Returns opnly the bisectors Created by an offset wire from the input wire.
BoundingRectangle(topology[, optimize, ...])Returns a wire representing a bounding rectangle of the input topology.
ByEdge(edge[, sides, polyline, silent])Creates a Wire by subdividing or sampling one input Edge.
ByEdges(edges[, orient, ...])Creates a wire from edges while preserving the constituent edge geometry.
ByEdgesCluster(cluster[, tolerance])Creates a wire from the input cluster of edges.
ByOffset(wire[, offset, offsetKey, ...])Creates an offset Wire.
ByOffsetArea(wire, area[, offsetKey, ...])Creates an offset wire from the input wire based on the input area.
ByTGraphVertices(tGraph, vertices[, close, ...])Creates a topologic Wire from an ordered list of TGraph vertex indices.
ByVertices(vertices[, close, tolerance, silent])Creates a wire from the input list of vertices.
ByVerticesCluster(cluster[, close, ...])Creates a wire from the input cluster of vertices.
CShape([origin, width, length, a, b, c, ...])Creates a C-shape.
Cage([origin, width, length, height, ...])Creates a prismatic 3D cage as a Wire, with edges only on the outer surfaces of the volume (no interior lines).
Circle([origin, radius, sides, spokes, ...])Creates a circular Wire.
Close(wire[, mantissa, tolerance, silent])Closes the input Wire by adding a straight Edge from its end Vertex back to its start Vertex.
ConcaveCornerVertices(wire[, angTolerance, ...])Returns the concave corner vertices of the input wire.
ConcaveHull(topology[, k, mantissa, ...])Returns a wire representing the 2D concave hull of the input topology.
ConvexCornerVertices(wire[, angTolerance, ...])Returns the convex corner vertices of the input wire.
ConvexHull(topology[, mantissa, tolerance])Returns a wire representing the 2D convex hull of the input topology.
CrossShape([origin, width, length, a, b, c, ...])Creates a Cross-shape.
Cycles(wire[, maxVertices, ...])Returns the closed circuits found within the input Wire.
Edges(wire[, silent])Returns the edges of the input wire.
Einstein([origin, radius, direction, ...])Creates an aperiodic monotile, also called an 'einstein' tile (meaning one tile in German, not the name of the famous physicist).
Ellipse([origin, inputMode, width, length, ...])Creates an elliptical Wire by delegating the exact curve to Edge.Ellipse and segmentation to Wire.ByEdge.
EllipseAll([origin, inputMode, width, ...])Creates an elliptical Wire and returns it together with the traditional ellipse parameters.
EndVertex(wire[, silent])Returns the end vertex of the input wire.
ExteriorAngles(wire[, tolerance, mantissa])Returns the exterior angles of the input wire in degrees.
ExternalBoundary(wire[, tolerance, silent])Returns the external boundary (cluster of vertices where degree == 1) of the input wire.
Fillet(wire[, radius, sides, radiusKey, ...])Fillets (rounds) the corners of the input Wire.
Funnel(face, vertexA, vertexB, portals[, ...])Returns a Wire representing a smoothed path inside the given face using the funnel (string-pulling) algorithm.
GoldenRectangle([width, maxIterations, ...])Creates a "golden rectangle".
GoldenSpiral([width, maxIterations, ...])Creates a golden spiral Wire by delegating the single exact curve to Edge.GoldenSpiral.
Helix([origin, radius, height, turns, ...])Creates a helical Wire from one smooth Edge.Helix and Wire.ByEdge.
Hyperbola([origin, a, b, fromParameter, ...])Creates a hyperbolic Wire from one exact Edge.Hyperbola and Wire.ByEdge.
IShape([origin, width, length, a, b, c, ...])Creates an I-shape.
InteriorAngles(wire[, tolerance, mantissa, ...])Returns the interior angles of the input wire in degrees.
Interpolate(wires[, n, outputType, mapping, ...])Creates intermediate Wires between successive input Wires.
Invert(wire[, silent, tolerance])Reverses the traversal direction of the input Wire while preserving its constituent Edge geometry.
IsClosed(wire[, tolerance, silent])Returns True if the input wire is closed.
IsManifold(wire[, silent, tolerance])Returns True when no coincident wire vertex has degree greater than two.
IsPolyline(wire[, tolerance, silent])Returns True if every constituent edge is geometrically linear.
IsSimilar(wireA, wireB[, angTolerance, ...])Returns True if the input wires are similar.
LShape([origin, width, length, a, b, ...])Creates an L-shape.
Lattice([origin, width, length, height, ...])Creates a prismatic 3D lattice as a Wire.
Length(wire[, mantissa, tolerance, silent])Returns the sum of the actual geometric lengths of the wire edges.
Miter(wire[, offset, offsetKey, tolerance, ...])Miters the corners of a planar polyline by trimming each adjacent linear Edge and joining the resulting trim points with a straight segment.
Normal(wire[, outputType, mantissa])Returns the normal vector to the input wire.
OrientEdges(wire, vertexA[, ...])Returns a head-to-tail wire beginning at
vertexAwithout flattening curves.Parabola([origin, focalLength, ...])Creates a parabolic Wire from one exact Edge.Parabola and Wire.ByEdge.
ParameterAtVertex(wire, vertex[, mantissa, ...])Returns the normalized global arc-length parameter of a vertex on a simple wire.
Planarize(wire[, origin, mantissa, ...])Returns a planarized version of the input Wire while preserving curve geometry.
Project(wire, face[, direction, mantissa, ...])Projects the input Wire onto the input Face while preserving curve geometry.
Rectangle([origin, width, length, ...])Creates a rectangle.
RemoveCollinearEdges(wire[, angTolerance, ...])Removes redundant consecutive linear collinear Edges while preserving curves.
Representation(wire[, normalize, rotate, ...])Returns a normalized representation of a closed wire with alternating edge lengths and interior angles.
Reverse(wire[, transferDictionaries, ...])Reverses wire traversal while preserving each edge's actual geometry.
Ribbon(wire[, thickness, thicknessKey, ...])Creates a ribbon from the input planar Wire.
Roof(face[, angle, boundary, tolerance])Creates a hipped roof through a straight skeleton. This method is contributed by 高熙鹏 xipeng gao <gaoxipeng1998@gmail.com>
Simplify(wire[, method, epsilon, tolerance, ...])Simplifies the linear portions of the input Wire while preserving curved Edges exactly.
Skeleton(face[, boundary, tolerance])Creates a straight skeleton.
Spiral([origin, radiusA, radiusB, height, ...])Creates an Archimedean spiral Wire by delegating the single curve to Edge.Spiral.
Split(wire)Splits the input wire into segments at its intersections (i.e.
Square([origin, size, diagonals, direction, ...])Creates a square.
Squircle([origin, radius, sides, a, b, ...])Creates a squircle Wire by delegating the single smooth curve to Edge.Squircle.
Star([origin, radiusA, radiusB, rays, ...])Creates a star.
StartEndVertices(wire[, silent])Returns the start and end vertices of the input wire.
StartVertex(wire[, silent])Returns the start vertex of the input wire.
Straighten(wire, host[, obstacles, portals, ...])Returns a new Wire obtained by recursively replacing segments of the input wire with the longest possible straight edge that: 1.
TShape([origin, width, length, a, b, ...])Creates a T-shape.
Trapezoid([origin, widthA, widthB, offsetA, ...])Creates a trapezoid.
VertexByDistance(wire[, distance, origin, ...])Creates a vertex at signed curvilinear distance along an open simple wire.
VertexByParameter(wire[, u, tolerance, silent])Creates a vertex at a normalized global arc-length parameter on a simple wire.
VertexDistance(wire, vertex[, origin, ...])Returns curvilinear distance along a simple wire between
originandvertex.Vertices(wire)Returns the list of vertices of the input wire.
Line
- static Arc(startVertex, middleVertex, endVertex, sides: int = 16, close: bool = True, polyline: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a circular-arc Wire through three vertices.
In exact mode (
polyline=False), the circular geometry is created as an exact Edge and segmented topologically byWire.ByEdge. In polyline mode, the arc is sampled analytically from the three input points without first requiring an exact curved Edge. This preserves the explicit approximation path on backends that do not support the exact curve construction.
- static ArcByEdge(edge, sagitta: float = 1, absolute: bool = True, sides: int = 16, close: bool = True, polyline: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a circular-arc Wire from a linear chord Edge and a sagitta.
- static Bisectors(wire, offset: float = 1.0, offsetKey: str = 'offset', stepOffsetA: float = 0, stepOffsetB: float = 0, stepOffsetKeyA: str = 'stepOffsetA', stepOffsetKeyB: str = 'stepOffsetB', reverse: bool = False, transferDictionaries: bool = False, epsilon: float = 0.01, tolerance: float = 0.0001, silent: bool = False, numWorkers: int = None)
Returns opnly the bisectors Created by an offset wire from the input wire. See Wire.ByOffset. A positive offset value results in an offset to the interior of an anti-clockwise wire.
- Parameters
- wiretopologic_core.Wire
The input wire.
- offsetfloat , optional
The desired offset distance. Default is 1.0.
- offsetKeystr , optional
The edge dictionary key under which to find the offset value. If a value cannot be found, the offset input parameter value is used instead. Default is “offset”.
- stepOffsetAfloat , optional
The amount to offset along the previous edge when transitioning between parallel edges with different offsets. Default is 0.
- stepOffsetBfloat , optional
The amount to offset along the next edge when transitioning between parallel edges with different offsets. Default is 0.
- stepOffsetKeyAstr , optional
The vertex dictionary key under which to find the step offset A value. If a value cannot be found, the stepOffsetA input parameter value is used instead. Default is “stepOffsetA”.
- stepOffsetKeyBstr , optional
The vertex dictionary key under which to find the step offset B value. If a value cannot be found, the stepOffsetB input parameter value is used instead. Default is “stepOffsetB”.
- reversebool , optional
If set to True, the direction of offsets is reversed. Otherwise, it is not. Default is False.
- transferDictionariesbool , optional
If set to True, the dictionaries of the original wire, its edges, and its vertices are transfered to the new wire. Otherwise, they are not. Default is False.
- epsilonfloat , optional
The desired epsilon (another form of tolerance for shortest edge to remove). Default is 0.01. (This is set to a larger number as it was found to work better)
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- 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
- topologic_core.Wire
The created wire.
- static BoundingRectangle(topology, optimize: int = 0, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Returns a wire representing a bounding rectangle of the input topology. The returned wire contains a dictionary with key “zrot” that represents rotations around the Z axis. If applied, the resulting wire will become axis-aligned.
- Parameters
- topologytopologic_core.Topology
The input topology.
- optimizeint , optional
If set to an integer from 1 (low optimization) to 10 (high optimization), the method will attempt to optimize the bounding rectangle so that it reduces its surface area. The minimum optimization number of 0 will result in an axis-aligned bounding rectangle. A maximum optimization number of 10 will attempt to reduce the bounding rectangle’s area by 50%. Default is 0.
- 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.Wire
The bounding rectangle of the input topology.
- static ByEdge(edge, sides: int = 1, polyline: bool = False, silent: bool = False)
Creates a Wire by subdividing or sampling one input Edge.
sidesalways means the number of Edge subtopologies in the returned Wire. In curved mode the source Edge is trimmed into exact curve segments. In polyline mode the source Edge is sampled at equal normalized parameters and straight chord Edges are created.Closed curved Edges accept any
sides >= 1. Closed polyline Edges require at least three sides. Open Edges accept anysides >= 1in either mode.
- static ByEdges(edges: list, orient: bool = False, transferDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a wire from edges while preserving the constituent edge geometry.
- static ByEdgesCluster(cluster, tolerance: float = 0.0001)
Creates a wire from the input cluster of edges.
- Parameters
- clustertopologic_core.Cluster
The input cluster of edges.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.Wire
The created wire.
- static ByOffset(wire, offset: float = 1.0, offsetKey: str = 'offset', stepOffsetA: float = 0, stepOffsetB: float = 0, stepOffsetKeyA: str = 'stepOffsetA', stepOffsetKeyB: str = 'stepOffsetB', reverse: bool = False, smooth: bool = True, bisectors: bool = False, transferDictionaries: bool = False, epsilon: float = 0.01, tolerance: float = 0.0001, silent: bool = False, numWorkers: int = None)
Creates an offset Wire.
Each source Edge may specify its own offset distance through
offsetKey. The defaultoffsetvalue is used when that key is absent. Positive offsets lie to the left of the oriented Edge when viewed along the planar Wire normal; for an anti-clockwise closed Wire this is the interior side.Polylines retain the historical TopologicPy variable-offset algorithm. When supported by the active backend, planar Wires containing circular, B-spline, or NURBS Edges can also use different per-Edge offsets without converting those curves to endpoint chords. Uniform and variable curved offsets use the same calibrated Edge-by-Edge exact native offset path. Equal distances therefore do not select a different algorithm, offset side, join strategy, or smoothing path. At every joint the finite offset Edges are intersected first. If they already cross or overshoot one another, both are trimmed to the local finite intersection. Consecutive collinear straight source Edges are handled explicitly: equal offsets remain continuous without a transition, while differing offsets trim the preceding/following offset Edges by
stepOffsetA/stepOffsetBand insert one straight step Edge between them. Only a genuine non-collinear gap is resolved by extending an exact endpoint tangent as a new straight Edge. Other line-line joints retain infinite supporting-line intersection behaviour. Ifsmoothis True, a curved Edge whose exact mathematical offset is near a cusp/fold singularity is rebuilt as one shape-preserving cubic B-spline. The source curve is sampled, every sample is displaced by the requested signed distance along its local in-plane normal, and a constrained least-squares B-spline is fitted to those offset samples. The first and last offset points are hard positional constraints and the source start/end tangent directions are hard tangent constraints. This avoids the compressed cusp produced by an exact parallel curve while retaining the source curve’s overall character. Regular exact curved offsets remain exact. Ifsmoothis False, the mathematically exact offset is retained even when singular. If neither trimming nor tangent extension can resolve a joint, the existing step-transition semantics are used.On TopologicCore, exact curved variable offsets remain unsupported and return None rather than silently approximating the source curves.
- Parameters
- wiretopologic_core.Wire
The input Wire. It must be planar when it contains curved Edges.
- offsetfloat , optional
Default signed offset distance. Default is 1.0.
- offsetKeystr , optional
Edge dictionary key used to override
offsetindependently for each source Edge. Default is “offset”.- stepOffsetAfloat , optional
Distance trimmed backward along the preceding offset Edge when adjacent variable offsets do not intersect. Default is 0.
- stepOffsetBfloat , optional
Distance trimmed forward along the following offset Edge when adjacent variable offsets do not intersect. Default is 0.
- stepOffsetKeyAstr , optional
Source joint Vertex dictionary key overriding
stepOffsetA. Default is “stepOffsetA”.- stepOffsetKeyBstr , optional
Source joint Vertex dictionary key overriding
stepOffsetB. Default is “stepOffsetB”.- reversebool , optional
If True, reverses every effective offset direction. Default is False.
- smoothbool , optional
If True, curved offsets that approach a cusp/fold singularity are replaced by one shape-preserving cubic B-spline fitted to sampled normal offsets. The first and last offset points and the source start/end tangent directions are imposed as hard constraints. Regular exact curved offsets remain exact. If False, retains the mathematically exact offset even when it contains a cusp. Default is True.
- bisectorsbool , optional
If True, include seam Edges between source joints/endpoints and the corresponding resolved offset points. Default is False.
- transferDictionariesbool , optional
If True, source Edge dictionaries are assigned to their corresponding offset Edges, source Vertex dictionaries are transferred from the canonical coincident input-Wire vertices to the corresponding offset vertices, and the source Wire dictionary is assigned to the result. When one source corner resolves to two output vertices (for example a variable-offset step or tangent-extension transition), the same source-corner dictionary is transferred to both output vertices. Transition Edges also receive the source joint Vertex dictionary when one is available. Default is False.
- epsilonfloat , optional
Historical polyline cleanup tolerance. Default is 0.01.
- tolerancefloat , optional
Geometric tolerance. Default is 0.0001.
- silentbool , optional
If True, suppress diagnostics. Default is False.
- numWorkersint , optional
Historical dictionary-transfer worker count used by the polyline path.
- Returns
- topologic_core.Wire
The offset Wire, or None if the requested exact operation cannot be constructed.
- static ByOffsetArea(wire, area, offsetKey='offset', minOffsetKey='minOffset', maxOffsetKey='maxOffset', defaultMinOffset=0, defaultMaxOffset=1, maxIterations=1, tolerance=0.0001, silent=False, numWorkers=None)
Creates an offset wire from the input wire based on the input area.
- Parameters
- wiretopologic_core.Wire
The input wire.
- areafloat
The desired area of the created wire.
- offsetKeystr , optional
The edge dictionary key under which to store the offset value. Default is “offset”.
- minOffsetKeystr , optional
The edge dictionary key under which to find the desired minimum edge offset value. If a value cannot be found, the defaultMinOffset input parameter value is used instead. Default is “minOffset”.
- maxOffsetKeystr , optional
The edge dictionary key under which to find the desired maximum edge offset value. If a value cannot be found, the defaultMaxOffset input parameter value is used instead. Default is “maxOffset”.
- defaultMinOffsetfloat , optional
The desired minimum edge offset distance. Default is 0.
- defaultMaxOffsetfloat , optional
The desired maximum edge offset distance. Default is 1.
- maxIterations: int , optional
The desired maximum number of iterations to attempt to converge on a solution. Default is 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.
- 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
- topologic_core.Wire
The created wire.
- static ByTGraphVertices(tGraph, vertices, close: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a topologic Wire from an ordered list of TGraph vertex indices.
The created Topologic vertices inherit the dictionaries of the corresponding TGraph vertices. The created Topologic edges inherit the dictionaries of the corresponding TGraph edges when such edges exist in the TGraph.
- Parameters
- tGraphtopologicpy.TGraph
The input TGraph.
- verticeslist
An ordered list of TGraph vertex indices.
- closebool, optional
If True, an additional edge is created from the last vertex back to the first vertex. Default is False.
- tolerancefloat, optional
The tolerance used by TopologicPy constructors. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Wire
The created Wire. Returns None if the input is invalid or if the Wire cannot be constructed.
- static ByVertices(vertices: list, close: bool = True, tolerance: float = 0.0001, silent: bool = False)
Creates a wire from the input list of vertices.
- Parameters
- verticeslist
The input list of vertices.
- closebool , optional
If True, the last vertex will be connected to the first vertex to close the wire. 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.Wire
The created wire.
- static ByVerticesCluster(cluster, close: bool = True, tolerance: float = 0.0001, silent: bool = False)
Creates a wire from the input cluster of vertices.
- Parameters
- clustertopologic_core.cluster
the input cluster of vertices.
- closebool , optional
If True the last vertex will be connected to the first vertex to close the wire. 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.Wire
The created wire.
- static CShape(origin=None, width=1, length=1, a=0.25, b=0.25, c=0.25, flipHorizontal=False, flipVertical=False, direction=[0, 0, 1], placement='center', tolerance=0.0001, silent=False)
Creates a C-shape.
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the C-shape. Default is None which results in the C-shape being placed at (0, 0, 0).
- widthfloat , optional
The overall width of the C-shape. Default is 1.0.
- lengthfloat , optional
The overall length of the C-shape. Default is 1.0.
- afloat , optional
The hortizontal thickness of the vertical arm of the C-shape. Default is 0.25.
- bfloat , optional
The vertical thickness of the lower horizontal arm of the C-shape. Default is 0.25.
- cfloat , optional
The vertical thickness of the upper horizontal arm of the C-shape. Default is 0.25.
- directionlist , optional
The vector representing the up direction of the C-shape. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the C-shape. This can be “center”, “lowerleft”, “upperleft”, “lowerright”, “upperright”. It is case insensitive. Default is “center”.
- 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.Wire
The created C-shape.
- static Cage(origin=None, width: float = 1.0, length: float = 1.0, height: float = 1.0, uSides: int = 2, vSides: int = 2, wSides: int = 2, direction: list = [0, 0, 1], placement: str = 'center', mantissa: int = 6, tolerance: float = 0.0001, radius: float = 0.0, base=None, silent: bool = False)
Creates a prismatic 3D cage as a Wire, with edges only on the outer surfaces of the volume (no interior lines).
- Parameters
- origintopologic_core.Vertex , optional
The placement origin of the cage: - If placement == “center”: the geometric center of the cage is placed at this origin. - If placement == “corner”: the minimum corner of the cage is placed at this origin. If None, the cage is created around (0, 0, 0) accordingly.
- widthfloat , optional
The size of the cage in the local X direction. Default is 1.0.
- lengthfloat , optional
The size of the cage in the local Y direction. Default is 1.0.
- heightfloat , optional
The size of the cage in the local Z direction. Default is 1.0.
- uSidesint , optional
The number of subdivisions in the local X direction. Must be >= 1. Default is 2.
- vSidesint , optional
The number of subdivisions in the local Y direction. Must be >= 1. Default is 2.
- wSidesint , optional
The number of subdivisions in the local Z direction. Must be >= 1. Default is 2.
- directionlist , optional
The vector representing the up direction of the lattice. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the lattice. This can be “bottom”, “center”, or “lowerleft”. It is case insensitive. Default is “center”.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.Wire or None
The resulting cage Wire, or None if inputs are invalid.
- static Circle(origin=None, radius: float = 0.5, sides: int = 16, spokes: bool = False, fromAngle: float = 0.0, toAngle: float = 360.0, close: bool = True, direction: list = [0, 0, 1], placement: str = 'center', polyline: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a circular Wire.
When
polylineis False,sidesspecifies the number of exact circular-arc Edge subtopologies. Geometric accuracy is independent of this segmentation count.When
polylineis True,sidesspecifies the number of straight segments of the historical regular-polygon approximation. The polygon vertices are constructed analytically at equal angular increments rather than by sampling the parameter space of an exact circular Edge.- Parameters
- origintopologic_core.Vertex , optional
Placement origin. If None, the global origin is used. Default is None.
- radiusfloat , optional
Circle radius. Default is 0.5.
- sidesint , optional
Number of exact arc Edges, or straight segments in polyline mode. Default is 16.
- spokesbool , optional
If True, add radial straight edges from the center to perimeter junction vertices where historically applicable. Default is False.
- fromAnglefloat , optional
Beginning of the requested angular range in degrees. Default is 0.
- toAnglefloat , optional
End of the requested angular range in degrees. Default is 360.
- closebool , optional
For a partial circle, if True add a straight closing chord. A complete 360-degree circle is already closed. Default is True.
- directionlist , optional
Circle-plane normal. Default is [0, 0, 1].
- placementstr , optional
One of “center”, “lowerleft”, “upperleft”, “lowerright”, or “upperright”. Default is “center”.
- polylinebool , optional
If True, create the historical straight-edge approximation. 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.Wire
The created circular Wire.
- static Close(wire, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Closes the input Wire by adding a straight Edge from its end Vertex back to its start Vertex.
The input Wire must be manifold and open. Existing Edges are preserved exactly and are not reconstructed from their Vertices. Thus, curved, B-Spline, and NURBS Edges remain unchanged.
- Parameters
- wiretopologic_core.Wire
The input Wire.
- mantissaint , optional
Retained for backward compatibility. It is not used because no coordinate reconstruction or rounding is performed. Default is 6.
- 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.Wire
The closed Wire.
- static ConcaveCornerVertices(wire, angTolerance: float = 0.01, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False) list
Returns the concave corner vertices of the input wire.
The wire must be closed, manifold, and represent a single non-branching cycle. A vertex is considered concave if the interior angle of the enclosed region is greater than 180 degrees, within the specified tolerance. Collinear vertices close to 180 degrees are not returned.
- Parameters
- wiretopologic_core.Wire
The input wire.
- angTolerancefloat , optional
The angular tolerance in degrees. Default is 0.01.
- mantissaint , optional
The number of decimal places to round computed angles to. Default is 6.
- tolerancefloat , optional
The geometric tolerance used for endpoint matching. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of concave corner vertices.
- static ConcaveHull(topology, k: int = 3, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Returns a wire representing the 2D concave hull of the input topology. The vertices of the topology are assumed to be coplanar. Code based on Moreira, A and Santos, M Y, “CONCAVE HULL: A K-NEAREST NEIGHBOURS APPROACH FOR THE COMPUTATION OF THE REGION OCCUPIED BY A SET OF POINTS” GRAPP 2007 - International Conference on Computer Graphics Theory and Applications.
- Parameters
- topologytopologic_core.Topology
The input topology.
- kint, optional
The number of nearest neighbors to consider for each point when building the hull. Must be at least 3 for the algorithm to function correctly. Increasing k will produce a smoother, less concave hull, while decreasing k may yield a more detailed, concave shape. Default is 3.
- 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.Wire
The concave hull of the input topology.
- static ConvexCornerVertices(wire, angTolerance: float = 0.01, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False) list
Returns the convex corner vertices of the input wire.
The wire must be closed, manifold, and represent a single non-branching cycle. A vertex is considered convex if the interior angle of the enclosed region is less than 180 degrees, within the specified tolerance. Collinear vertices close to 180 degrees are not returned.
- Parameters
- wiretopologic_core.Wire
The input wire.
- angTolerancefloat , optional
The angular tolerance in degrees. Default is 0.01.
- mantissaint , optional
The number of decimal places to round computed angles to. Default is 6.
- tolerancefloat , optional
The geometric tolerance used for endpoint matching. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of convex corner vertices.
- static ConvexHull(topology, mantissa: int = 6, tolerance: float = 0.0001)
Returns a wire representing the 2D convex hull of the input topology. The vertices of the topology are assumed to be coplanar.
- 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.
- Returns
- topologic_core.Wire
The convex hull of the input topology.
- static CrossShape(origin=None, width=1, length=1, a=0.25, b=0.25, c=None, d=None, flipHorizontal=False, flipVertical=False, direction=[0, 0, 1], placement='center', tolerance=0.0001, silent=False)
Creates a Cross-shape.
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the T-shape. Default is None which results in the Cross-shape being placed at (0, 0, 0).
- widthfloat , optional
The overall width of the Cross-shape. Default is 1.0.
- lengthfloat , optional
The overall length of the Cross-shape. Default is 1.0.
- afloat , optional
The hortizontal thickness of the vertical arm of the Cross-shape. Default is 0.25.
- bfloat , optional
The vertical thickness of the horizontal arm of the Cross-shape. Default is 0.25.
- cfloat , optional
The distance of the vertical symmetry axis measured from the left side of the Cross-shape. Default is None which results in the Cross-shape being symmetrical on the Y-axis.
- dfloat , optional
The distance of the horizontal symmetry axis measured from the bottom side of the Cross-shape. Default is None which results in the Cross-shape being symmetrical on the X-axis.
- directionlist , optional
The vector representing the up direction of the Cross-shape. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the Cross-shape. This can be “center”, “lowerleft”, “upperleft”, “lowerright”, “upperright”. It is case insensitive. Default is “center”.
- 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.Wire
The created Cross-shape.
- static Cycles(wire, maxVertices: int = 4, transferDictionaries: bool = False, tolerance: float = 0.0001) list
Returns the closed circuits found within the input Wire.
This implementation is optimized for large non-manifold wire graphs.
Existing Edge geometry is preserved exactly. Original Edges are reused directly whenever their orientation agrees with the cycle traversal. Otherwise Edge.Reverse is used, preserving curved, B-Spline, and NURBS geometry.
Cycle detection uses:
Spatial hashing for tolerance-aware endpoint identification.
Linear-time 2-core pruning to remove branches that cannot contain cycles.
Tarjan biconnected-component decomposition.
Depth-limited DFS restricted by maxVertices.
5. Canonical start/orientation rules so each undirected cycle is generated only once, without post-processing duplicate detection.
- Parameters
- wiretopologic_core.Wire
The input Wire.
- maxVerticesint , optional
The maximum number of vertices permitted in a returned cycle. Default is 4.
- transferDictionariesbool , optional
If True, dictionaries are transferred when constructing the returned cycle Wires. Default is False.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- list
The list of closed cycle Wires.
- static Edges(wire, silent: bool = False) list
Returns the edges of the input wire.
- Parameters
- wiretopologic_core.Wire
The input wire.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of edges.
- static Einstein(origin=None, radius: float = 0.5, direction: list = [0, 0, 1], placement: str = 'center', mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Creates an aperiodic monotile, also called an ‘einstein’ tile (meaning one tile in German, not the name of the famous physicist). See https://arxiv.org/abs/2303.10798
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the tile. Default is None which results in the tiles first vertex being placed at (0, 0, 0).
- radiusfloat , optional
The radius of the hexagon determining the size of the tile. Default is 0.5.
- directionlist , optional
The vector representing the up direction of the ellipse. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the hexagon determining the location of the tile. This can be “center”, or “lowerleft”. It is case insensitive. Default is “center”.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- ——-
- topologic_core.Wire
The created wire.
- static Ellipse(origin=None, inputMode: int = 1, width: float = 2.0, length: float = 1.0, focalLength: float = 0.866025, eccentricity: float = 0.866025, majorAxisLength: float = 1.0, minorAxisLength: float = 0.5, sides: int = 32, fromAngle: float = 0.0, toAngle: float = 360.0, close: bool = True, direction: list = [0, 0, 1], placement: str = 'center', polyline: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates an elliptical Wire by delegating the exact curve to Edge.Ellipse and segmentation to Wire.ByEdge.
- static EllipseAll(origin=None, inputMode: int = 1, width: float = 2.0, length: float = 1.0, focalLength: float = 0.866025, eccentricity: float = 0.866025, majorAxisLength: float = 1.0, minorAxisLength: float = 0.5, sides: int = 32, fromAngle: float = 0.0, toAngle: float = 360.0, close: bool = True, direction: list = [0, 0, 1], placement: str = 'center', polyline: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates an elliptical Wire and returns it together with the traditional ellipse parameters.
- static EndVertex(wire, silent: bool = False)
Returns the end vertex of the input wire. The wire must be manifold and open.
- Parameters
- wiretopologic_core.Wire
The input wire
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Vertex
The end vertex of the input wire.
- static ExteriorAngles(wire, tolerance: float = 0.0001, mantissa: int = 6) list
Returns the exterior angles of the input wire in degrees. The wire must be planar, manifold, and closed.
- Parameters
- wiretopologic_core.Wire
The input wire.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- mantissaint , optional
The length of the desired mantissa. Default is 6.
- Returns
- list
The list of exterior angles.
- static ExternalBoundary(wire, tolerance: float = 0.0001, silent: bool = False)
Returns the external boundary (cluster of vertices where degree == 1) of the input wire.
- Parameters
- wiretopologic_core.Wire
The input wire.
- 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 external boundary of the input wire. This is a cluster of vertices of degree == 1.
- static Fillet(wire, radius: float = 0, sides: int = 1, radiusKey: str = None, polyline: bool = False, tolerance: float = 0.0001, silent: bool = False)
Fillets (rounds) the corners of the input Wire.
Fillets are first constructed as exact circular Arc Edges. If
polylineis False, each fillet is divided intosidesgenuine circular Arc Edges. Ifpolylineis True, each fillet is approximated bysidesstraight Edge segments.The input Wire must be planar, manifold, and composed of geometrically linear Edges.
- Parameters
- wiretopologic_core.Wire
The input Wire.
- radiusfloat , optional
The default fillet radius. Default is 0.
- sidesint , optional
The number of Edges used to represent each fillet. When
polylineis False these are exact circular Arc Edges. Whenpolylineis True they are straight Edge segments. Default is 16.- radiusKeystr , optional
If specified, each corner Vertex dictionary is queried for this key. A valid non-negative numerical value overrides
radiusat that corner. Default is None.- polylinebool , optional
If True, each fillet is represented by straight Edge segments. If False, genuine circular Arc Edges are 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
- topologic_core.Wire
The filleted Wire.
- static Funnel(face, vertexA, vertexB, portals, tolerance: float = 0.0001, silent: float = False)
Returns a Wire representing a smoothed path inside the given face using the funnel (string-pulling) algorithm.
The algorithm assumes that a corridor has already been computed, and is provided as an ordered list of “portals” (pairs of vertices) that lie on the face between the start and end locations.
- Parameters
- facetopologic_core.Face
The planar face on which navigation occurs. All vertices must lie on this face.
- vertexAtopologic_core.Vertex
The start point of the path.
- vertexBtopologic_core.Vertex
The end point of the path.
- portalslist of tuple(Vertex, Vertex)
Ordered list of corridor edges. Each item is (leftVertex, rightVertex) describing the visible “portal” between two consecutive regions along the navmesh path.
- tolerancefloat , optional
Numerical tolerance used when comparing orientations and distances. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- wiretopologic_core.Wire
A Wire representing the smoothed path from startVertex to endVertex that stays inside the navigation corridor on the face.
- static GoldenRectangle(width: float = 1.0, maxIterations: int = 10, clockwise: bool = False, origin=None, placement: str = 'center', direction: list = [0, 0, 1], mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Creates a “golden rectangle”. See https://en.wikipedia.org/wiki/Golden_rectangle.
- Parameters
- widthfloat
The desired long side of the outer golden rectangle. Height is width/phi.
- maxIterationsint
Number of subdivision squares to generate.
- clockwisebool , optional
Controls the square “peel” progression (affects which side each next square is taken from). Default is False.
- origintopologic_core.Vertex, optional
The location of the origin of the rectangle. Default is None which results in the rectangle being placed at (0, 0, 0).
- directionlist , optional
The vector representing the up direction of the rectangle. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the rectangle. This can be “center”, “lowerleft”, “upperleft”, “lowerright”, “upperright”. It is case insensitive. Default is “center”.
- 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
- topologic_core.Wire
The created golden rectangle wire.
- static GoldenSpiral(width: float = 1.0, maxIterations: int = 10, clockwise: bool = False, sides: int = 96, origin=None, placement: str = 'center', direction: list = [0, 0, 1], mantissa: int = 6, polyline: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a golden spiral Wire by delegating the single exact curve to Edge.GoldenSpiral.
- static Helix(origin=None, radius: float = 0.5, height: float = 1.0, turns: float = 1.0, sides: int = 16, clockwise: bool = False, direction: list = [0, 0, 1], placement: str = 'center', polyline: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a helical Wire from one smooth Edge.Helix and Wire.ByEdge.
- static Hyperbola(origin=None, a: float = 1.0, b: float = 0.5, fromParameter: float = -1.0, toParameter: float = 1.0, branch: str = 'right', sides: int = 16, direction: list = [0, 0, 1], placement: str = 'center', polyline: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a hyperbolic Wire from one exact Edge.Hyperbola and Wire.ByEdge.
- static IShape(origin=None, width=1, length=1, a=0.25, b=0.25, c=0.25, flipHorizontal=False, flipVertical=False, direction=[0, 0, 1], placement='center', tolerance=0.0001, silent=False)
Creates an I-shape.
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the I-shape. Default is None which results in the I-shape being placed at (0, 0, 0).
- widthfloat , optional
The overall width of the I-shape. Default is 1.0.
- lengthfloat , optional
The overall length of the I-shape. Default is 1.0.
- afloat , optional
The hortizontal thickness of the central vertical arm of the I-shape. Default is 0.25.
- bfloat , optional
The vertical thickness of the lower horizontal arm of the I-shape. Default is 0.25.
- cfloat , optional
The vertical thickness of the upper horizontal arm of the I-shape. Default is 0.25.
- flipHorizontalbool , optional
if set to True, the shape is flipped horizontally. Default is False.
- flipVerticalbool , optional
if set to True, the shape is flipped vertically. Default is False.
- directionlist , optional
The vector representing the up direction of the I-shape. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the I-shape. This can be “center”, “lowerleft”, “upperleft”, “lowerright”, “upperright”. It is case insensitive. Default is “center”.
- 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.Wire
The created I-shape.
- static InteriorAngles(wire, tolerance: float = 0.0001, mantissa: int = 6, silent: bool = False) list
Returns the interior angles of the input wire in degrees.
The wire must be planar, manifold, and closed. This implementation does not create a Face from the wire. Instead, it orders the wire vertices, computes a robust polygon normal using Newell’s method, and evaluates each interior angle directly in 3D.
- Parameters
- wiretopologic_core.Wire
The input wire.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- 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
- list
The list of interior angles in degrees.
- static Interpolate(wires: list, n: int = 5, outputType: str = 'default', mapping: str = 'default', tolerance: float = 0.0001)
Creates intermediate Wires between successive input Wires.
Polyline inputs retain the historical vertex-based interpolation. When one or more input Wires contain genuine curves, corresponding Edges are interpolated as genuine B-spline curves when supported by the active backend rather than being replaced by straight endpoint chords. Curved inputs must have matching Edge counts and compatible open/closed topology.
- Parameters
- wireslist
Ordered input Wires.
- nint , optional
Number of intermediate Wires between each pair. Default is 5.
- outputTypestr , optional
"default"/"contours","raster"/"zigzag"/"toolpath", or"grid". Default is"default".- mappingstr , optional
Historical polyline vertex mapping:
"default"/"repeat"or"nearest". Curved interpolation requires matching Edge topology. Default is"default".- tolerancefloat , optional
Geometric tolerance. Default is 0.0001.
- Returns
- topologic_core.Topology
The interpolated contours and optional connecting ridges.
- static Invert(wire, silent: bool = False, tolerance: float = 0.0001)
Reverses the traversal direction of the input Wire while preserving its constituent Edge geometry.
This method is retained as an alias of
Wire.Reverse()for backward compatibility. Curved Edges are reversed natively and are never rebuilt from endpoint chords.- Parameters
- wiretopologic_core.Wire
The input Wire.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.Wire
The reversed Wire.
- static IsClosed(wire, tolerance: float = 0.0001, silent: bool = False) bool
Returns True if the input wire is closed.
- static IsManifold(wire, silent: bool = False, tolerance: float = 0.0001) bool
Returns True when no coincident wire vertex has degree greater than two.
- static IsPolyline(wire, tolerance: float = 0.0001, silent: bool = False) bool
Returns True if every constituent edge is geometrically linear.
- static IsSimilar(wireA, wireB, angTolerance: float = 0.1, tolerance: float = 0.0001) bool
Returns True if the input wires are similar. Returns False otherwise. The wires must be closed.
- Parameters
- wireAtopologic_core.Wire
The first input wire.
- wireBtopologic_core.Wire
The second input wire.
- angTolerancefloat , optional
The desired angular tolerance. Default is 0.1.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- bool
True if the two input wires are similar. False otherwise.
- static LShape(origin=None, width=1, length=1, a=0.25, b=0.25, flipHorizontal=False, flipVertical=False, direction=[0, 0, 1], placement='center', tolerance=0.0001, silent=False)
Creates an L-shape.
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the L-shape. Default is None which results in the L-shape being placed at (0, 0, 0).
- widthfloat , optional
The overall width of the L-shape. Default is 1.0.
- lengthfloat , optional
The overall length of the L-shape. Default is 1.0.
- afloat , optional
The hortizontal thickness of the vertical arm of the L-shape. Default is 0.25.
- bfloat , optional
The vertical thickness of the horizontal arm of the L-shape. Default is 0.25.
- directionlist , optional
The vector representing the up direction of the L-shape. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the L-shape. This can be “center”, “lowerleft”, “upperleft”, “lowerright”, “upperright”. It is case insensitive. Default is “center”.
- 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.Wire
The created L-shape.
- static Lattice(origin=None, width: float = 1.0, length: float = 1.0, height: float = 1.0, uSides: int = 2, vSides: int = 2, wSides: int = 2, direction: list = [0, 0, 1], placement: str = 'center', mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Creates a prismatic 3D lattice as a Wire.
- Parameters
- origintopologic_core.Vertex , optional
Placement origin.
- width, length, heightfloat
Lattice extents.
- uSides, vSides, wSidesint
Divisions along X, Y, Z.
- directionlist , optional
The vector representing the up direction of the lattice. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the lattice. This can be “bottom”, “center”, or “lowerleft”. It is case insensitive. Default is “center”.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.Wire
- static Length(wire, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False) float
Returns the sum of the actual geometric lengths of the wire edges.
- static Line(origin=None, length: float = 1, direction: list = [1, 0, 0], sides: int = 2, placement: str = 'center', tolerance: float = 0.0001, silent: bool = True)
- static Miter(wire, offset: float = 0, offsetKey: str = None, tolerance: float = 0.0001, silent: bool = False)
Miters the corners of a planar polyline by trimming each adjacent linear Edge and joining the resulting trim points with a straight segment.
This is intentionally a linear/polyline operation. Curved input Edges are rejected rather than silently replaced by endpoint chords.
- Parameters
- wiretopologic_core.Wire
The input Wire.
- offsetfloat
The desired trim distance along each adjacent Edge.
- offsetKeystr , optional
If specified, each corner Vertex dictionary is queried for this key. A valid non-negative numerical value overrides
offsetat that corner.- 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.Wire
The mitered polyline Wire.
- static Normal(wire, outputType='xyz', mantissa=6)
Returns the normal vector to the input wire. A normal vector of a wire is a vector perpendicular to it.
- Parameters
- wiretopologic_core.Wire
The input wire.
- outputTypestring , optional
The string defining the desired output. This can be any subset or permutation of “xyz”. It is case insensitive. Default is “xyz”.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- Returns
- list
The normal vector to the input face.
- static OrientEdges(wire, vertexA, transferDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False)
Returns a head-to-tail wire beginning at
vertexAwithout flattening curves.
- static Parabola(origin=None, focalLength: float = 0.5, fromParameter: float = -1.0, toParameter: float = 1.0, sides: int = 16, direction: list = [0, 0, 1], placement: str = 'vertex', polyline: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a parabolic Wire from one exact Edge.Parabola and Wire.ByEdge.
- static ParameterAtVertex(wire, vertex, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Returns the normalized global arc-length parameter of a vertex on a simple wire.
- static Planarize(wire, origin=None, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Returns a planarized version of the input Wire while preserving curve geometry.
A best-fit plane normal is derived from the Wire vertices. If
originis None, the centroid of the Wire is used as the plane origin. When supported by the active backend, the complete Wire is projected normally onto that plane using native geometry, preserving lines, circular arcs, B-splines, and NURBS curves. On backends without native curve projection, an exact fallback is used only for polylines.- Parameters
- wiretopologic_core.Wire
The input Wire.
- origintopologic_core.Vertex , optional
The origin of the receiving plane. If None, the centroid of the input Wire is used. Default is None.
- mantissaint , optional
The number of decimal places used to derive the plane equation. 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.Wire
The planarized Wire, or None if exact curve preservation is unavailable.
- static Project(wire, face, direction: list = None, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Projects the input Wire onto the input Face while preserving curve geometry.
When supported by the active backend, the complete Wire is projected natively. Lines, circular arcs, B-splines, and NURBS curves therefore remain genuine curves. On backends without native curve projection, a fallback is used only when both the receiving Face is planar and the source Wire is a polyline, because in that case projecting each linear Edge by its endpoints is exact.
- Parameters
- wiretopologic_core.Wire
The input Wire.
- facetopologic_core.Face
The receiving Face.
- directionlist , optional
Projection direction. If None, the reverse of the receiving Face normal is used. Default is None.
- mantissaint , optional
The number of decimal places used by Face.Normal. 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.Wire
The projected Wire, or None if an exact curve-preserving projection cannot be constructed.
- static Rectangle(origin=None, width: float = 1.0, length: float = 1.0, diagonals: bool = False, direction: list = [0, 0, 1], placement: str = 'center', angTolerance: float = 0.1, tolerance: float = 0.0001, silent: bool = False)
Creates a rectangle.
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the rectangle. Default is None which results in the rectangle being placed at (0, 0, 0).
- widthfloat , optional
The width of the rectangle. Default is 1.0.
- lengthfloat , optional
The length of the rectangle. Default is 1.0.
- diagonalsbool , optional
If set to True, the diagonals of the rectangle are included. Diagonals are split at the centroid of the rectangle. Default is False.
- directionlist , optional
The vector representing the up direction of the rectangle. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the rectangle. This can be “center”, “lowerleft”, “upperleft”, “lowerright”, “upperright”. It is case insensitive. Default is “center”.
- 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
- topologic_core.Wire
The created rectangle.
- static RemoveCollinearEdges(wire, angTolerance: float = 0.1, tolerance: float = 0.0001, silent: bool = False)
Removes redundant consecutive linear collinear Edges while preserving curves.
Curved Edges are never rebuilt or replaced. Only runs of consecutive, geometrically linear Edges that are collinear and continue in the same traversal direction are merged into one linear Edge.
- Parameters
- wiretopologic_core.Wire or topologic_core.Cluster
The input Wire, or a Cluster containing Wires.
- angTolerancefloat , optional
Maximum angular deviation in degrees for two consecutive linear Edges to be treated as a continuation. Default is 0.1.
- 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
- topologic_core.Topology
The simplified Wire, or a merged topology if a Cluster/non-manifold input produces multiple components.
- static Representation(wire, normalize: bool = True, rotate: bool = True, mantissa: int = 6, tolerance: float = 0.0001)
Returns a normalized representation of a closed wire with alternating edge lengths and interior angles.
- Parameters
- wiretopologic_core.Wire
The input wire.
- normalizebool , optional
If set to True, the edge lengths are normalized such that the shortest edge has a length of 1. Default is True.
- rotatebool , optional
If set to True, the representation is rotated such that the shortest edge appears first. Default is True.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- list
The representation list consisting of alternating edge lengths and interior angles.
- static Reverse(wire, transferDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False)
Reverses wire traversal while preserving each edge’s actual geometry.
- static Ribbon(wire, thickness: float = 1.0, thicknessKey: str = 'thickness', offset: float = 1.0, offsetKey: str = 'offset', stepOffsetA: float = 0, stepOffsetB: float = 0, stepOffsetKeyA: str = 'stepOffsetA', stepOffsetKeyB: str = 'stepOffsetB', reverse: bool = False, bisectors: bool = False, transferDictionaries: bool = False, epsilon: float = 0.01, tolerance: float = 0.0001, silent: bool = False, numWorkers: int = None)
Creates a ribbon from the input planar Wire.
Two exact offset Wires define the sides of the ribbon. Existing curved, circular, B-Spline, and NURBS geometry produced by Wire.ByOffset is preserved and is never reconstructed from vertices.
For an open input Wire, the two offset Wires are connected at their ends with straight cap Edges to create one closed boundary.
For a closed input Wire, the larger offset loop becomes the external boundary and the smaller loop becomes an internal boundary.
If bisectors is False, a Face is returned. If bisectors is True, the ribbon Face is sliced by the straight bisector/seam Edges and a Shell is returned.
- Parameters
- wiretopologic_core.Wire
The input planar manifold Wire.
- thicknessfloat , optional
The ribbon width. Default is 1.0.
- thicknessKeystr , optional
Edge dictionary key specifying the ribbon thickness. Default is “thickness”.
- offsetfloat , optional
Distance from the input Wire to the first side of the ribbon. Default is 1.0.
- offsetKeystr , optional
Edge dictionary key specifying the initial offset. Default is “offset”.
- stepOffsetAfloat , optional
Step offset applied along the preceding Edge. Default is 0.
- stepOffsetBfloat , optional
Step offset applied along the following Edge. Default is 0.
- stepOffsetKeyAstr , optional
Vertex dictionary key overriding stepOffsetA. Default is “stepOffsetA”.
- stepOffsetKeyBstr , optional
Vertex dictionary key overriding stepOffsetB. Default is “stepOffsetB”.
- reversebool , optional
If True, reverses the offset direction. Default is False.
- bisectorsbool , optional
If False, returns one Face. If True, includes seam divisions and returns a Shell. Default is False.
- transferDictionariesbool , optional
If True, transfers source dictionaries to the resulting topology. Default is False.
- epsilonfloat , optional
Small extension applied to seam Edges before slicing. Default is 0.01.
- tolerancefloat , optional
The desired geometric tolerance. Default is 0.0001.
- silentbool , optional
If True, suppresses diagnostic messages. Default is False.
- numWorkersint , optional
Number of workers used for dictionary transfer. Default is None.
- Returns
- topologic_core.Face or topologic_core.Shell
The created ribbon.
- static Roof(face, angle: float = 45, boundary: bool = True, tolerance: float = 0.001)
Creates a hipped roof through a straight skeleton. This method is contributed by 高熙鹏 xipeng gao <gaoxipeng1998@gmail.com> This algorithm depends on the polyskel code which is included in the library. Polyskel code is found at: https://github.com/Botffy/polyskel
- Parameters
- facetopologic_core.Face
The input face.
- anglefloat , optioal
The desired angle in degrees of the roof. Default is 45.
- boundarybool , optional
If set to True the original boundary is returned as part of the roof. Otherwise it is not. Default is True.
- tolerancefloat , optional
The desired tolerance. Default is 0.001. (This is set to a larger number as it was found to work better)
- Returns
- topologic_core.Wire
The created roof. This method returns the roof as a set of edges. No faces are created.
- static Simplify(wire, method: str = 'douglas-peucker', epsilon: float = 0.0001, tolerance: float = 0.0001, silent: bool = False)
Simplifies the linear portions of the input Wire while preserving curved Edges exactly.
Purely polygonal Wires are simplified as complete paths or cycles. For mixed Wires, each contiguous run of linear Edges is simplified independently, while circular, elliptical, B-Spline, NURBS, and other curved Edges are retained unchanged.
- Parameters
- wiretopologic_core.Wire
The input Wire.
- methodstr , optional
The simplification method. Supported values are “douglas-peucker”, “visvalingam-whyatt”, and “reumann-witkam”. Default is “douglas-peucker”.
- epsilonfloat , optional
The simplification threshold. For Douglas-Peucker and Reumann-Witkam, this is a distance. For Visvalingam-Whyatt, this is an area. Default is 0.0001.
- tolerancefloat , optional
The topology construction and coincidence tolerance. Default is 0.0001.
- silentbool , optional
If True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Wire
The simplified Wire.
- static Skeleton(face, boundary: bool = True, tolerance: float = 0.001)
Creates a straight skeleton. This method is contributed by 高熙鹏 xipeng gao <gaoxipeng1998@gmail.com> This algorithm depends on the polyskel code which is included in the library. Polyskel code is found at: https://github.com/Botffy/polyskel
- Parameters
- facetopologic_core.Face
The input face.
- boundarybool , optional
If set to True the original boundary is returned as part of the roof. Otherwise it is not. Default is True.
- tolerancefloat , optional
The desired tolerance. Default is 0.001. (This is set to a larger number as it was found to work better)
- Returns
- topologic_core.Wire
The created straight skeleton.
- static Spiral(origin=None, radiusA: float = 0.05, radiusB: float = 0.5, height: float = 1.0, turns: int = 10, sides: int = 36, clockwise: bool = False, reverse: bool = False, direction: list = [0, 0, 1], placement: str = 'center', polyline: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates an Archimedean spiral Wire by delegating the single curve to Edge.Spiral.
- static Split(wire) list
Splits the input wire into segments at its intersections (i.e. at any vertex where more than two edges meet).
- Parameters
- wiretopologic_core.Wire
The input wire.
- Returns
- list
The list of split wire segments.
- static Square(origin=None, size: float = 1.0, diagonals=False, direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001)
Creates a square.
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the square. Default is None which results in the square being placed at (0, 0, 0).
- sizefloat , optional
The size of the square. Default is 1.0.
- diagonalsbool , optional
If set to True, the diagonals of the rectangle are included. Diagonals are split at the centroid of the rectangle. Default is False.
- directionlist , optional
The vector representing the up direction of the square. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the square. This can be “center”, “lowerleft”, “upperleft”, “lowerright”, “upperright”. It is case insensitive. Default is “center”.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.Wire
The created square.
- static Squircle(origin=None, radius: float = 0.5, sides: int = 121, a: float = 2.0, b: float = 2.0, direction: list = [0, 0, 1], placement: str = 'center', angTolerance: float = 0.1, polyline: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a squircle Wire by delegating the single smooth curve to Edge.Squircle.
- static Star(origin=None, radiusA: float = 0.5, radiusB: float = 0.2, rays: int = 8, direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001, silent: bool = False)
Creates a star.
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the star. Default is None which results in the star being placed at (0, 0, 0).
- radiusAfloat , optional
The outer radius of the star. Default is 1.0.
- radiusBfloat , optional
The outer radius of the star. Default is 0.4.
- raysint , optional
The number of star rays. Default is 8.
- directionlist , optional
The vector representing the up direction of the star. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the star. This can be “center”, “lowerleft”, “upperleft”, “lowerright”, or “upperright”. It is case insensitive. Default is “center”.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.Wire
The created star.
- static StartEndVertices(wire, silent: bool = False) list
Returns the start and end vertices of the input wire. The wire must be manifold and open.
- Parameters
- wiretopologic_core.Wire
The input wire
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of start and end vertices of the input wire
- static StartVertex(wire, silent: bool = False)
Returns the start vertex of the input wire. The wire must be manifold and open.
- Parameters
- wiretopologic_core.Wire
The input wire
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Vertex
The start vertex of the input wire.
- static Straighten(wire, host, obstacles: list = None, portals: list = None, tolerance: float = 0.0001, silent: bool = False)
Returns a new Wire obtained by recursively replacing segments of the input wire with the longest possible straight edge that: 1. Is fully embedded in the given host. 2. Avoids intersection with an optional list of obstacle topologies. 3. Continues to pass through (intersects) an optional list of portal topologies that the original input wire intersects.
- Parameters
- wiretopologic_core.Wire
The input path wire whose vertices define the route to be straightened.
- hosttopologic_core.Topology
The host within which the straightened edges must lie.
- obstacleslist, optional
The list of topologies with which the straightened edges must not intersect.
- portalslist, optional
The list of topologies with which the straightened edges must intersect. Portals with which the original wire does NOT intersect are ignored.
- 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
- wiretopologic_core.Wire
A new Wire whose vertices define the recursively straightened path.
- static TShape(origin=None, width=1, length=1, a=0.25, b=0.25, flipHorizontal=False, flipVertical=False, direction=[0, 0, 1], placement='center', tolerance=0.0001, silent=False)
Creates a T-shape.
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the T-shape. Default is None which results in the T-shape being placed at (0, 0, 0).
- widthfloat , optional
The overall width of the T-shape. Default is 1.0.
- lengthfloat , optional
The overall length of the T-shape. Default is 1.0.
- afloat , optional
The hortizontal thickness of the vertical arm of the T-shape. Default is 0.25.
- bfloat , optional
The vertical thickness of the horizontal arm of the T-shape. Default is 0.25.
- directionlist , optional
The vector representing the up direction of the T-shape. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the T-shape. This can be “center”, “lowerleft”, “upperleft”, “lowerright”, “upperright”. It is case insensitive. Default is “center”.
- 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.Wire
The created T-shape.
- static Trapezoid(origin=None, widthA: float = 1.0, widthB: float = 0.75, offsetA: float = 0.0, offsetB: float = 0.0, length: float = 1.0, direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001, silent: bool = False)
Creates a trapezoid.
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the trapezoid. Default is None which results in the trapezoid being placed at (0, 0, 0).
- widthAfloat , optional
The width of the bottom edge of the trapezoid. Default is 1.0.
- widthBfloat , optional
The width of the top edge of the trapezoid. Default is 0.75.
- offsetAfloat , optional
The offset of the bottom edge of the trapezoid. Default is 0.0.
- offsetBfloat , optional
The offset of the top edge of the trapezoid. Default is 0.0.
- lengthfloat , optional
The length of the trapezoid. Default is 1.0.
- directionlist , optional
The vector representing the up direction of the trapezoid. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the trapezoid. This can be “center”, or “lowerleft”. It is case insensitive. Default is “center”.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.Wire
The created trapezoid.
- static VertexByDistance(wire, distance: float = 0.0, origin=None, tolerance: float = 0.0001, silent: bool = False)
Creates a vertex at signed curvilinear distance along an open simple wire.
- static VertexByParameter(wire, u: float = 0.0, tolerance: float = 0.0001, silent: bool = False)
Creates a vertex at a normalized global arc-length parameter on a simple wire.
- static VertexDistance(wire, vertex, origin=None, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Returns curvilinear distance along a simple wire between
originandvertex.
- static Vertices(wire) list
Returns the list of vertices of the input wire.
- Parameters
- wiretopologic_core.Wire
The input wire.
- Returns
- list
The list of vertices.