rename function.

'job' has a meaning in Path.  sort_jobs doesn't sort jobs, it sorts hole locations.
This commit is contained in:
sliptonic
2022-01-16 12:57:49 -06:00
parent ad296ee060
commit d121e27694
4 changed files with 8 additions and 8 deletions

View File

@@ -327,21 +327,21 @@ class ObjectOp(PathOp.ObjectOp):
shapes.append(shp)
if len(shapes) > 1:
jobs = list()
locations = []
for s in shapes:
if s[2] == 'OpenEdge':
shp = Part.makeCompound(s[0])
else:
shp = s[0]
jobs.append({
locations.append({
'x': shp.BoundBox.XMax,
'y': shp.BoundBox.YMax,
'shape': s
})
jobs = PathUtils.sort_jobs(jobs, ['x', 'y'])
locations = PathUtils.sort_locations(locations, ['x', 'y'])
shapes = [j['shape'] for j in jobs]
shapes = [j['shape'] for j in locations]
sims = []
for shape, isHole, sub in shapes:

View File

@@ -160,7 +160,7 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
# http://linuxcnc.org/docs/html/gcode/g-code.html#gcode:g98-g99
self.commandlist.append(Path.Command(obj.ReturnLevel))
holes = PathUtils.sort_jobs(holes, ["x", "y"])
holes = PathUtils.sort_locations(holes, ["x", "y"])
# This section is technical debt. The computation of the
# target shapes should be factored out for re-use.

View File

@@ -29,7 +29,7 @@ import PathScripts.PathOp as PathOp
from PathScripts.PathUtils import fmt
from PathScripts.PathUtils import findParentJob
from PathScripts.PathUtils import sort_jobs
from PathScripts.PathUtils import sort_locations
from PySide import QtCore
__title__ = "Path Helix Drill Operation"
@@ -79,7 +79,7 @@ class ObjectHelix(PathCircularHoleBase.ObjectOp):
output = ''
output += "G0 Z" + fmt(zsafe)
holes = sort_jobs(holes, ['x', 'y'])
holes = sort_locations(holes, ['x', 'y'])
for hole in holes:
output += self.helix_cut(obj, hole['x'], hole['y'], hole['r'] / 2, float(obj.StartRadius.Value), (float(obj.StepOver.Value) / 50.0) * self.radius)
PathLog.debug(output)

View File

@@ -639,7 +639,7 @@ def rampPlunge(edge, rampangle, destZ, startZ):
return rampCmds
def sort_jobs(locations, keys, attractors=None):
def sort_locations(locations, keys, 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