Commit 40f69b00 authored by sumpfralle's avatar sumpfralle

fixed the conventional/climb mode for engravings (wrong order of polygons was applied before)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@884 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 7ac67afe
...@@ -433,6 +433,12 @@ class ContourModel(BaseModel): ...@@ -433,6 +433,12 @@ class ContourModel(BaseModel):
return None return None
self.reset_cache() self.reset_cache()
def get_reversed(self):
result = ContourModel(plane=self._plane)
for poly in self.get_polygons():
result.append(poly.get_reversed())
return result
def get_cropped_model(self, minx, maxx, miny, maxy, minz, maxz): def get_cropped_model(self, minx, maxx, miny, maxy, minz, maxz):
new_line_groups = [] new_line_groups = []
for group in self._line_groups: for group in self._line_groups:
......
...@@ -104,6 +104,12 @@ class Polygon(TransformableContainer): ...@@ -104,6 +104,12 @@ class Polygon(TransformableContainer):
self._points.reverse() self._points.reverse()
self.reset_cache() self.reset_cache()
def get_reversed(self):
result = Polygon(plane=self.plane)
result._points = self._points[:]
result.reverse_direction()
return result
def is_connectable(self, line): def is_connectable(self, line):
if self.is_closed: if self.is_closed:
return False return False
......
...@@ -36,7 +36,7 @@ log = pycam.Utils.log.get_logger() ...@@ -36,7 +36,7 @@ log = pycam.Utils.log.get_logger()
class EngraveCutter: class EngraveCutter:
def __init__(self, cutter, trimesh_models, contour_model, path_processor, def __init__(self, cutter, trimesh_models, contour_model, path_processor,
physics=None): clockwise=False, physics=None):
self.cutter = cutter self.cutter = cutter
self.models = trimesh_models self.models = trimesh_models
# combine the models (if there is more than one) # combine the models (if there is more than one)
...@@ -46,6 +46,9 @@ class EngraveCutter: ...@@ -46,6 +46,9 @@ class EngraveCutter:
self.combined_model += model self.combined_model += model
else: else:
self.combined_model = [] self.combined_model = []
if clockwise:
self.contour_model = contour_model.get_reversed()
else:
self.contour_model = contour_model self.contour_model = contour_model
self.pa_push = path_processor self.pa_push = path_processor
# We use a separated path processor for the last "drop" layer. # We use a separated path processor for the last "drop" layer.
......
...@@ -345,9 +345,9 @@ def _get_pathgenerator_instance(trimesh_models, contour_model, cutter, ...@@ -345,9 +345,9 @@ def _get_pathgenerator_instance(trimesh_models, contour_model, cutter,
return PushCutter.PushCutter(cutter, trimesh_models, processor, return PushCutter.PushCutter(cutter, trimesh_models, processor,
physics=physics) physics=physics)
elif pathgenerator == "EngraveCutter": elif pathgenerator == "EngraveCutter":
reverse = (milling_style == "conventional") clockwise = (milling_style == "climb")
if pathprocessor == "SimpleCutter": if pathprocessor == "SimpleCutter":
processor = SimpleCutter.SimpleCutter(reverse=reverse) processor = SimpleCutter.SimpleCutter()
else: else:
return ("Invalid postprocessor (%s) for 'EngraveCutter' - it " \ return ("Invalid postprocessor (%s) for 'EngraveCutter' - it " \
+ "should be: SimpleCutter") % str(pathprocessor) + "should be: SimpleCutter") % str(pathprocessor)
...@@ -355,7 +355,7 @@ def _get_pathgenerator_instance(trimesh_models, contour_model, cutter, ...@@ -355,7 +355,7 @@ def _get_pathgenerator_instance(trimesh_models, contour_model, cutter,
return "The 'Engraving' toolpath strategy requires a 2D contour " \ return "The 'Engraving' toolpath strategy requires a 2D contour " \
+ "model (e.g. from a DXF or SVG file)." + "model (e.g. from a DXF or SVG file)."
return EngraveCutter.EngraveCutter(cutter, trimesh_models, return EngraveCutter.EngraveCutter(cutter, trimesh_models,
contour_model, processor, physics=physics) contour_model, processor, clockwise=clockwise, physics=physics)
elif pathgenerator == "ContourFollow": elif pathgenerator == "ContourFollow":
reverse = (milling_style == "conventional") reverse = (milling_style == "conventional")
if pathprocessor == "SimpleCutter": if pathprocessor == "SimpleCutter":
......
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