Commit 409a2478 authored by sumpfralle's avatar sumpfralle

change the mandatory location parameter to an optional one (it is commonly used in this way)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@325 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent ffcc251c
......@@ -9,7 +9,9 @@ class BaseCutter:
id = 0
vertical = Point(0,0,-1)
def __init__(self, location, radius, height=10):
def __init__(self, radius, location=None, height=10):
if location is None:
location = Point(0, 0, 0)
self.location = location
self.id = BaseCutter.id
BaseCutter.id += 1
......
......@@ -17,10 +17,10 @@ except:
class CylindricalCutter(BaseCutter):
def __init__(self, radius, location=Point(0,0,0), **kwargs):
BaseCutter.__init__(self, location, radius, **kwargs)
self.axis = Point(0,0,1)
self.center = location.sub(Point(0, 0, self.get_required_distance()))
def __init__(self, radius, **kwargs):
BaseCutter.__init__(self, radius, **kwargs)
self.axis = Point(0, 0, 1)
self.center = self.location.sub(Point(0, 0, self.get_required_distance()))
def __repr__(self):
return "CylindricalCutter<%s,%s>" % (self.location,self.radius)
......
......@@ -17,10 +17,10 @@ except:
class SphericalCutter(BaseCutter):
def __init__(self, radius, location=Point(0,0,0), **kwargs):
BaseCutter.__init__(self, location, radius, **kwargs)
def __init__(self, radius, **kwargs):
BaseCutter.__init__(self, radius, **kwargs)
self.axis = Point(0,0,1)
self.center = Point(location.x, location.y, location.z+radius)
self.center = Point(self.location.x, self.location.y, self.location.z + radius)
def __repr__(self):
return "SphericalCutter<%s,%s>" % (self.location,self.radius)
......
......@@ -17,12 +17,12 @@ except:
class ToroidalCutter(BaseCutter):
def __init__(self, radius, minorradius, location=Point(0,0,0), **kwargs):
BaseCutter.__init__(self, location, radius, **kwargs)
def __init__(self, radius, minorradius, **kwargs):
BaseCutter.__init__(self, radius, **kwargs)
self.majorradius = radius-minorradius
self.minorradius = minorradius
self.axis = Point(0,0,1)
self.center = Point(location.x, location.y, location.z+minorradius)
self.center = Point(self.location.x, self.location.y, self.location.z + minorradius)
self.majorradiussq = sqr(self.majorradius)
self.minorradiussq = sqr(self.minorradius)
self.distance_majorradius = self.majorradius + self.get_required_distance()
......@@ -58,7 +58,7 @@ class ToroidalCutter(BaseCutter):
from pycam.Cutters.CylindricalCutter import CylindricalCutter
# TODO: use an appromixated trimesh instead (ODE does not support toroidal shapes)
# for now: use the simple cylinder shape - this should not do any harm
cylinder = CylindricalCutter(self.radius, self.location, height=self.height)
cylinder = CylindricalCutter(self.radius, location=self.location, height=self.height)
cylinder.set_required_distance(self.get_required_distance())
self.shape[format] = cylinder.get_shape(format)
return self.shape[format]
......
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