Commit 93ba4797 authored by sumpfralle's avatar sumpfralle

fixed some code-style issues


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@490 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent b1ff9172
...@@ -20,8 +20,7 @@ You should have received a copy of the GNU General Public License ...@@ -20,8 +20,7 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>. along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
""" """
from pycam.Geometry import * from pycam.Geometry.PolygonExtractor import PolygonExtractor
from pycam.Geometry.PolygonExtractor import *
class ContourCutter: class ContourCutter:
def __init__(self): def __init__(self):
...@@ -34,11 +33,11 @@ class ContourCutter: ...@@ -34,11 +33,11 @@ class ContourCutter:
def append(self, p): def append(self, p):
self.points.append(p) self.points.append(p)
def new_direction(self, dir): def new_direction(self, direction):
if self.pe == None: if self.pe == None:
self.pe = PolygonExtractor(PolygonExtractor.CONTOUR) self.pe = PolygonExtractor(PolygonExtractor.CONTOUR)
self.pe.new_direction(dir) self.pe.new_direction(direction)
def end_direction(self): def end_direction(self):
self.pe.end_direction() self.pe.end_direction()
......
...@@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License ...@@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>. along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
""" """
from pycam.Geometry import * from pycam.Geometry import Path
def _check_colinearity(p1, p2, p3): def _check_colinearity(p1, p2, p3):
v1 = p2.sub(p1) v1 = p2.sub(p1)
...@@ -36,18 +36,20 @@ class PathAccumulator: ...@@ -36,18 +36,20 @@ class PathAccumulator:
self.paths = [] self.paths = []
self.curr_path = None self.curr_path = None
self.zigzag = zigzag self.zigzag = zigzag
self.scanline = None
def append(self, p): def append(self, p):
if self.curr_path == None: if self.curr_path == None:
self.curr_path = Path() self.curr_path = Path()
if (len(self.curr_path.points) >= 2) and \ if (len(self.curr_path.points) >= 2) and \
(_check_colinearity(self.curr_path.points[-2], self.curr_path.points[-1], p)): (_check_colinearity(self.curr_path.points[-2],
self.curr_path.points[-1], p)):
# remove the previous point since it is in line with its # remove the previous point since it is in line with its
# predecessor and the new point # predecessor and the new point
self.curr_path.points.pop() self.curr_path.points.pop()
self.curr_path.append(p) self.curr_path.append(p)
def new_direction(self, dir): def new_direction(self, direction):
self.scanline = 0 self.scanline = 0
def end_direction(self): def end_direction(self):
......
...@@ -21,8 +21,9 @@ You should have received a copy of the GNU General Public License ...@@ -21,8 +21,9 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>. along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
""" """
from pycam.Geometry import * from pycam.Geometry import Path
from pycam.Geometry.PolygonExtractor import * from pycam.Geometry.PolygonExtractor import PolygonExtractor
class PolygonCutter: class PolygonCutter:
def __init__(self): def __init__(self):
...@@ -34,8 +35,8 @@ class PolygonCutter: ...@@ -34,8 +35,8 @@ class PolygonCutter:
def append(self, p): def append(self, p):
self.pe.append(p) self.pe.append(p)
def new_direction(self, dir): def new_direction(self, direction):
self.pe.new_direction(dir) self.pe.new_direction(direction)
def end_direction(self): def end_direction(self):
self.pe.end_direction() self.pe.end_direction()
......
...@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License ...@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>. along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
""" """
from pycam.Geometry import * from pycam.Geometry import Path
class SimpleCutter: class SimpleCutter:
def __init__(self): def __init__(self):
...@@ -39,7 +39,7 @@ class SimpleCutter: ...@@ -39,7 +39,7 @@ class SimpleCutter:
if self.curr_path == None: if self.curr_path == None:
self.paths.append(curr_path) self.paths.append(curr_path)
def new_direction(self, dir): def new_direction(self, direction):
pass pass
def end_direction(self): def end_direction(self):
......
...@@ -20,13 +20,14 @@ You should have received a copy of the GNU General Public License ...@@ -20,13 +20,14 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>. along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
""" """
from pycam.Geometry import * from pycam.Geometry import Path
class ZigZagCutter: class ZigZagCutter:
def __init__(self): def __init__(self):
self.paths = [] self.paths = []
self.curr_path = None self.curr_path = None
self.scanline = None self.scanline = None
self.curr_scanline = None
def append(self, p): def append(self, p):
curr_path = None curr_path = None
...@@ -46,7 +47,7 @@ class ZigZagCutter: ...@@ -46,7 +47,7 @@ class ZigZagCutter:
curr_path.reverse() curr_path.reverse()
self.curr_scanline.insert(0, curr_path) self.curr_scanline.insert(0, curr_path)
def new_direction(self, dir): def new_direction(self, direction):
self.scanline = 0 self.scanline = 0
def end_direction(self): def end_direction(self):
......
...@@ -20,13 +20,12 @@ You should have received a copy of the GNU General Public License ...@@ -20,13 +20,12 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>. along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
""" """
list = ["PathAccumulator", "SimpleCutter", "ZigZagCutter", "PolygonCutter", "ContourCutter"] __all__ = ["PathAccumulator", "SimpleCutter", "ZigZagCutter", "PolygonCutter",
__all__ = list "ContourCutter"]
from pycam.PathProcessors.PathAccumulator import PathAccumulator
from PathAccumulator import PathAccumulator from pycam.PathProcessors.SimpleCutter import SimpleCutter
from SimpleCutter import SimpleCutter from pycam.PathProcessors.ZigZagCutter import ZigZagCutter
from ZigZagCutter import ZigZagCutter from pycam.PathProcessors.PolygonCutter import PolygonCutter
from PolygonCutter import PolygonCutter from pycam.PathProcessors.ContourCutter import ContourCutter
from ContourCutter import ContourCutter
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