Classes | |
class | Side |
Functions | |
def | arcToHelix (edge, z0, z1) |
def | cmdsForEdge (edge, flip=False, useHelixForBSpline=True, segm=50, hSpeed=0, vSpeed=0) |
def | combineConnectedShapes (shapes) |
def | combineHorizontalFaces (faces) |
def | commandEndPoint (cmd, defaultPoint=Vector(), X="X", Y="Y", Z="Z") |
def | diffAngle (a1, a2, direction="CW") |
def | edgeConnectsTo (edge, vector, error=Tolerance) |
def | edgeForCmd (cmd, startPoint) |
def | edgesMatch (e0, e1, error=Tolerance) |
def | flipEdge (edge) |
def | flipWire (wire) |
def | getAngle (vector) |
def | helixToArc (edge, z=0) |
def | isHorizontal (obj) |
def | isRoughly (float1, float2, error=Tolerance) |
def | isVertical (obj) |
def | makeBoundBoxFace (bBox, offset=0.0, zHeight=0.0) |
def | pointsCoincide (p1, p2, error=Tolerance) |
def | removeDuplicateEdges (wire) |
def | speedBetweenPoints (p0, p1, hSpeed, vSpeed) |
def | splitArcAt (edge, pt) |
def | splitEdgeAt (edge, pt) |
def | wireForPath (path, startPoint=Vector(0, 0, 0)) |
def | wiresForPath (path, startPoint=Vector(0, 0, 0)) |
def | xy (point) |
Variables | |
list | CmdMove = CmdMoveStraight + CmdMoveArc + CmdMoveDrill |
list | CmdMoveAll = CmdMove + CmdMoveRapid |
list | CmdMoveArc = CmdMoveCW + CmdMoveCCW |
list | CmdMoveCCW = ["G3", "G03"] |
list | CmdMoveCW = ["G2", "G02"] |
list | CmdMoveDrill = ["G81", "G82", "G83"] |
list | CmdMoveRapid = ["G0", "G00"] |
list | CmdMoveStraight = ["G1", "G01"] |
Part = LazyLoader("Part", globals(), "Part") | |
float | Tolerance = 0.000001 |
translate = FreeCAD.Qt.translate | |
def PathScripts.PathGeom.arcToHelix | ( | edge, | |
z0, | |||
z1 | |||
) |
arcToHelix(edge, z0, z1) Assuming edge is an arc it'll return a helix matching the arc starting at z0 and rising/falling to z1.
References PathScripts.PathGeom.cmdsForEdge(), and PathScripts.PathGeom.edgeForCmd().
Referenced by PathScripts.PathGeom.splitEdgeAt().
def PathScripts.PathGeom.cmdsForEdge | ( | edge, | |
flip = False , |
|||
useHelixForBSpline = True , |
|||
segm = 50 , |
|||
hSpeed = 0 , |
|||
vSpeed = 0 |
|||
) |
cmdsForEdge(edge, flip=False, useHelixForBSpline=True, segm=50) -> List(Path.Command) Returns a list of Path.Command representing the given edge. If flip is True the edge is considered to be backwards. If useHelixForBSpline is True an Edge based on a BSplineCurve is considered to represent a helix and results in G2 or G3 command. Otherwise edge has no direct Path.Command mapping and will be approximated by straight segments. segm is a factor for the segmentation of arbitrary curves not mapped to G1/2/3 commands. The higher the value the more segments will be used.
References PathScripts.PathGeom.isRoughly(), PathScripts.PathGeom.pointsCoincide(), PathScripts.PathGeom.speedBetweenPoints(), and PathScripts.PathGeom.xy().
Referenced by PathScripts.PathGeom.arcToHelix().
def PathScripts.PathGeom.combineConnectedShapes | ( | shapes | ) |
References PathScripts.PathGeom.isRoughly().
def PathScripts.PathGeom.combineHorizontalFaces | ( | faces | ) |
combineHorizontalFaces(faces)... This function successfully identifies and combines multiple connected faces and works on multiple independent faces with multiple connected faces within the list. The return value is a list of simplified faces. The Adaptive op is not concerned with which hole edges belong to which face. Attempts to do the same shape connecting failed with TechDraw.findShapeOutline() and PathGeom.combineConnectedShapes(), so this algorithm was created.
References PathScripts.PathGeom.isRoughly(), and PathScripts.PathGeom.makeBoundBoxFace().
def PathScripts.PathGeom.commandEndPoint | ( | cmd, | |
defaultPoint = Vector() , |
|||
X = "X" , |
|||
Y = "Y" , |
|||
Z = "Z" |
|||
) |
commandEndPoint(cmd, [defaultPoint=Vector()], [X='X'], [Y='Y'], [Z='Z']) Extracts the end point from a Path Command.
Referenced by PathScripts.PathGeom.edgeForCmd(), PathScripts.PathGeom.wireForPath(), and PathScripts.PathGeom.wiresForPath().
def PathScripts.PathGeom.diffAngle | ( | a1, | |
a2, | |||
direction = "CW" |
|||
) |
diffAngle(a1, a2, [direction='CW']) Returns the difference between two angles (a1 -> a2) into a given direction.
Referenced by PathScripts.PathGeom.edgeForCmd().
def PathScripts.PathGeom.edgeConnectsTo | ( | edge, | |
vector, | |||
error = Tolerance |
|||
) |
edgeConnectsTop(edge, vector, error=Tolerance) Returns True if edge connects to given vector.
References PathScripts.PathGeom.pointsCoincide().
def PathScripts.PathGeom.edgeForCmd | ( | cmd, | |
startPoint | |||
) |
edgeForCmd(cmd, startPoint). Returns an Edge representing the given command, assuming a given startPoint.
References PathScripts.PathGeom.commandEndPoint(), PathScripts.PathGeom.diffAngle(), PathScripts.PathGeom.getAngle(), PathScripts.PathGeom.isRoughly(), PathScripts.PathGeom.pointsCoincide(), and PathScripts.PathGeom.xy().
Referenced by PathScripts.PathGeom.arcToHelix(), PathScripts.PathGeom.wireForPath(), and PathScripts.PathGeom.wiresForPath().
def PathScripts.PathGeom.edgesMatch | ( | e0, | |
e1, | |||
error = Tolerance |
|||
) |
edgesMatch(e0, e1, [error=Tolerance] Return true if the edges start and end at the same point and have the same type of curve.
References PathScripts.PathGeom.pointsCoincide().
Referenced by PathScripts.PathGeom.removeDuplicateEdges().
def PathScripts.PathGeom.flipEdge | ( | edge | ) |
flipEdge(edge) Flips given edge around so the new Vertexes[0] was the old Vertexes[-1] and vice versa, without changing the shape. Currently only lines, line segments, circles and arcs are supported.
Referenced by PathScripts.PathGeom.flipWire().
def PathScripts.PathGeom.flipWire | ( | wire | ) |
Flip the entire wire and all its edges so it is being processed the other way around.
References PathScripts.PathGeom.flipEdge().
def PathScripts.PathGeom.getAngle | ( | vector | ) |
getAngle(vector) Returns the angle [-pi,pi] of a vector using the X-axis as the reference. Positive angles for vertexes in the upper hemisphere (positive y values) and negative angles for the lower hemisphere.
Referenced by PathScripts.PathGeom.edgeForCmd().
def PathScripts.PathGeom.helixToArc | ( | edge, | |
z = 0 |
|||
) |
helixToArc(edge, z=0) Returns the projection of the helix onto the XY-plane with a given offset.
Referenced by PathScripts.PathGeom.splitEdgeAt().
def PathScripts.PathGeom.isHorizontal | ( | obj | ) |
isHorizontal(obj) ... answer True if obj points into X or Y
References PathScripts.PathGeom.isHorizontal(), PathScripts.PathGeom.isRoughly(), and PathScripts.PathGeom.isVertical().
Referenced by PathScripts.PathGeom.isHorizontal(), and PathScripts.PathGeom.isVertical().
def PathScripts.PathGeom.isRoughly | ( | float1, | |
float2, | |||
error = Tolerance |
|||
) |
isRoughly(float1, float2, [error=Tolerance]) Returns true if the two values are the same within a given error.
Referenced by PathScripts.PathGeom.cmdsForEdge(), PathScripts.PathGeom.combineConnectedShapes(), PathScripts.PathGeom.combineHorizontalFaces(), PathScripts.PathGeom.edgeForCmd(), PathScripts.PathGeom.isHorizontal(), PathScripts.PathGeom.isVertical(), PathScripts.PathGeom.pointsCoincide(), and PathScripts.PathGeom.speedBetweenPoints().
def PathScripts.PathGeom.isVertical | ( | obj | ) |
isVertical(obj) ... answer True if obj points into Z
References PathScripts.PathGeom.isHorizontal(), PathScripts.PathGeom.isRoughly(), and PathScripts.PathGeom.isVertical().
Referenced by PathScripts.PathGeom.isHorizontal(), and PathScripts.PathGeom.isVertical().
def PathScripts.PathGeom.makeBoundBoxFace | ( | bBox, | |
offset = 0.0 , |
|||
zHeight = 0.0 |
|||
) |
makeBoundBoxFace(bBox, offset=0.0, zHeight=0.0)... Function to create boundbox face, with possible extra offset and custom Z-height.
Referenced by PathScripts.PathGeom.combineHorizontalFaces().
def PathScripts.PathGeom.pointsCoincide | ( | p1, | |
p2, | |||
error = Tolerance |
|||
) |
pointsCoincide(p1, p2, [error=Tolerance]) Return True if two points are roughly identical (see also isRoughly).
References PathScripts.PathGeom.isRoughly().
Referenced by PathScripts.PathGeom.cmdsForEdge(), PathScripts.PathGeom.edgeConnectsTo(), PathScripts.PathGeom.edgeForCmd(), and PathScripts.PathGeom.edgesMatch().
def PathScripts.PathGeom.removeDuplicateEdges | ( | wire | ) |
References PathScripts.PathGeom.edgesMatch().
def PathScripts.PathGeom.speedBetweenPoints | ( | p0, | |
p1, | |||
hSpeed, | |||
vSpeed | |||
) |
References PathScripts.PathGeom.isRoughly(), and PathScripts.PathGeom.xy().
Referenced by PathScripts.PathGeom.cmdsForEdge().
def PathScripts.PathGeom.splitArcAt | ( | edge, | |
pt | |||
) |
splitArcAt(edge, pt) Returns a list of 2 edges which together form the original arc split at the given point. The Vector pt has to represent a point on the given arc.
Referenced by PathScripts.PathGeom.splitEdgeAt().
def PathScripts.PathGeom.splitEdgeAt | ( | edge, | |
pt | |||
) |
splitEdgeAt(edge, pt) Returns a list of 2 edges, forming the original edge split at the given point. The results are undefined if the Vector representing the point is not part of the edge.
References PathScripts.PathGeom.arcToHelix(), PathScripts.PathGeom.helixToArc(), and PathScripts.PathGeom.splitArcAt().
def PathScripts.PathGeom.wireForPath | ( | path, | |
startPoint = Vector(0, 0, 0) |
|||
) |
wireForPath(path, [startPoint=Vector(0,0,0)]) Returns a wire representing all move commands found in the given path.
References PathScripts.PathGeom.commandEndPoint(), and PathScripts.PathGeom.edgeForCmd().
def PathScripts.PathGeom.wiresForPath | ( | path, | |
startPoint = Vector(0, 0, 0) |
|||
) |
wiresForPath(path, [startPoint=Vector(0,0,0)]) Returns a collection of wires, each representing a continuous cutting Path in path.
References PathScripts.PathGeom.commandEndPoint(), and PathScripts.PathGeom.edgeForCmd().
def PathScripts.PathGeom.xy | ( | point | ) |
xy(point) Convenience function to return the projection of the Vector in the XY-plane.
Referenced by PathScripts.PathGeom.cmdsForEdge(), PathScripts.PathGeom.edgeForCmd(), and PathScripts.PathGeom.speedBetweenPoints().
list PathScripts.PathGeom.CmdMove = CmdMoveStraight + CmdMoveArc + CmdMoveDrill |
list PathScripts.PathGeom.CmdMoveAll = CmdMove + CmdMoveRapid |
list PathScripts.PathGeom.CmdMoveArc = CmdMoveCW + CmdMoveCCW |
list PathScripts.PathGeom.CmdMoveCCW = ["G3", "G03"] |
list PathScripts.PathGeom.CmdMoveCW = ["G2", "G02"] |
list PathScripts.PathGeom.CmdMoveDrill = ["G81", "G82", "G83"] |
list PathScripts.PathGeom.CmdMoveRapid = ["G0", "G00"] |
list PathScripts.PathGeom.CmdMoveStraight = ["G1", "G01"] |
PathScripts.PathGeom.Part = LazyLoader("Part", globals(), "Part") |
float PathScripts.PathGeom.Tolerance = 0.000001 |
PathScripts.PathGeom.translate = FreeCAD.Qt.translate |