Commit 6b98aebd authored by sumpfralle's avatar sumpfralle

added support for "material allowance" to non-ODE calculations


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@294 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 5e3387e8
Version 0.2.3 - UNRELEASED Version 0.2.3 - UNRELEASED
* GUI change: tool and process settings can be combined into tasks * GUI change: tool and process settings can be combined into tasks
* added "material allowance" support for non-ODE calculations
* added export of EMC tool definitions * added export of EMC tool definitions
* store configured settings to a file in the user's home directory * store configured settings to a file in the user's home directory
* fixed "overlap" calculation * fixed "overlap" calculation
......
...@@ -15,12 +15,28 @@ class BaseCutter: ...@@ -15,12 +15,28 @@ class BaseCutter:
BaseCutter.id += 1 BaseCutter.id += 1
self.radius = radius self.radius = radius
self.radiussq = radius*radius self.radiussq = radius*radius
self.minx = location.x-radius self.required_distance = 0
self.maxx = location.x+radius self.distance_radius = self.radius
self.miny = location.y-radius self.distance_radiussq = self.distance_radius * self.distance_radius
self.maxy = location.y+radius # self.minx, self.maxx, self.miny and self.maxy are defined as properties below
self.shape = {} self.shape = {}
def _get_minx(self):
return self.location.x - self.distance_radius
minx = property(_get_minx)
def _get_maxx(self):
return self.location.x + self.distance_radius
maxx = property(_get_maxx)
def _get_miny(self):
return self.location.y - self.distance_radius
miny = property(_get_miny)
def _get_maxy(self):
return self.location.y + self.distance_radius
maxy = property(_get_maxy)
def __repr__(self): def __repr__(self):
return "BaseCutter" return "BaseCutter"
...@@ -36,12 +52,17 @@ class BaseCutter: ...@@ -36,12 +52,17 @@ class BaseCutter:
# just return a string comparison # just return a string comparison
return cmp(str(self), str(other)) return cmp(str(self), str(other))
def set_required_distance(self, value):
if value >= 0:
self.required_distance = value
self.distance_radius = self.radius + self.get_required_distance()
self.distance_radiussq = self.distance_radius * self.distance_radius
def get_required_distance(self):
return self.required_distance
def moveto(self, location): def moveto(self, location):
self.location = location self.location = location
self.minx = location.x-self.radius
self.maxx = location.x+self.radius
self.miny = location.y-self.radius
self.maxy = location.y+self.radius
for shape, set_pos_func in self.shape.values(): for shape, set_pos_func in self.shape.values():
set_pos_func(location.x, location.y, location.z) set_pos_func(location.x, location.y, location.z)
...@@ -61,13 +82,14 @@ class BaseCutter: ...@@ -61,13 +82,14 @@ class BaseCutter:
# check bounding circle collision # check bounding circle collision
c = triangle.center() c = triangle.center()
if sqr(c.x-self.location.x)+sqr(c.y-self.location.y)>(self.radiussq+2*self.radius*triangle.radius()+triangle.radiussq()): if sqr(c.x-self.location.x)+sqr(c.y-self.location.y)>(self.distance_radiussq+2*self.distance_radius*triangle.radius()+triangle.radiussq()):
return None return None
(cl,d)= self.intersect(BaseCutter.vertical, triangle) (cl,d)= self.intersect(BaseCutter.vertical, triangle)
return cl return cl
def push(self, dx, dy, triangle): def push(self, dx, dy, triangle):
""" TODO: this function is never used - remove it? """
# check bounding box collision # check bounding box collision
if dx == 0: if dx == 0:
if self.miny > triangle.maxy(): if self.miny > triangle.maxy():
......
...@@ -20,12 +20,12 @@ class CylindricalCutter(BaseCutter): ...@@ -20,12 +20,12 @@ class CylindricalCutter(BaseCutter):
BaseCutter.__init__(self, location, radius) BaseCutter.__init__(self, location, radius)
self.height = height self.height = height
self.axis = Point(0,0,1) self.axis = Point(0,0,1)
self.center = location self.center = 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)
def get_shape(self, format="ODE", additional_distance=0.0): def get_shape(self, format="ODE"):
if format == "ODE": if format == "ODE":
import ode import ode
""" We don't handle the the "additional_distance" perfectly, since """ We don't handle the the "additional_distance" perfectly, since
...@@ -36,7 +36,8 @@ class CylindricalCutter(BaseCutter): ...@@ -36,7 +36,8 @@ class CylindricalCutter(BaseCutter):
\_/ \_/
This slight incorrectness should be neglectable and causes no harm. This slight incorrectness should be neglectable and causes no harm.
""" """
radius = self.radius + additional_distance additional_distance = self.get_required_distance()
radius = self.distance_radius
height = self.height + additional_distance height = self.height + additional_distance
center_height = 0.5 * height - additional_distance center_height = 0.5 * height - additional_distance
geom = ode.GeomTransform(None) geom = ode.GeomTransform(None)
...@@ -88,10 +89,10 @@ class CylindricalCutter(BaseCutter): ...@@ -88,10 +89,10 @@ class CylindricalCutter(BaseCutter):
def moveto(self, location): def moveto(self, location):
BaseCutter.moveto(self, location) BaseCutter.moveto(self, location)
self.center = location self.center = location.sub(Point(0, 0, self.get_required_distance()))
def intersect_circle_plane(self, direction, triangle): def intersect_circle_plane(self, direction, triangle):
(ccp,cp,d) = intersect_circle_plane(self.center, self.radius, direction, triangle) (ccp,cp,d) = intersect_circle_plane(self.center, self.distance_radius, direction, triangle)
if ccp: if ccp:
cl = cp.add(self.location.sub(ccp)) cl = cp.add(self.location.sub(ccp))
return (cl,ccp,cp,d) return (cl,ccp,cp,d)
...@@ -104,7 +105,7 @@ class CylindricalCutter(BaseCutter): ...@@ -104,7 +105,7 @@ class CylindricalCutter(BaseCutter):
return (None,INFINITE) return (None,INFINITE)
def intersect_circle_point(self, direction, point): def intersect_circle_point(self, direction, point):
(ccp,cp,l) = intersect_circle_point(self.center, self.axis, self.radius, self.radiussq, direction, point) (ccp,cp,l) = intersect_circle_point(self.center, self.axis, self.distance_radius, self.distance_radiussq, direction, point)
if ccp: if ccp:
cl = cp.add(self.location.sub(ccp)) cl = cp.add(self.location.sub(ccp))
return (cl,ccp,cp,l) return (cl,ccp,cp,l)
...@@ -115,7 +116,7 @@ class CylindricalCutter(BaseCutter): ...@@ -115,7 +116,7 @@ class CylindricalCutter(BaseCutter):
return (cl,l) return (cl,l)
def intersect_circle_line(self, direction, edge): def intersect_circle_line(self, direction, edge):
(ccp,cp,l) = intersect_circle_line(self.center, self.axis, self.radius, self.radiussq, direction, edge) (ccp,cp,l) = intersect_circle_line(self.center, self.axis, self.distance_radius, self.distance_radiussq, direction, edge)
if ccp: if ccp:
cl = cp.add(self.location.sub(ccp)) cl = cp.add(self.location.sub(ccp))
return (cl,ccp,cp,l) return (cl,ccp,cp,l)
...@@ -131,7 +132,7 @@ class CylindricalCutter(BaseCutter): ...@@ -131,7 +132,7 @@ class CylindricalCutter(BaseCutter):
return (cl,l) return (cl,l)
def intersect_cylinder_point(self, direction, point): def intersect_cylinder_point(self, direction, point):
(ccp,cp,l) = intersect_cylinder_point(self.center, self.axis, self.radius, self.radiussq, direction, point) (ccp,cp,l) = intersect_cylinder_point(self.center, self.axis, self.distance_radius, self.distance_radiussq, direction, point)
# offset intersection # offset intersection
if ccp: if ccp:
cl = cp.add(self.location.sub(ccp)) cl = cp.add(self.location.sub(ccp))
...@@ -145,7 +146,7 @@ class CylindricalCutter(BaseCutter): ...@@ -145,7 +146,7 @@ class CylindricalCutter(BaseCutter):
return (cl, l) return (cl, l)
def intersect_cylinder_line(self, direction, edge): def intersect_cylinder_line(self, direction, edge):
(ccp,cp,l) = intersect_cylinder_line(self.center, self.axis, self.radius, self.radiussq, direction, edge) (ccp,cp,l) = intersect_cylinder_line(self.center, self.axis, self.distance_radius, self.distance_radiussq, direction, edge)
# offset intersection # offset intersection
if ccp: if ccp:
cl = cp.add(self.location.sub(ccp)) cl = cp.add(self.location.sub(ccp))
......
...@@ -25,9 +25,10 @@ class SphericalCutter(BaseCutter): ...@@ -25,9 +25,10 @@ class SphericalCutter(BaseCutter):
def __repr__(self): def __repr__(self):
return "SphericalCutter<%s,%s>" % (self.location,self.radius) return "SphericalCutter<%s,%s>" % (self.location,self.radius)
def get_shape(self, format="ODE", additional_distance=0.0): def get_shape(self, format="ODE"):
if format == "ODE": if format == "ODE":
import ode import ode
additional_distance = self.get_required_distance()
radius = self.radius + additional_distance radius = self.radius + additional_distance
center_height = 0.5 * self.height + radius - additional_distance center_height = 0.5 * self.height + radius - additional_distance
geom = ode.GeomTransform(None) geom = ode.GeomTransform(None)
...@@ -96,7 +97,7 @@ class SphericalCutter(BaseCutter): ...@@ -96,7 +97,7 @@ class SphericalCutter(BaseCutter):
self.center = Point(location.x, location.y, location.z+self.radius) self.center = Point(location.x, location.y, location.z+self.radius)
def intersect_sphere_plane(self, direction, triangle): def intersect_sphere_plane(self, direction, triangle):
(ccp,cp,d) = intersect_sphere_plane(self.center, self.radius, direction, triangle) (ccp,cp,d) = intersect_sphere_plane(self.center, self.distance_radius, direction, triangle)
# offset intersection # offset intersection
if ccp: if ccp:
cl = cp.add(self.location.sub(ccp)) cl = cp.add(self.location.sub(ccp))
...@@ -110,7 +111,7 @@ class SphericalCutter(BaseCutter): ...@@ -110,7 +111,7 @@ class SphericalCutter(BaseCutter):
return (None,INFINITE) return (None,INFINITE)
def intersect_sphere_point(self, direction, point): def intersect_sphere_point(self, direction, point):
(ccp,cp,l) = intersect_sphere_point(self.center, self.radius, self.radiussq, direction, point) (ccp,cp,l) = intersect_sphere_point(self.center, self.distance_radius, self.distance_radiussq, direction, point)
# offset intersection # offset intersection
cl = None cl = None
if cp: if cp:
...@@ -122,7 +123,7 @@ class SphericalCutter(BaseCutter): ...@@ -122,7 +123,7 @@ class SphericalCutter(BaseCutter):
return (cl,l) return (cl,l)
def intersect_sphere_line(self, direction, edge): def intersect_sphere_line(self, direction, edge):
(ccp,cp,l) = intersect_sphere_line(self.center, self.radius, self.radiussq, direction, edge) (ccp,cp,l) = intersect_sphere_line(self.center, self.distance_radius, self.distance_radiussq, direction, edge)
# offset intersection # offset intersection
if ccp: if ccp:
cl = cp.sub(ccp.sub(self.location)) cl = cp.sub(ccp.sub(self.location))
...@@ -140,7 +141,7 @@ class SphericalCutter(BaseCutter): ...@@ -140,7 +141,7 @@ class SphericalCutter(BaseCutter):
return (cl,l) return (cl,l)
def intersect_cylinder_point(self, direction, point): def intersect_cylinder_point(self, direction, point):
(ccp,cp,l)=intersect_cylinder_point(self.center, self.axis, self.radius, self.radiussq, direction, point) (ccp,cp,l)=intersect_cylinder_point(self.center, self.axis, self.distance_radius, self.distance_radiussq, direction, point)
# offset intersection # offset intersection
if ccp: if ccp:
cl = cp.add(self.location.sub(ccp)) cl = cp.add(self.location.sub(ccp))
...@@ -154,7 +155,7 @@ class SphericalCutter(BaseCutter): ...@@ -154,7 +155,7 @@ class SphericalCutter(BaseCutter):
return (cl, l) return (cl, l)
def intersect_cylinder_line(self, direction, edge): def intersect_cylinder_line(self, direction, edge):
(ccp,cp,l) = intersect_cylinder_line(self.center, self.axis, self.radius, self.radiussq, direction, edge) (ccp,cp,l) = intersect_cylinder_line(self.center, self.axis, self.distance_radius, self.distance_radiussq, direction, edge)
# offset intersection # offset intersection
if ccp: if ccp:
cl = self.location.add(cp.sub(ccp)) cl = self.location.add(cp.sub(ccp))
...@@ -240,6 +241,7 @@ class SphericalCutter(BaseCutter): ...@@ -240,6 +241,7 @@ class SphericalCutter(BaseCutter):
return (cl,d) return (cl,d)
def drop_bis(self, triangle): def drop_bis(self, triangle):
""" TODO: this function is never called - remove it? """
n = triangle.normal() n = triangle.normal()
if abs(n.dot(self.axis))<epsilon: if abs(n.dot(self.axis))<epsilon:
d = triangle.p1.sub(self.center).dot(n) d = triangle.p1.sub(self.center).dot(n)
......
...@@ -26,6 +26,19 @@ class ToroidalCutter(BaseCutter): ...@@ -26,6 +26,19 @@ class ToroidalCutter(BaseCutter):
self.center = Point(location.x, location.y, location.z+minorradius) self.center = Point(location.x, location.y, 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_minorradius = self.minorradius + self.get_required_distance()
self.distance_majorradiussq = sqr(self.distance_majorradius)
self.distance_minorradiussq = sqr(self.distance_minorradius)
def set_required_distance(self, value):
""" trigger the update of "self.distance_major/minorradius" """
BaseCutter.set_required_distance(self, value)
if value >= 0:
self.distance_majorradius = self.majorradius + self.get_required_distance()
self.distance_minorradius = self.minorradius + self.get_required_distance()
self.distance_majorradiussq = sqr(self.distance_majorradius)
self.distance_minorradiussq = sqr(self.distance_minorradius)
def __repr__(self): def __repr__(self):
return "ToroidalCutter<%s,%f,R=%f,r=%f>" % (self.location,self.radius,self.majorradius,self.minorradius) return "ToroidalCutter<%s,%f,R=%f,r=%f>" % (self.location,self.radius,self.majorradius,self.minorradius)
...@@ -40,14 +53,15 @@ class ToroidalCutter(BaseCutter): ...@@ -40,14 +53,15 @@ class ToroidalCutter(BaseCutter):
# just return a string comparison # just return a string comparison
return cmp(str(self), str(other)) return cmp(str(self), str(other))
def get_shape(self, format="ODE", additional_distance=0.0): def get_shape(self, format="ODE"):
if format == "ODE": if format == "ODE":
import ode import ode
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
self.shape[format] = CylindricalCutter(self.radius, self.location, cylinder = CylindricalCutter(self.radius, self.location, height=self.height)
height=self.height).get_shape(format, additional_distance) cylinder.set_required_distance(self.get_required_distance())
self.shape[format] = cylinder.get_shape(format)
return self.shape[format] return self.shape[format]
def to_OpenGL(self): def to_OpenGL(self):
...@@ -72,7 +86,7 @@ class ToroidalCutter(BaseCutter): ...@@ -72,7 +86,7 @@ class ToroidalCutter(BaseCutter):
self.center = Point(location.x, location.y, location.z+self.minorradius) self.center = Point(location.x, location.y, location.z+self.minorradius)
def intersect_torus_plane(self, direction, triangle): def intersect_torus_plane(self, direction, triangle):
(ccp,cp,l) = intersect_torus_plane(self.center, self.axis, self.majorradius, self.minorradius, direction, triangle) (ccp,cp,l) = intersect_torus_plane(self.center, self.axis, self.distance_majorradius, self.distance_minorradius, direction, triangle)
if cp: if cp:
cl = cp.add(self.location.sub(ccp)) cl = cp.add(self.location.sub(ccp))
return (cl,ccp,cp,l) return (cl,ccp,cp,l)
...@@ -85,7 +99,7 @@ class ToroidalCutter(BaseCutter): ...@@ -85,7 +99,7 @@ class ToroidalCutter(BaseCutter):
return (None,INFINITE) return (None,INFINITE)
def intersect_torus_point(self, direction, point): def intersect_torus_point(self, direction, point):
(ccp,cp,l) = intersect_torus_point(self.center, self.axis, self.majorradius, self.minorradius, self.majorradiussq, self.minorradiussq, direction, point) (ccp,cp,l) = intersect_torus_point(self.center, self.axis, self.distance_majorradius, self.distance_minorradius, self.distance_majorradiussq, self.distance_minorradiussq, direction, point)
if ccp: if ccp:
cl = point.add(self.location.sub(ccp)) cl = point.add(self.location.sub(ccp))
return (cl, ccp, point, l) return (cl, ccp, point, l)
...@@ -100,7 +114,7 @@ class ToroidalCutter(BaseCutter): ...@@ -100,7 +114,7 @@ class ToroidalCutter(BaseCutter):
min_m = 0 min_m = 0
min_l = INFINITE min_l = INFINITE
min_cl = None min_cl = None
scale = int(edge.len()/self.minorradius*2) scale = int(edge.len()/self.distance_minorradius*2)
if scale<3: if scale<3:
scale = 3 scale = 3
for i in range(0,scale+1): for i in range(0,scale+1):
...@@ -130,7 +144,7 @@ class ToroidalCutter(BaseCutter): ...@@ -130,7 +144,7 @@ class ToroidalCutter(BaseCutter):
return (min_cl, min_l) return (min_cl, min_l)
def intersect_cylinder_point(self, direction, point): def intersect_cylinder_point(self, direction, point):
(ccp,cp,l) = intersect_cylinder_point(self.center, self.axis, self.radius, self.radiussq, direction, point) (ccp,cp,l) = intersect_cylinder_point(self.center, self.axis, self.distance_radius, self.distance_radiussq, direction, point)
# offset intersection # offset intersection
if ccp: if ccp:
cl = self.location.add(direction.mul(l)) cl = self.location.add(direction.mul(l))
...@@ -144,7 +158,7 @@ class ToroidalCutter(BaseCutter): ...@@ -144,7 +158,7 @@ class ToroidalCutter(BaseCutter):
return (cl, l) return (cl, l)
def intersect_cylinder_line(self, direction, edge): def intersect_cylinder_line(self, direction, edge):
(ccp,cp,l) = intersect_cylinder_line(self.center, self.axis, self.radius, self.radiussq, direction, edge) (ccp,cp,l) = intersect_cylinder_line(self.center, self.axis, self.distance_radius, self.distance_radiussq, direction, edge)
# offset intersection # offset intersection
if ccp: if ccp:
cl = self.location.add(cp.sub(ccp)) cl = self.location.add(cp.sub(ccp))
...@@ -162,7 +176,7 @@ class ToroidalCutter(BaseCutter): ...@@ -162,7 +176,7 @@ class ToroidalCutter(BaseCutter):
return (cl,l) return (cl,l)
def intersect_circle_plane(self, direction, triangle): def intersect_circle_plane(self, direction, triangle):
(ccp,cp,l) = intersect_circle_plane(self.location, self.majorradius, direction, triangle) (ccp,cp,l) = intersect_circle_plane(self.location, self.distance_majorradius, direction, triangle)
# offset intersection # offset intersection
if ccp: if ccp:
cl = cp.sub(ccp.sub(self.location)) cl = cp.sub(ccp.sub(self.location))
...@@ -176,7 +190,7 @@ class ToroidalCutter(BaseCutter): ...@@ -176,7 +190,7 @@ class ToroidalCutter(BaseCutter):
return (None,INFINITE) return (None,INFINITE)
def intersect_circle_point(self, direction, point): def intersect_circle_point(self, direction, point):
(ccp, cp, l) = intersect_circle_point(self.location, self.axis, self.majorradius, self.majorradiussq, direction, point) (ccp, cp, l) = intersect_circle_point(self.location, self.axis, self.distance_majorradius, self.distance_majorradiussq, direction, point)
if ccp: if ccp:
cl = cp.sub(ccp.sub(self.location)) cl = cp.sub(ccp.sub(self.location))
return (cl,ccp,point,l) return (cl,ccp,point,l)
...@@ -187,7 +201,7 @@ class ToroidalCutter(BaseCutter): ...@@ -187,7 +201,7 @@ class ToroidalCutter(BaseCutter):
return (cl,l) return (cl,l)
def intersect_circle_line(self, direction, edge): def intersect_circle_line(self, direction, edge):
(ccp,cp,l) = intersect_circle_line(self.location, self.axis, self.majorradius, self.majorradiussq, direction, edge) (ccp,cp,l) = intersect_circle_line(self.location, self.axis, self.distance_majorradius, self.distance_majorradiussq, direction, edge)
if ccp: if ccp:
cl = cp.sub(ccp.sub(self.location)) cl = cp.sub(ccp.sub(self.location))
return (cl,ccp,cp,l) return (cl,ccp,cp,l)
......
...@@ -543,13 +543,11 @@ class ProjectGui: ...@@ -543,13 +543,11 @@ class ProjectGui:
# repaint the 3d view after a color change # repaint the 3d view after a color change
obj.connect("color-set", self.update_view) obj.connect("color-set", self.update_view)
# set the availability of ODE # set the availability of ODE
enable_ode_control = self.gui.get_object("SettingEnableODE")
if ode_objects.is_ode_available(): if ode_objects.is_ode_available():
obj = self.gui.get_object("SettingEnableODE") self.settings.add_item("enable_ode", enable_ode_control.get_active, enable_ode_control.set_active)
self.settings.add_item("enable_ode", obj.get_active, obj.set_active)
else: else:
self.gui.get_object("SettingEnableODE").set_sensitive(False) enable_ode_control.set_sensitive(False)
# TODO: remove this as soon as non-ODE toolpath generation respects material allowance
self.gui.get_object("MaterialAllowanceControl").set_sensitive(False)
# bind dummy get/set functions to "enable_ode" (always return False) # bind dummy get/set functions to "enable_ode" (always return False)
self.settings.add_item("enable_ode", lambda: False, lambda state: None) self.settings.add_item("enable_ode", lambda: False, lambda state: None)
skip_obj = self.gui.get_object("DrillProgressFrameSkipControl") skip_obj = self.gui.get_object("DrillProgressFrameSkipControl")
...@@ -704,10 +702,10 @@ class ProjectGui: ...@@ -704,10 +702,10 @@ class ProjectGui:
self.view3d.glsetup() self.view3d.glsetup()
self.view3d.paint() self.view3d.paint()
def get_physics(self, cutter, material_allowance): def get_physics(self, cutter):
if self.settings.get("enable_ode"): if self.settings.get("enable_ode"):
self._physics_cache = ode_objects.generate_physics(self.model, cutter, self._physics_cache = ode_objects.generate_physics(self.model,
self._physics_cache, material_allowance) cutter, self._physics_cache)
else: else:
self._physics_cache = None self._physics_cache = None
return self._physics_cache return self._physics_cache
...@@ -858,8 +856,6 @@ class ProjectGui: ...@@ -858,8 +856,6 @@ class ProjectGui:
self.gui.get_object(objname).set_sensitive(dropcutter_active) self.gui.get_object(objname).set_sensitive(dropcutter_active)
# disable "step down" control, if PushCutter is not active # disable "step down" control, if PushCutter is not active
self.gui.get_object("MaxStepDownControl").set_sensitive(get_obj("PushCutter").get_active()) self.gui.get_object("MaxStepDownControl").set_sensitive(get_obj("PushCutter").get_active())
# "material allowance" requires ODE support
self.gui.get_object("MaterialAllowanceControl").set_sensitive(self.settings.get("enable_ode"))
def update_tool_controls(self, widget=None, data=None): def update_tool_controls(self, widget=None, data=None):
# disable the toroidal radius if the toroidal cutter is not enabled # disable the toroidal radius if the toroidal cutter is not enabled
...@@ -1655,7 +1651,8 @@ class ProjectGui: ...@@ -1655,7 +1651,8 @@ class ProjectGui:
def get_pathgenerator_instance(self, cutter, process_settings): def get_pathgenerator_instance(self, cutter, process_settings):
pathgenerator = process_settings["path_generator"] pathgenerator = process_settings["path_generator"]
pathprocessor = process_settings["path_postprocessor"] pathprocessor = process_settings["path_postprocessor"]
physics = self.get_physics(cutter, process_settings["material_allowance"]) cutter.set_required_distance(process_settings["material_allowance"])
physics = self.get_physics(cutter)
if pathgenerator == "DropCutter": if pathgenerator == "DropCutter":
if pathprocessor == "ZigZagCutter": if pathprocessor == "ZigZagCutter":
processor = pycam.PathProcessors.PathAccumulator(zigzag=True) processor = pycam.PathProcessors.PathAccumulator(zigzag=True)
......
...@@ -10,12 +10,12 @@ ShapeCapsule = lambda radius, height: ode.GeomCapsule(None, radius, height - (2 ...@@ -10,12 +10,12 @@ ShapeCapsule = lambda radius, height: ode.GeomCapsule(None, radius, height - (2
_ode_override_state = None _ode_override_state = None
def generate_physics(model, cutter, physics=None, material_allowance=0.0): def generate_physics(model, cutter, physics=None):
if physics is None: if physics is None:
physics = PhysicalWorld() physics = PhysicalWorld()
physics.reset() physics.reset()
physics.add_mesh((0, 0, 0), model.triangles()) physics.add_mesh((0, 0, 0), model.triangles())
shape_info = cutter.get_shape("ODE", additional_distance=material_allowance) shape_info = cutter.get_shape("ODE")
physics.set_drill(shape_info[0], (0.0, 0.0, 0.0)) physics.set_drill(shape_info[0], (0.0, 0.0, 0.0))
return physics return physics
......
...@@ -186,10 +186,10 @@ class DropCutter: ...@@ -186,10 +186,10 @@ class DropCutter:
cut_max = None cut_max = None
triangle_max = None triangle_max = None
self.cutter.moveto(p) self.cutter.moveto(p)
box_x_min = p.x - self.cutter.radius box_x_min = self.cutter.minx
box_x_max = p.x + self.cutter.radius box_x_max = self.cutter.maxx
box_y_min = p.y - self.cutter.radius box_y_min = self.cutter.miny
box_y_max = p.y + self.cutter.radius box_y_max = self.cutter.maxy
box_z_min = dim_height.end box_z_min = dim_height.end
box_z_max = self.safety_height box_z_max = self.safety_height
triangles = self.model.triangles(box_x_min, box_y_min, box_z_min, box_x_max, box_y_max, box_z_max) triangles = self.model.triangles(box_x_min, box_y_min, box_z_min, box_x_max, box_y_max, box_z_max)
......
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