Commit c28aa124 authored by sumpfralle's avatar sumpfralle

added an optional "reverse" parameter to all postprocessors


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@703 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent c1462ef4
......@@ -24,12 +24,13 @@ from pycam.Geometry.PolygonExtractor import PolygonExtractor
from pycam.Toolpath import simplify_toolpath
class ContourCutter:
def __init__(self):
def __init__(self, reverse=False):
self.paths = []
self.curr_path = None
self.scanline = None
self.pe = None
self.points = []
self.reverse = reverse
def append(self, p):
self.points.append(p)
......@@ -65,6 +66,8 @@ class ContourCutter:
p.append(p.points[0])
simplify_toolpath(p)
if paths:
if self.reverse:
paths.reverse()
self.paths.extend(paths)
self.pe = None
......@@ -26,11 +26,12 @@ from pycam.Geometry.Path import Path
class PathAccumulator:
def __init__(self, zigzag=False):
def __init__(self, zigzag=False, reverse=False):
self.paths = []
self.curr_path = None
self.zigzag = zigzag
self.scanline = None
self.reverse = reverse
def append(self, p):
if self.curr_path == None:
......@@ -53,6 +54,8 @@ class PathAccumulator:
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)
self.paths.append(self.curr_path)
self.curr_path = None
......
......@@ -27,11 +27,12 @@ from pycam.Toolpath import simplify_toolpath
class PolygonCutter:
def __init__(self):
def __init__(self, reverse=False):
self.paths = []
self.curr_path = None
self.scanline = None
self.pe = PolygonExtractor(PolygonExtractor.MONOTONE)
self.reverse = reverse
def append(self, p):
self.pe.append(p)
......@@ -70,5 +71,7 @@ class PolygonCutter:
if paths:
for p in paths:
simplify_toolpath(p)
if self.reverse:
p.reverse()
self.paths.extend(paths)
......@@ -24,9 +24,10 @@ from pycam.Geometry.Path import Path
from pycam.Toolpath import simplify_toolpath
class SimpleCutter:
def __init__(self):
def __init__(self, reverse=False):
self.paths = []
self.curr_path = None
self.reverse = reverse
def append(self, p):
curr_path = None
......@@ -39,7 +40,10 @@ class SimpleCutter:
curr_path.append(p)
if self.curr_path == None:
simplify_toolpath(curr_path)
self.paths.append(curr_path)
if self.reverse:
self.paths.insert(0, curr_path)
else:
self.paths.append(curr_path)
def new_direction(self, direction):
pass
......
......@@ -24,11 +24,12 @@ from pycam.Geometry.Path import Path
from pycam.Toolpath import simplify_toolpath
class ZigZagCutter:
def __init__(self):
def __init__(self, reverse=False):
self.paths = []
self.curr_path = None
self.scanline = None
self.curr_scanline = None
self.reverse = reverse
def append(self, p):
curr_path = None
......@@ -61,8 +62,11 @@ class ZigZagCutter:
def end_scanline(self):
for path in self.curr_scanline:
simplify_toolpath(path)
if self.reverse:
path.reverse()
self.paths.append(path)
self.curr_scanline = None
def finish(self):
pass
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