PathScripts.PathUtils Namespace Reference


class  depth_params


def addToJob (obj, jobname=None)
def arc (cx, cy, sx, sy, ex, ey, horizFeed=0, ez=None, ccw=False)
def drillTipLength (tool)
def feed (x=None, y=None, z=None, horizFeed=0, vertFeed=0)
def filterArcs (arcEdge)
def findParentJob (obj)
def findToolController (obj, proxy, name=None)
def fmt (val)
def getEnvelope (partshape, subshape=None, depthparams=None)
def GetJobs (jobname=None)
def getOffsetArea (fcShape, offset, removeHoles=False, plane=Part.makeCircle(10), tolerance=1e-4)
def getToolControllers (obj, proxy=None)
def guessDepths (objshape, subs=None)
def helicalPlunge (plungePos, rampangle, destZ, startZ, toold, plungeR, horizFeed)
def horizontalEdgeLoop (obj, edge)
def horizontalFaceLoop (obj, face, faceList=None)
def isDrillable (obj, candidate, tooldiameter=None, includePartials=False)
def loopdetect (obj, edge1, edge2)
def makeWorkplane (shape)
def rampPlunge (edge, rampangle, destZ, startZ)
def rapid (x=None, y=None, z=None)
def reverseEdge (e)
def RtoIJ (startpoint, command)
def segments (poly)
def simplify3dLine (line, tolerance=1e-4)
def sort_jobs (locations, keys, attractors=None)
def translate (context, text, disambig=None)
def waiting_effects (function)


 DraftGeomUtils = LazyLoader('DraftGeomUtils', globals(), 'DraftGeomUtils')
 Part = LazyLoader('Part', globals(), 'Part')
 TechDraw = LazyLoader('TechDraw', globals(), 'TechDraw')
 UserInput = None

Function Documentation

◆ addToJob()

