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: ...@@ -9,7 +9,9 @@ class BaseCutter:
id = 0 id = 0
vertical = Point(0,0,-1) 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.location = location
self.id = BaseCutter.id self.id = BaseCutter.id
BaseCutter.id += 1 BaseCutter.id += 1
......
...@@ -17,10 +17,10 @@ except: ...@@ -17,10 +17,10 @@ except:
class CylindricalCutter(BaseCutter): class CylindricalCutter(BaseCutter):
def __init__(self, radius, location=Point(0,0,0), **kwargs): def __init__(self, radius, **kwargs):
BaseCutter.__init__(self, location, radius, **kwargs) BaseCutter.__init__(self, radius, **kwargs)
self.axis = Point(0,0,1) self.axis = Point(0, 0, 1)
self.center = location.sub(Point(0, 0, self.get_required_distance())) self.center = self.location.sub(Point(0, 0, self.get_required_distance()))
def __repr__(self): def __repr__(self):
return "CylindricalCutter<%s,%s>" % (self.location,self.radius) return "CylindricalCutter<%s,%s>" % (self.location,self.radius)
......
...@@ -17,10 +17,10 @@ except: ...@@ -17,10 +17,10 @@ except:
class SphericalCutter(BaseCutter): class SphericalCutter(BaseCutter):
def __init__(self, radius, location=Point(0,0,0), **kwargs): def __init__(self, radius, **kwargs):
BaseCutter.__init__(self, location, radius, **kwargs) BaseCutter.__init__(self, radius, **kwargs)
self.axis = Point(0,0,1) 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): def __repr__(self):
return "SphericalCutter<%s,%s>" % (self.location,self.radius) return "SphericalCutter<%s,%s>" % (self.location,self.radius)
......
...@@ -17,12 +17,12 @@ except: ...@@ -17,12 +17,12 @@ except:
class ToroidalCutter(BaseCutter): class ToroidalCutter(BaseCutter):
def __init__(self, radius, minorradius, location=Point(0,0,0), **kwargs): def __init__(self, radius, minorradius, **kwargs):
BaseCutter.__init__(self, location, radius, **kwargs) BaseCutter.__init__(self, radius, **kwargs)
self.majorradius = radius-minorradius self.majorradius = radius-minorradius
self.minorradius = minorradius self.minorradius = minorradius
self.axis = Point(0,0,1) 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.majorradiussq = sqr(self.majorradius)
self.minorradiussq = sqr(self.minorradius) self.minorradiussq = sqr(self.minorradius)
self.distance_majorradius = self.majorradius + self.get_required_distance() self.distance_majorradius = self.majorradius + self.get_required_distance()
...@@ -58,7 +58,7 @@ class ToroidalCutter(BaseCutter): ...@@ -58,7 +58,7 @@ class ToroidalCutter(BaseCutter):
from pycam.Cutters.CylindricalCutter import CylindricalCutter from pycam.Cutters.CylindricalCutter import CylindricalCutter
# TODO: use an appromixated trimesh instead (ODE does not support toroidal shapes) # 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 # 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()) cylinder.set_required_distance(self.get_required_distance())
self.shape[format] = cylinder.get_shape(format) self.shape[format] = cylinder.get_shape(format)
return self.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