Commit 6d63da17 authored by sumpfralle's avatar sumpfralle

fixed climb/conventional milling style for ContourFollow and Engraving


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@838 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 443453a6
......@@ -59,6 +59,9 @@ class Path:
s += "%d(%g,%g,%g)" % (p.id, p.x, p.y, p.z)
return s
def insert(self, index, p):
self.points.insert(index, get_point_object(p))
def append(self, p):
self.points.append(get_point_object(p))
......
......@@ -50,7 +50,8 @@ class EngraveCutter:
self.pa_push = path_processor
# We use a separated path processor for the last "drop" layer.
# This path processor does not need to be configurable.
self.pa_drop = pycam.PathProcessors.PathAccumulator.PathAccumulator()
self.pa_drop = pycam.PathProcessors.PathAccumulator.PathAccumulator(
reverse=self.pa_push.reverse)
self.physics = physics
def GenerateToolPath(self, minz, maxz, horiz_step, dz, draw_callback=None):
......
......@@ -77,5 +77,6 @@ class ContourCutter(pycam.PathProcessors.BasePathProcessor):
if self.reverse:
paths.reverse()
self.paths.extend(paths)
self.sort_layered()
self.pe = None
......@@ -37,6 +37,9 @@ class PathAccumulator(pycam.PathProcessors.BasePathProcessor):
def append(self, p):
if self.curr_path == None:
self.curr_path = Path()
if self.reverse:
self.curr_path.insert(0, p)
else:
self.curr_path.append(p)
def new_direction(self, direction):
......@@ -52,9 +55,10 @@ class PathAccumulator(pycam.PathProcessors.BasePathProcessor):
if self.curr_path:
if self.zigzag and (self.scanline % 2 == 0):
self.curr_path.reverse()
if self.reverse:
self.curr_path.reverse()
simplify_toolpath(self.curr_path)
if self.reverse:
self.paths.insert(0, self.curr_path)
else:
self.paths.append(self.curr_path)
self.curr_path = None
......@@ -75,4 +75,5 @@ class PolygonCutter(pycam.PathProcessors.BasePathProcessor):
if self.reverse:
p.reverse()
self.paths.extend(paths)
self.sort_layered()
......@@ -57,3 +57,6 @@ class SimpleCutter(pycam.PathProcessors.BasePathProcessor):
print "ERROR: curr_path expected to be empty"
self.curr_path = None
def finish(self):
self.sort_layered()
......@@ -35,3 +35,21 @@ class BasePathProcessor(object):
def finish(self):
pass
def sort_layered(self, upper_first=True):
if upper_first:
compare_height = lambda path1, path2: path1.points[0].z < path2.points[0].z
else:
compare_height = lambda path1, path2: path1.points[0].z > path2.points[0].z
finished = False
while not finished:
index = 0
finished = True
while index < len(self.paths) - 1:
current_path = self.paths[index]
next_path = self.paths[index + 1]
if compare_height(current_path, next_path):
del self.paths[index]
self.paths.insert(index + 1, current_path)
finished = False
index += 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment