PathScripts.PathGeom Namespace Reference


class  Side


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)


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

Function Documentation

◆ arcToHelix()

def PathScripts.PathGeom.arcToHelix (   edge,
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().

◆ cmdsForEdge()

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().

◆ combineConnectedShapes()

def PathScripts.PathGeom.combineConnectedShapes (   shapes)

◆ combineHorizontalFaces()

def PathScripts.PathGeom.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().

◆ commandEndPoint()

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().

◆ diffAngle()

def PathScripts.PathGeom.diffAngle (   a1,
  direction = "CW" 
diffAngle(a1, a2, [direction='CW'])
Returns the difference between two angles (a1 -> a2) into a given direction.

Referenced by PathScripts.PathGeom.edgeForCmd().

◆ edgeConnectsTo()

def PathScripts.PathGeom.edgeConnectsTo (   edge,
  error = Tolerance 
edgeConnectsTop(edge, vector, error=Tolerance)
Returns True if edge connects to given vector.

References PathScripts.PathGeom.pointsCoincide().

◆ edgeForCmd()

def PathScripts.PathGeom.edgeForCmd (   cmd,

◆ edgesMatch()

def PathScripts.PathGeom.edgesMatch (   e0,
  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().

◆ flipEdge()

def PathScripts.PathGeom.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().

◆ 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().

◆ getAngle()

def PathScripts.PathGeom.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().

◆ helixToArc()

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().

◆ isHorizontal()

def PathScripts.PathGeom.isHorizontal (   obj)

◆ isRoughly()

def PathScripts.PathGeom.isRoughly (   float1,
  error = Tolerance 

◆ isVertical()

def PathScripts.PathGeom.isVertical (   obj)

◆ makeBoundBoxFace()

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().

◆ pointsCoincide()

def PathScripts.PathGeom.pointsCoincide (   p1,
  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().

◆ removeDuplicateEdges()

def PathScripts.PathGeom.removeDuplicateEdges (   wire)

◆ speedBetweenPoints()

def PathScripts.PathGeom.speedBetweenPoints (   p0,

◆ splitArcAt()

def PathScripts.PathGeom.splitArcAt (   edge,
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().

◆ splitEdgeAt()

def PathScripts.PathGeom.splitEdgeAt (   edge,
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().

◆ wireForPath()

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().

◆ wiresForPath()

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().

◆ xy()

def PathScripts.PathGeom.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().

Variable Documentation

◆ CmdMove

list PathScripts.PathGeom.CmdMove = CmdMoveStraight + CmdMoveArc + CmdMoveDrill

◆ CmdMoveAll

list PathScripts.PathGeom.CmdMoveAll = CmdMove + CmdMoveRapid

◆ CmdMoveArc

list PathScripts.PathGeom.CmdMoveArc = CmdMoveCW + CmdMoveCCW

◆ CmdMoveCCW

list PathScripts.PathGeom.CmdMoveCCW = ["G3", "G03"]

◆ CmdMoveCW

list PathScripts.PathGeom.CmdMoveCW = ["G2", "G02"]

◆ CmdMoveDrill

list PathScripts.PathGeom.CmdMoveDrill = ["G81", "G82", "G83"]

◆ CmdMoveRapid

list PathScripts.PathGeom.CmdMoveRapid = ["G0", "G00"]

◆ CmdMoveStraight

list PathScripts.PathGeom.CmdMoveStraight = ["G1", "G01"]

◆ Part

PathScripts.PathGeom.Part = LazyLoader("Part", globals(), "Part")

◆ Tolerance

float PathScripts.PathGeom.Tolerance = 0.000001

◆ translate

PathScripts.PathGeom.translate = FreeCAD.Qt.translate