topologicpy.Wire module
- class topologicpy.Wire.Wire
Bases:
objectMethods
Arc(startVertex, middleVertex, endVertex[, ...])Creates an arc.
ArcByEdge([sagitta, absolute, sides, close, ...])Creates an arc.
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.
ByEdges(edges[, orient, ...])Creates a wire from the input list of edges.
ByEdgesCluster(cluster[, tolerance])Creates a wire from the input cluster of edges.
ByOffset(wire[, offset, offsetKey, ...])Creates an offset wire from the input wire.
ByOffsetArea(wire, area[, offsetKey, ...])Creates an offset wire from the input wire based on the input area.
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 circle.
Close(wire[, mantissa, tolerance, silent])Closes the input wire
ConcaveHull(topology[, k, mantissa, ...])Returns a wire representing the 2D concave hull of the input topology.
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 of wires found within the input wire.
Edges(wire)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 ellipse and returns all its geometry and parameters.
EllipseAll([origin, inputMode, width, ...])Creates an ellipse and returns all its geometry and 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 interior and exterior corners of the input wire given the input radius.
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" as segmented quarter-circle arcs.
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 n number of wires that interpolate between wireA and wireB.
Invert(wire[, tolerance])Creates a wire that is an inverse (mirror) of the input wire.
IsClosed(wire)Returns True if the input wire is closed.
IsManifold(wire[, silent])Returns True if the input wire is manifold.
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])Returns the length of the input wire.
Line([origin, length, direction, sides, ...])Creates a straight line wire using the input parameters.
Miter(wire[, offset, offsetKey, tolerance, ...])Fillets (rounds) the interior and exterior corners of the input wire given the input radius.
Normal(wire[, outputType, mantissa])Returns the normal vector to the input wire.
OrientEdges(wire, vertexA[, ...])Returns a correctly oriented head-to-tail version of the input wire.
ParameterAtVertex(wire, vertex[, mantissa, ...])Returns the u-parameter of a vertex located on a manifold wire.
Planarize(wire[, origin, mantissa, tolerance])Returns a planarized version of the input wire.
Project(wire, face[, direction, mantissa, ...])Creates a projection of the input wire unto the input face.
Rectangle([origin, width, length, ...])Creates a rectangle.
RemoveCollinearEdges(wire[, angTolerance, ...])Removes any collinear edges in the input wire.
Representation(wire[, normalize, rotate, ...])Returns a normalized representation of a closed wire with alternating edge lengths and interior angles.
Reverse(wire[, transferDictionaries, ...])Creates a wire that has the reverse direction of the input wire.
Ribbon(wire[, thickness, thicknessKey, ...])Creates a ribbon (face or shell) wire from the input 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, tolerance, silent])Simplifies the input wire edges based on the selected algorithm: Douglas-Peucker or Visvalingam–Whyatt.
Skeleton(face[, boundary, tolerance])Creates a straight skeleton.
Spiral([origin, radiusA, radiusB, height, ...])Creates a 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 which is a hybrid between a circle and a square.
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 along the input wire offset by the input distance from the input origin.
VertexByParameter(wire[, u])Creates a vertex along the input wire offset by the input u parameter.
VertexDistance(wire, vertex[, origin, ...])Returns the distance, computed along the input wire of the input vertex from the input origin vertex.
Vertices(wire)Returns the list of vertices of the input wire.
- static Arc(startVertex, middleVertex, endVertex, sides: int = 16, close: bool = True, tolerance: float = 0.0001, silent: bool = False)
Creates an arc. The base chord will be parallel to the x-axis and the height will point in the positive y-axis direction.
- Parameters
- startVertextopologic_core.Vertex
The start vertex of the arc.
- middleVertextopologic_core.Vertex
The middle vertex (apex) of the arc.
- endVertextopologic_core.Vertex
The end vertex of the arc.
- sidesint , optional
The number of sides of the arc. Default is 16.
- closebool , optional
If set to True, the arc will be closed by connecting the last vertex to the first vertex. Otherwise, it will be left open.
- 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 arc.
- ArcByEdge(sagitta: float = 1, absolute: bool = True, sides: int = 16, close: bool = True, tolerance: float = 0.0001, silent: bool = False)
Creates an arc. The base chord will be parallel to the x-axis and the height will point in the positive y-axis direction.
- Parameters
- edgetopologic_core.Edge
The location of the start vertex of the arc.
- sagittafloat , optional
The length of the sagitta. In mathematics, the sagitta is the line connecting the center of a chord to the apex (or highest point) of the arc subtended by that chord. Default is 1.
- absolutebool , optional
If set to True, the sagitta length is treated as an absolute value. Otherwise, it is treated as a ratio based on the length of the edge. For example, if the length of the edge is 10, the sagitta is set to 0.5, and absolute is set to False, the sagitta length will be 5. Default is True.
- sidesint , optional
The number of sides of the arc. Default is 16.
- closebool , optional
If set to True, the arc will be closed by connecting the last vertex to the first vertex. Otherwise, it will be left open.
- 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 arc.
- 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 ByEdges(edges: list, orient: bool = False, transferDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False)
Creates a wire from the input list of edges.
- Parameters
- edgeslist
The input list of edges.
- orientbool , optional
If set to True the edges are oriented head to tail. Otherwise, they are not. Default is False.
- transferDictionariesbool , optional
If set to True, any dictionaries in the edges are transferred to the edges of the created Wire. Otherwise, they are not. Default is False.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Wire
The created wire.
- 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, bisectors: bool = False, transferDictionaries: bool = False, epsilon: float = 0.01, tolerance: float = 0.0001, silent: bool = False, numWorkers: int = None)
Creates an offset wire from the input wire. 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.
- bisectorsbool , optional
If set to True, The bisectors (seams) edges will be included in the returned wire. 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 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 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)
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', tolerance: float = 0.0001, silent: bool = False)
Creates a circle.
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the circle. Default is None which results in the circle being placed at (0, 0, 0).
- radiusfloat , optional
The radius of the circle. Default is 0.5.
- sidesint , optional
The desired number of sides of the circle. Default is 16.
- spokesbool , optional
If set to True, spoke edges from the center to the circumference are added. Default is False.
- fromAnglefloat , optional
The angle in degrees from which to start creating the arc of the circle. Default is 0.
- toAnglefloat , optional
The angle in degrees at which to end creating the arc of the circle. Default is 360.
- closebool , optional
If set to True, arcs will be closed by connecting the last vertex to the first vertex. Otherwise, they will be left open.
- directionlist , optional
The vector representing the up direction of the circle. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the circle. 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 circle.
- static Close(wire, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Closes the input wire
- Parameters
- wiretopologic_core.Wire
The input wire.
- 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 closed version of the input wire.
- 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 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 of wires found within the input wire.
- Parameters
- wiretopologic_core.Wire
The input wire.
- maxVerticesint , optional
The maximum number of vertices of the circuits to be searched. Default is 4.
- transferDictionariesbool , optional
If set to True, transfers the dictionaries of the original edges to the corresponding new edges in the resulting cycle wires. Default is False.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- list
The list of circuits (closed wires) found within the input wire.
- static Edges(wire) list
Returns the edges of the input wire.
- Parameters
- wiretopologic_core.Wire
The input wire.
- 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)
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: float = 32, fromAngle: float = 0.0, toAngle: float = 360.0, close: bool = True, direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001)
Creates an ellipse and returns all its geometry and parameters.
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the ellipse. Default is None which results in the ellipse being placed at (0, 0, 0).
- inputModeint , optional
The method by which the ellipse is defined. Default is 1. Based on the inputMode value, only the following inputs will be considered. The options are: 1. Width and Length (considered inputs: width, length) 2. Focal Length and Eccentricity (considered inputs: focalLength, eccentricity) 3. Focal Length and Minor Axis Length (considered inputs: focalLength, minorAxisLength) 4. Major Axis Length and Minor Axis Length (considered input: majorAxisLength, minorAxisLength)
- widthfloat , optional
The width of the ellipse. Default is 2.0. This is considered if the inputMode is 1.
- lengthfloat , optional
The length of the ellipse. Default is 1.0. This is considered if the inputMode is 1.
- focalLengthfloat , optional
The focal length of the ellipse. Default is 0.866025. This is considered if the inputMode is 2 or 3.
- eccentricityfloat , optional
The eccentricity of the ellipse. Default is 0.866025. This is considered if the inputMode is 2.
- majorAxisLengthfloat , optional
The length of the major axis of the ellipse. Default is 1.0. This is considered if the inputMode is 4.
- minorAxisLengthfloat , optional
The length of the minor axis of the ellipse. Default is 0.5. This is considered if the inputMode is 3 or 4.
- sidesint , optional
The number of sides of the ellipse. Default is 32.
- fromAnglefloat , optional
The angle in degrees from which to start creating the arc of the ellipse. Default is 0.
- toAnglefloat , optional
The angle in degrees at which to end creating the arc of the ellipse. Default is 360.
- closebool , optional
If set to True, arcs will be closed by connecting the last vertex to the first vertex. Otherwise, they will be left open.
- 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 ellipse. 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 ellipse
- 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', tolerance: float = 0.0001)
Creates an ellipse and returns all its geometry and parameters.
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the ellipse. Default is None which results in the ellipse being placed at (0, 0, 0).
- inputModeint , optional
The method by which the ellipse is defined. Default is 1. Based on the inputMode value, only the following inputs will be considered. The options are: 1. Width and Length (considered inputs: width, length) 2. Focal Length and Eccentricity (considered inputs: focalLength, eccentricity) 3. Focal Length and Minor Axis Length (considered inputs: focalLength, minorAxisLength) 4. Major Axis Length and Minor Axis Length (considered input: majorAxisLength, minorAxisLength)
- widthfloat , optional
The width of the ellipse. Default is 2.0. This is considered if the inputMode is 1.
- lengthfloat , optional
The length of the ellipse. Default is 1.0. This is considered if the inputMode is 1.
- focalLengthfloat , optional
The focal length of the ellipse. Default is 0.866025. This is considered if the inputMode is 2 or 3.
- eccentricityfloat , optional
The eccentricity of the ellipse. Default is 0.866025. This is considered if the inputMode is 2.
- majorAxisLengthfloat , optional
The length of the major axis of the ellipse. Default is 1.0. This is considered if the inputMode is 4.
- minorAxisLengthfloat , optional
The length of the minor axis of the ellipse. Default is 0.5. This is considered if the inputMode is 3 or 4.
- sidesint , optional
The number of sides of the ellipse. Default is 32.
- fromAnglefloat , optional
The angle in degrees from which to start creating the arc of the ellipse. Default is 0.
- toAnglefloat , optional
The angle in degrees at which to end creating the arc of the ellipse. Default is 360.
- closebool , optional
If set to True, arcs will be closed by connecting the last vertex to the first vertex. Otherwise, they will be left open.
- 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 ellipse. This can be “center”, or “lowerleft”. It is case insensitive. Default is “center”.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- dictionary
A dictionary with the following keys and values: 1. “ellipse” : The ellipse (topologic_core.Wire) 2. “foci” : The two focal points (topologic_core.Cluster containing two vertices) 3. “a” : The major axis length 4. “b” : The minor axis length 5. “c” : The focal length 6. “e” : The eccentricity 7. “width” : The width 8. “length” : The length
- 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 = 16, radiusKey: str = None, tolerance: float = 0.0001, silent: bool = False)
Fillets (rounds) the interior and exterior corners of the input wire given the input radius. See https://en.wikipedia.org/wiki/Fillet_(mechanics)
- Parameters
- wiretopologic_core.Wire
The input wire.
- radiusfloat
The desired radius of the fillet.
- radiusKeystr , optional
If specified, the dictionary of the vertices will be queried for this key to specify the desired fillet radius. Default is None.
- sidesint , optional
The number of sides (segments) of the fillet. 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.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, tolerance: float = 0.0001, silent: bool = False)
Creates a “golden spiral” as segmented quarter-circle arcs. See https://en.wikipedia.org/wiki/Golden_spiral
- 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.
- sidesint , optional
The number of sides of the golden spiral (if included). Notes: If you set sides to be equal to maxIterations, you get the diagonals. It is best if the number of sides is a multiple of maxIterations. Default is 96.
- 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 spiral wire
- 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) list
Returns the interior angles of the input wire in degrees. The wire must be planar, manifold, and closed. This code has been contributed by Yidan Xue.
- 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.
- Returns
- list
The list of interior angles.
- static Interpolate(wires: list, n: int = 5, outputType: str = 'default', mapping: str = 'default', tolerance: float = 0.0001)
Creates n number of wires that interpolate between wireA and wireB.
- Parameters
- wireAtopologic_core.Wire
The first input wire.
- wireBtopologic_core.Wire
The second input wire.
- nint , optional
The number of intermediate wires to create. Default is 5.
- outputTypestr , optional
- The desired type of output. The options are case insensitive. Default is “contour”. The options are:
“Default” or “Contours” (wires are not connected)
“Raster or “Zigzag” or “Toolpath” (the wire ends are connected to create a continuous path)
“Grid” (the wire ends are connected to create a grid).
- mappingstr , optional
- The desired type of mapping for wires with different number of vertices. It is case insensitive. Default is “default”. The options are:
“Default” or “Repeat” which repeats the last vertex of the wire with the least number of vertices
“Nearest” which maps the vertices of one wire to the nearest vertex of the next wire creating a list of equal number of vertices.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.Topology
The created interpolated wires as well as the input wires. The return type can be a topologic_core.Cluster or a topologic_core.Wire based on options.
- static Invert(wire, tolerance: float = 0.0001)
Creates a wire that is an inverse (mirror) of the input wire.
- Parameters
- wiretopologic_core.Wire
The input wire.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.Wire
The inverted wire.
- static IsClosed(wire) bool
Returns True if the input wire is closed. Returns False otherwise.
- Parameters
- wiretopologic_core.Wire
The input wire.
- Returns
- bool
True if the input wire is closed. False otherwise.
- static IsManifold(wire, silent: bool = False) bool
Returns True if the input wire is manifold. Returns False otherwise. A manifold wire is one where its vertices have a degree of 1 or 2.
- Parameters
- wiretopologic_core.Wire
The input wire.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- bool
True if the input wire is manifold. False otherwise.
- 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)
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) float
Returns the length of the input wire.
- Parameters
- wiretopologic_core.Wire
The input wire.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- Returns
- float
The length of the input wire. Test
- static Line(origin=None, length: float = 1, direction: list = [1, 0, 0], sides: int = 2, placement: str = 'center', tolerance: float = 0.0001)
Creates a straight line wire using the input parameters.
- Parameters
- origintopologic_core.Vertex , optional
The origin location of the box. Default is None which results in the edge being placed at (0, 0, 0).
- lengthfloat , optional
The desired length of the edge. Default is 1.0.
- directionlist , optional
The desired direction (vector) of the edge. Default is [1, 0, 0] (along the X-axis).
- sidesint , optional
The desired number of sides/segments. The minimum number of sides is 2. Default is 2.
- placementstr , optional
The desired placement of the edge. The options are: 1. “center” which places the center of the edge at the origin. 2. “start” which places the start of the edge at the origin. 3. “end” which places the end of the edge at the origin. The default is “center”.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.Edge
The created edge
- static Miter(wire, offset: float = 0, offsetKey: str = None, tolerance: float = 0.0001, silent: bool = False)
Fillets (rounds) the interior and exterior corners of the input wire given the input radius. See https://en.wikipedia.org/wiki/Fillet_(mechanics)
- Parameters
- wiretopologic_core.Wire
The input wire.
- offsetfloat
The desired offset length of the miter along each edge.
- offsetKeystr , optional
If specified, the dictionary of the vertices will be queried for this key to specify the desired offset length. 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
- topologic_core.Wire
The filleted 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=False, tolerance=0.0001)
Returns a correctly oriented head-to-tail version of the input wire. The input wire must be manifold.
- Parameters
- wiretopologic_core.Wire
The input wire.
- vertexAtopologic_core.Vertex
The desired start vertex of the wire.
- transferDictionariesbool , optional
If set to True, the dictionaries of the original wire are transfered to the new wire. Otherwise, they are not. Default is False.
- tolerancefloat, optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.Wire
The oriented wire.
- static ParameterAtVertex(wire, vertex, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Returns the u-parameter of a vertex located on a manifold wire. u ranges from 0.0 (start) to 1.0 (end).
- Parameters
- wiretopologic_core.Wire
The input wire.
- vertextopologic_core.Vertex
A vertex that lies somewhere on the wire.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- tolerancefloat, optional
Distance tolerance for matching the vertex to an edge. Default is 0.0001.
- silentbool , optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- float or None
The global u-parameter ∈ [0, 1] of the vertex, or None on error.
- static Planarize(wire, origin=None, mantissa: int = 6, tolerance: float = 0.0001)
Returns a planarized version of the input wire.
- Parameters
- wiretopologic_core.Wire
The input wire.
- tolerancefloat, optional
The desired tolerance. Default is 0.0001.
- origintopologic_core.Vertex , optional
The desired origin of the plane unto which the planar wire will be projected. If set to None, the centroid of the input wire will be chosen. Default is None.
- mantissaint , optional
The number of decimal places to round the result to. Default is 6.
- Returns
- topologic_core.Wire
The planarized wire.
- static Project(wire, face, direction: list = None, mantissa: int = 6, tolerance: float = 0.0001)
Creates a projection of the input wire unto the input face.
- Parameters
- wiretopologic_core.Wire
The input wire.
- facetopologic_core.Face
The face unto which to project the input wire.
- directionlist, optional
The vector representing the direction of the projection. If None, the reverse vector of the receiving face normal will be used. Default is None.
- 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 projected wire.
- 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 any collinear edges in the input wire.
- Parameters
- wiretopologic_core.Wire
The input wire.
- 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 wire without collinear edges, or the original wire if no modifications were necessary.
- 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 lengths in the list are normalized so that the shortest edge has a length of 1. Default is True.
- rotatebool , optional
If set to True, the list is rotated such that the shortest edge appears first.
- 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.
- static Reverse(wire, transferDictionaries=False, tolerance: float = 0.0001, silent: bool = False)
Creates a wire that has the reverse direction of the input wire.
- Parameters
- wiretopologic_core.Wire
The input wire.
- transferDictionariesbool , optional
If set to True the dictionaries of the input wire are transferred to the new wire. Othwerwise, they are not. Default is False.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- silentbool, optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Wire
The reversed wire.
- 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 (face or shell) wire from the input wire. A positive offset value results in an offset to the interior of an anti-clockwise wire.
- Parameters
- wiretopologic_core.Wire
The input wire.
- thicknessfloat , optional
The desired thickness of the ribbon. Default is 1.0.
- thicknessKeystr , optional
The edge dictionary key under which to find the thickness value. The thickness is the width of the ribbon. If a value cannot be found, the thickness input parameter value is used instead. Default is “thickness”.
- offsetfloat , optional
The desired offset distance. An offset is measured prependicularly from the input wire to the nearest parallel edge that belongs to the ribbon. 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.
- bisectorsbool , optional
If set to True, The bisectors (seams) edges will be included in the returned ribbon (i.e. shell). If not, the returned ribbon is a face. Default is False.
- transferDictionariesbool , optional
If set to True, the dictionaries of the original wire, its edges, and its vertices are transfered to the created ribbon. 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 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='douglas-peucker', tolerance=0.0001, silent=False)
Simplifies the input wire edges based on the selected algorithm: Douglas-Peucker or Visvalingam–Whyatt.
- Parameters
- wiretopologic_core.Wire
The input wire.
- methodstr, optional
The simplification method to use: ‘douglas-peucker’ or ‘visvalingam-whyatt’ or ‘reumann-witkam’. The default is ‘douglas-peucker’.
- tolerancefloat , optional
The desired tolerance. If using the douglas-peucker method, edge lengths shorter than this amount will be removed. If using the visvalingam-whyatt method, triangulare areas less than is amount will be removed. If using the Reumann-Witkam method, the tolerance specifies the maximum perpendicular distance allowed between any point and the current line segment; points falling within this distance are discarded. The default is 0.0001.
- silentbool , optional
If set to 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, turns: int = 10, sides: int = 36, clockwise: bool = False, reverse: bool = False, direction: list = [0, 0, 1], placement: str = 'center', tolerance: float = 0.0001)
Creates a spiral.
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the spiral. Default is None which results in the spiral being placed at (0, 0, 0).
- radiusAfloat , optional
The initial radius of the spiral. Default is 0.05.
- radiusBfloat , optional
The final radius of the spiral. Default is 0.5.
- heightfloat , optional
The height of the spiral. Default is 1.
- turnsint , optional
The number of turns of the spiral. Default is 10.
- sidesint , optional
The number of sides of one full turn in the spiral. Default is 36.
- clockwisebool , optional
If set to True, the spiral will be oriented in a clockwise fashion. Otherwise, it will be oriented in an anti-clockwise fashion. Default is False.
- reversebool , optional
If set to True, the spiral will increase in height from the center to the circumference. Otherwise, it will increase in height from the conference to the center. Default is False.
- directionlist , optional
The vector representing the up direction of the spiral. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the spiral. 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 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, tolerance: float = 0.0001)
Creates a Squircle which is a hybrid between a circle and a square. See https://en.wikipedia.org/wiki/Squircle
- Parameters
- origintopologic_core.Vertex , optional
The location of the origin of the squircle. Default is None which results in the squircle being placed at (0, 0, 0).
- radiusfloat , optional
The desired radius of the squircle. Default is 0.5.
- sidesint , optional
The desired number of sides of the squircle. Default is 121.
- afloat , optional
The “a” factor affects the x position of the points to interpolate between a circle and a square. A value of 1 will create a circle. Higher values will create a more square-like shape. Default is 2.0.
- bfloat , optional
The “b” factor affects the y position of the points to interpolate between a circle and a square. A value of 1 will create a circle. Higher values will create a more square-like shape. Default is 2.0.
- directionlist , optional
The vector representing the up direction of the circle. Default is [0, 0, 1].
- placementstr , optional
The description of the placement of the origin of the circle. This can be “center”, “lowerleft”, “upperleft”, “lowerright”, or “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.
- Returns
- topologic_core.Wire
The created 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)
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)
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=0.0001)
Creates a vertex along the input wire offset by the input distance from the input origin.
- Parameters
- wiretopologic_core.Wire
The input wire.
- distancefloat , optional
The offset distance. Default is 0.
- origintopologic_core.Vertex , optional
The origin of the offset distance. If set to None, the origin will be set to the start vertex of the input edge. Default is None.
- tolerancefloat , optional
The desired tolerance. Default is 0.0001.
- Returns
- topologic_core.Vertex
The created vertex.
- static VertexByParameter(wire, u: float = 0)
Creates a vertex along the input wire offset by the input u parameter. The wire must be manifold.
- Parameters
- wiretopologic_core.Wire
The input wire.
- ufloat , optional
The u parameter along the input topologic Wire. A parameter of 0 returns the start vertex. A parameter of 1 returns the end vertex. Default is 0.
- Returns
- topologic_core.Vertex
The vertex at the input u parameter
- static VertexDistance(wire, vertex, origin=None, mantissa: int = 6, tolerance: float = 0.0001)
Returns the distance, computed along the input wire of the input vertex from the input origin vertex.
- Parameters
- wiretopologic_core.Wire
The input wire.
- vertextopologic_core.Vertex
The input vertex
- origintopologic_core.Vertex , optional
The origin of the offset distance. If set to None, the origin will be set to the start vertex of the input wire. Default is None.
- 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
- float
The distance of the input vertex from the input origin along the input wire.
- 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.