Commit 28553eb3 authored by sumpfralle's avatar sumpfralle

re-sort the polygons only in the last layer (to avoid breaking-away pieces)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@606 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 0b88b5f2
...@@ -67,25 +67,6 @@ class EngraveCutter: ...@@ -67,25 +67,6 @@ class EngraveCutter:
draw_callback) draw_callback)
line_groups = self.contour_model.get_polygons() line_groups = self.contour_model.get_polygons()
# Sort the polygons according to their directions (first inside, then
# outside. Smaller polygons are processed first.
# This reduces the problem of break-away pieces.
def polygon_priority(poly1, poly2):
""" polygon priority comparison: first holes, then outlines
(sorted by ascending area size)
TODO: ordering according to the locations and groups of polygons
would be even better.
"""
area1 = poly1.get_area()
area2 = poly2.get_area()
if (area1 < 0) and (area2 > 0):
return -1
elif (area2 < 0) and (area1 > 0):
return 1
else:
return cmp(abs(area1), abs(area2))
line_groups.sort(cmp=polygon_priority)
# push slices for all layers above ground # push slices for all layers above ground
for z in z_steps[:-1]: for z in z_steps[:-1]:
# update the progress bar and check, if we should cancel the process # update the progress bar and check, if we should cancel the process
...@@ -120,6 +101,27 @@ class EngraveCutter: ...@@ -120,6 +101,27 @@ class EngraveCutter:
draw_callback(text="Engrave: processing layer %d/%d" \ draw_callback(text="Engrave: processing layer %d/%d" \
% (current_layer + 1, num_of_layers)) % (current_layer + 1, num_of_layers))
# Sort the polygons according to their directions (first inside, then
# outside.
# This reduces the problem of break-away pieces.
# We do the sorting just before the final layer (breakage does not
# happen before).
def polygon_priority(poly1, poly2):
""" polygon priority comparison: first holes, then outlines
(sorted by ascending area size)
TODO: ordering according to the locations and groups of polygons
would be even better.
"""
area1 = poly1.get_area()
area2 = poly2.get_area()
if (area1 < 0) and (area2 > 0):
return -1
elif (area2 < 0) and (area1 > 0):
return 1
else:
return 0
line_groups.sort(cmp=polygon_priority)
# process the final layer with a drop cutter # process the final layer with a drop cutter
for line_group in self.contour_model.get_polygons(): for line_group in self.contour_model.get_polygons():
self.pa_drop.new_direction(0) self.pa_drop.new_direction(0)
......
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