def PathScripts.PathUtils.addToJob (   obj,
  jobname = None 
adds a path object to a job
obj = obj
jobname = None

References PathScripts.PathUtils.GetJobs().

◆ arc()

def PathScripts.PathUtils.arc (   cx,
  horizFeed = 0,
  ez = None,
  ccw = False 
Return gcode string to perform an arc.

Assumes XY plane or helix around Z
Don't worry about starting Z- assume that's dealt with elsewhere
If start/end radii aren't within eps, abort.

cx, cy -- arc center coordinates
sx, sy -- arc start coordinates
ex, ey -- arc end coordinates
ez -- ending Z coordinate.  None unless helix.
horizFeed -- horiz feed speed
ccw -- arc direction

Referenced by PathScripts.PathUtils.helicalPlunge().

◆ drillTipLength()

def PathScripts.PathUtils.drillTipLength (   tool)
returns the length of the drillbit tip.

◆ feed()

def PathScripts.PathUtils.feed (   x = None,
  y = None,
  z = None,
  horizFeed = 0,
  vertFeed = 0 
 Return gcode string to perform a linear feed.

Referenced by PathScripts.PathUtils.rampPlunge().

◆ filterArcs()

def PathScripts.PathUtils.filterArcs (   arcEdge)
filterArcs(Edge) -used to split arcs that over 180 degrees. Returns list 

◆ findParentJob()

def PathScripts.PathUtils.findParentJob (   obj)
retrieves a parent job object for an operation or other Path object

Referenced by PathScripts.PathUtils.getToolControllers().

◆ findToolController()

def PathScripts.PathUtils.findToolController (   obj,
  name = None 
returns a tool controller with a given name.
If no name is specified, returns the first controller.
if no controller is found, returns None

References PathScripts.PathUtils.getToolControllers().

◆ fmt()

def PathScripts.PathUtils.fmt (   val)

◆ getEnvelope()

def PathScripts.PathUtils.getEnvelope (   partshape,
  subshape = None,
  depthparams = None 
getEnvelope(partshape, stockheight=None)
returns a shape corresponding to the partshape silhouette extruded to height.
if stockheight is given, the returned shape is extruded to that height otherwise the returned shape
is the height of the original shape boundbox
partshape = solid object
stockheight = float - Absolute Z height of the top of material before cutting.

References PathScripts.PathUtils.makeWorkplane().

◆ GetJobs()

def PathScripts.PathUtils.GetJobs (   jobname = None)
returns all jobs in the current document.  If name is given, returns that job

Referenced by PathScripts.PathUtils.addToJob().

◆ getOffsetArea()

def PathScripts.PathUtils.getOffsetArea (   fcShape,
  removeHoles = False,
  plane = Part.makeCircle(10),
  tolerance = 1e-4 
Make an offset area of a shape, projected onto a plane.
Positive offsets expand the area, negative offsets shrink it.
Inspired by _buildPathArea() from module. Adjustments made
based on notes by @sliptonic at this webpage:

References PathScripts.PathUtils.makeWorkplane().

◆ getToolControllers()

def PathScripts.PathUtils.getToolControllers (   obj,
  proxy = None 
returns all the tool controllers

References PathScripts.PathUtils.findParentJob().

Referenced by PathScripts.PathUtils.findToolController().

◆ guessDepths()

def PathScripts.PathUtils.guessDepths (   objshape,
  subs = None 
takes an object shape and optional list of subobjects and returns a depth_params
object with suggested height/depth values.

objshape = Part::Shape.
subs = list of subobjects from objshape

◆ helicalPlunge()

def PathScripts.PathUtils.helicalPlunge (   plungePos,
Return gcode string to perform helical entry move.

plungePos -- vector of the helical entry location
destZ -- the lowest Z position or milling level
startZ -- Starting Z position for helical move
rampangle -- entry angle
toold -- tool diameter
plungeR -- the radius of the entry helix

References PathScripts.PathUtils.arc(), and PathScripts.PathUtils.rapid().

◆ horizontalEdgeLoop()

def PathScripts.PathUtils.horizontalEdgeLoop (   obj,
horizontalEdgeLoop(obj, edge) ... returns a wire in the horizontal plane, if that is the only horizontal wire the given edge is a part of.

Referenced by PathScripts.PathUtils.horizontalFaceLoop().

◆ horizontalFaceLoop()

def PathScripts.PathUtils.horizontalFaceLoop (   obj,
  faceList = None 
horizontalFaceLoop(obj, face, faceList=None) ... returns a list of face names which form the walls of a vertical hole face is a part of.
All face names listed in faceList must be part of the hole for the solution to be returned.

References PathScripts.PathUtils.horizontalEdgeLoop().

◆ isDrillable()

def PathScripts.PathUtils.isDrillable (   obj,
  tooldiameter = None,
  includePartials = False 
Checks candidates to see if they can be drilled.
Candidates can be either faces - circular or cylindrical or circular edges.
The tooldiameter can be optionally passed.  if passed, the check will return
False for any holes smaller than the tooldiameter.
candidate = Face or Edge

◆ loopdetect()

def PathScripts.PathUtils.loopdetect (   obj,
Returns a loop wire that includes the two edges.
Useful for detecting boundaries of negative space features ie 'holes'
If a unique loop is not found, returns None
edge1 = edge
edge2 = edge

◆ makeWorkplane()

def PathScripts.PathUtils.makeWorkplane (   shape)
Creates a workplane circle at the ZMin level.

Referenced by PathScripts.PathUtils.getEnvelope(), and PathScripts.PathUtils.getOffsetArea().

◆ rampPlunge()

def PathScripts.PathUtils.rampPlunge (   edge,
Return gcode string to linearly ramp down to milling level.

edge -- edge to follow
rampangle -- entry angle
destZ -- Final Z depth
startZ -- Starting Z depth

FIXME: This ramps along the first edge, assuming it's long
enough, NOT just wiggling back and forth by ~0.75 * toolD.
Not sure if that's any worse, but it's simpler
I think this should be changed to be limited to a maximum ramp size.  Otherwise machine time will get longer than it needs to be.

References PathScripts.PathUtils.feed(), and PathScripts.PathUtils.rapid().

◆ rapid()

def PathScripts.PathUtils.rapid (   x = None,
  y = None,
  z = None 
 Returns gcode string to perform a rapid move.

Referenced by PathScripts.PathUtils.helicalPlunge(), and PathScripts.PathUtils.rampPlunge().

◆ reverseEdge()

def PathScripts.PathUtils.reverseEdge (   e)

◆ RtoIJ()

def PathScripts.PathUtils.RtoIJ (   startpoint,
This function takes a startpoint and an arc command in radius mode and
returns an arc command in IJ mode. Useful for preprocessor scripts

◆ segments()

def PathScripts.PathUtils.segments (   poly)
 A sequence of (x,y) numeric coordinates pairs 

◆ simplify3dLine()

def PathScripts.PathUtils.simplify3dLine (   line,
  tolerance = 1e-4 
Simplify a line defined by a list of App.Vectors, while keeping the
maximum deviation from the original line within the defined tolerance.
Implementation of

◆ sort_jobs()

def PathScripts.PathUtils.sort_jobs (   locations,
  attractors = None 
 sort holes by the nearest neighbor method
    keys: two-element list of keys for X and Y coordinates. for example ['x','y']
    originally written by m0n5t3r for PathHelix

References DraftVecUtils.dist().

◆ translate()

def PathScripts.PathUtils.translate (   context,
  disambig = None 

◆ waiting_effects()

def PathScripts.PathUtils.waiting_effects (   function)

Variable Documentation

◆ DraftGeomUtils

PathScripts.PathUtils.DraftGeomUtils = LazyLoader('DraftGeomUtils', globals(), 'DraftGeomUtils')

◆ Part

PathScripts.PathUtils.Part = LazyLoader('Part', globals(), 'Part')

◆ TechDraw

PathScripts.PathUtils.TechDraw = LazyLoader('TechDraw', globals(), 'TechDraw')

◆ UserInput

PathScripts.PathUtils.UserInput = None