Commit 66ed9af2 authored by sumpfralle's avatar sumpfralle

moved the "Dimension" class to the DropCutter to avoid circular imports under...

moved the "Dimension" class to the DropCutter to avoid circular imports under some circumstances (thanks to Dan Heeks)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@207 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 0a06ca01
from pycam.PathProcessors import *
from pycam.Geometry import *
from pycam.Geometry.intersection import intersect_lines
import pycam.PathGenerators
from pycam.Geometry.utils import INFINITE
import math
import sys
class Dimension:
def __init__(self, start, end):
self.start = float(start)
self.end = float(end)
self.min = float(min(start, end))
self.max = float(max(start, end))
self.downward = start > end
self.value = 0.0
def check_bounds(self, value=None, tolerance=None):
if value is None:
value = self.value
if tolerance is None:
return (value >= self.min) and (value <= self.max)
else:
return (value > self.min - tolerance) and (value < self.max + tolerance)
def shift(self, distance):
if self.downward:
self.value -= distance
else:
self.value += distance
def set(self, value):
self.value = float(value)
def get(self):
return self.value
class DropCutter:
def __init__(self, cutter, model, PathProcessor=None, physics=None, safety_height=INFINITE):
......@@ -27,9 +56,9 @@ class DropCutter:
else:
pa = PathAccumulator()
dim_x = pycam.PathGenerators.Dimension(minx, maxx)
dim_y = pycam.PathGenerators.Dimension(miny, maxy)
dim_height = pycam.PathGenerators.Dimension(z1, z0)
dim_x = Dimension(minx, maxx)
dim_y = Dimension(miny, maxy)
dim_height = Dimension(z1, z0)
dims = [None, None, None]
# map the scales according to the order of direction
if direction == 0:
......
list = ["DropCutter", "PushCutter", "Dimension"]
list = ["DropCutter", "PushCutter"]
__all__ = list
from DropCutter import DropCutter
from PushCutter import PushCutter
class Dimension:
def __init__(self, start, end):
self.start = float(start)
self.end = float(end)
self.min = float(min(start, end))
self.max = float(max(start, end))
self.downward = start > end
self.value = 0.0
def check_bounds(self, value=None, tolerance=None):
if value is None:
value = self.value
if tolerance is None:
return (value >= self.min) and (value <= self.max)
else:
return (value > self.min - tolerance) and (value < self.max + tolerance)
def shift(self, distance):
if self.downward:
self.value -= distance
else:
self.value += distance
def set(self, value):
self.value = float(value)
def get(self):
return self.value
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