Commit 9cf25fa2 authored by sumpfralle's avatar sumpfralle

changed behaviour of PolygonCutter and ContourCutter:

 * "finish" now appends new toolpath segments to previous ones (before: previous ones were thrown away)
 * now all PathProcessors keep previous toolpaths after calling "finish"


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@467 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent ccaad2f1
...@@ -59,7 +59,6 @@ class EngraveCutter: ...@@ -59,7 +59,6 @@ class EngraveCutter:
z_steps = [minz] z_steps = [minz]
num_of_layers = len(z_steps) num_of_layers = len(z_steps)
paths = []
current_layer = 0 current_layer = 0
num_of_lines = len(self.contour_model.get_lines()) num_of_lines = len(self.contour_model.get_lines())
progress_counter = ProgressCounter(len(z_steps) * num_of_lines, progress_counter = ProgressCounter(len(z_steps) * num_of_lines,
...@@ -81,21 +80,20 @@ class EngraveCutter: ...@@ -81,21 +80,20 @@ class EngraveCutter:
if progress_counter.increment(): if progress_counter.increment():
# cancel requested # cancel requested
quit_requested = True quit_requested = True
# finish the current path
self.pa_push.finish()
break break
self.pa_push.finish() self.pa_push.finish()
# the path accumulator will be reset for each slice - we need to store the result
if self.pa_push.paths:
paths += self.pa_push.paths
# break the outer loop if requested # break the outer loop if requested
if quit_requested: if quit_requested:
break break
current_layer += 1 current_layer += 1
if quit_requested: if quit_requested:
return paths return self.pa_push.paths
if draw_callback: if draw_callback:
draw_callback(text="Engrave: processing layer %d/%d" \ draw_callback(text="Engrave: processing layer %d/%d" \
...@@ -118,11 +116,8 @@ class EngraveCutter: ...@@ -118,11 +116,8 @@ class EngraveCutter:
if quit_requested: if quit_requested:
break break
self.pa_drop.finish() self.pa_drop.finish()
# the path accumulator will be reset for each slice - we need to store the result
if self.pa_drop.paths:
paths += self.pa_drop.paths
return paths return self.pa_push.paths + self.pa_drop.paths
def GenerateToolPathLinePush(self, pa, line, z, draw_callback=None): def GenerateToolPathLinePush(self, pa, line, z, draw_callback=None):
p1 = Point(line.p1.x, line.p1.y, z) p1 = Point(line.p1.x, line.p1.y, z)
......
...@@ -53,8 +53,6 @@ class PushCutter: ...@@ -53,8 +53,6 @@ class PushCutter:
progress_counter = ProgressCounter(num_of_layers * lines_per_layer, progress_counter = ProgressCounter(num_of_layers * lines_per_layer,
draw_callback) draw_callback)
paths = []
current_layer = 0 current_layer = 0
z_steps = [(maxz - i * z_step) for i in range(num_of_layers)] z_steps = [(maxz - i * z_step) for i in range(num_of_layers)]
...@@ -77,13 +75,9 @@ class PushCutter: ...@@ -77,13 +75,9 @@ class PushCutter:
self.pa.end_direction() self.pa.end_direction()
self.pa.finish() self.pa.finish()
# the path accumulator will be reset for each slice - we need to store the result
if self.pa.paths:
paths += self.pa.paths
current_layer += 1 current_layer += 1
return paths return self.pa.paths
def GenerateToolPathSlice(self, minx, maxx, miny, maxy, z, dx, dy, def GenerateToolPathSlice(self, minx, maxx, miny, maxy, z, dx, dy,
draw_callback=None, progress_counter=None): draw_callback=None, progress_counter=None):
......
...@@ -55,16 +55,14 @@ class ContourCutter: ...@@ -55,16 +55,14 @@ class ContourCutter:
def finish(self): def finish(self):
self.pe.finish() self.pe.finish()
if self.pe.merge_path_list: if self.pe.merge_path_list:
self.paths = self.pe.merge_path_list paths = self.pe.merge_path_list
for p in self.paths: elif self.pe.hor_path_list:
p.append(p.points[0]) paths = self.pe.hor_path_list
else: else:
if self.pe.hor_path_list: paths = self.pe.ver_path_list
self.paths = self.pe.hor_path_list if paths:
else: for p in paths:
self.paths = self.pe.ver_path_list p.append(p.points[0])
if self.paths: self.paths.extend(paths)
for p in self.paths:
p.append(p.points[0])
self.pe = None self.pe = None
...@@ -65,5 +65,5 @@ class PolygonCutter: ...@@ -65,5 +65,5 @@ class PolygonCutter:
p.append(points[-i-1]) p.append(points[-i-1])
p.append(points[i]) p.append(points[i])
paths.append(p) paths.append(p)
self.paths = paths self.paths.extend(paths)
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