PathScripts.PathGeom Namespace Reference

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 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 pointsCoincide (p1, p2, error=Tolerance)
 
def removeDuplicateEdges (wire)
 
def speedBetweenPoints (p0, p1, hSpeed, vSpeed)
 
def splitArcAt (edge, pt)
 
def splitEdgeAt (edge, pt)
 
def translate (context, text, disambig=None)
 
def wireForPath (path, startPoint=Vector(0, 0, 0))
 
def wiresForPath (path, startPoint=Vector(0, 0, 0))
 
def xy (point)
 

Variables

 CmdMove
 
 CmdMoveAll
 
 CmdMoveArc
 
 CmdMoveCCW
 
 CmdMoveCW
 
 CmdMoveRapid
 
 CmdMoveStraight
 
 OddsAndEnds
 
 Part
 
 Tolerance
 

Function Documentation

◆ arcToHelix()

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

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

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

◆ edgeConnectsTo()

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

◆ edgeForCmd()

def PathScripts.PathGeom.edgeForCmd (   cmd,
  startPoint 
)

◆ edgesMatch()

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

◆ flipEdge()

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

◆ 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)
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)
isHorizontal(obj) ... answer True if obj points into X or Y

References PathScripts.PathGeom.isRoughly(), and PathScripts.PathGeom.isVertical().

Referenced by PathScripts.PathGeom.isVertical().

◆ isRoughly()

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

◆ isVertical()

def PathScripts.PathGeom.isVertical (   obj)
isVertical(obj) ... answer True if obj points into Z

References PathScripts.PathGeom.isHorizontal(), and PathScripts.PathGeom.isRoughly().

Referenced by PathScripts.PathGeom.isHorizontal().

◆ pointsCoincide()

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

◆ removeDuplicateEdges()

def PathScripts.PathGeom.removeDuplicateEdges (   wire)

◆ speedBetweenPoints()

def PathScripts.PathGeom.speedBetweenPoints (   p0,
  p1,
  hSpeed,
  vSpeed 
)

◆ splitArcAt()

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

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

◆ translate()

def PathScripts.PathGeom.translate (   context,
  text,
  disambig = None 
)

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

PathScripts.PathGeom.CmdMove

◆ CmdMoveAll

PathScripts.PathGeom.CmdMoveAll

◆ CmdMoveArc

PathScripts.PathGeom.CmdMoveArc

◆ CmdMoveCCW

PathScripts.PathGeom.CmdMoveCCW

◆ CmdMoveCW

PathScripts.PathGeom.CmdMoveCW

◆ CmdMoveRapid

PathScripts.PathGeom.CmdMoveRapid

◆ CmdMoveStraight

PathScripts.PathGeom.CmdMoveStraight

◆ OddsAndEnds

PathScripts.PathGeom.OddsAndEnds

◆ Part

PathScripts.PathGeom.Part

◆ Tolerance

PathScripts.PathGeom.Tolerance