Commit bbe7d336 authored by sumpfralle's avatar sumpfralle

r702@erker: lars | 2010-02-21 21:56:43 +0100

 use a calculated "safe height" instead of "utils.INIFINITE" for a boundary limit failure in DropCutter (otherwise it looks like a bug)
  - issue a warning once


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@154 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 29f503ff
from pycam.PathProcessors import * from pycam.PathProcessors import *
from pycam.Geometry import * from pycam.Geometry import *
from pycam.Geometry.utils import *
from pycam.Geometry.intersection import intersect_lines from pycam.Geometry.intersection import intersect_lines
import pycam.PathGenerators import pycam.PathGenerators
import sys
class DropCutter: class DropCutter:
...@@ -15,6 +15,11 @@ class DropCutter: ...@@ -15,6 +15,11 @@ class DropCutter:
# used for the non-ode code # used for the non-ode code
self._triangle_last = None self._triangle_last = None
self._cut_last = None self._cut_last = None
# put the toolpath clearly above the model, if the model exceeds the
# bounding box at certain positions
self._safe_height = self.model.maxz + 4 * (self.model.maxz - self.model.minz)
# remember if we already reported an invalid boundary
self._boundary_warning_already_shown = False
def GenerateToolPath(self, minx, maxx, miny, maxy, z0, z1, d0, d1, direction, draw_callback=None): def GenerateToolPath(self, minx, maxx, miny, maxy, z0, z1, d0, d1, direction, draw_callback=None):
if self.processor: if self.processor:
...@@ -40,7 +45,10 @@ class DropCutter: ...@@ -40,7 +45,10 @@ class DropCutter:
dim_height.set(dim_height.start) dim_height.set(dim_height.start)
pa.new_direction(direction) pa.new_direction(direction)
dims[1].set(dims[1].start) dims[1].set(dims[1].start)
finished_plane = False finished_plane = False
self._boundary_warning_already_shown = False
while not finished_plane: while not finished_plane:
finished_line = False finished_line = False
dims[0].set(dims[0].start) dims[0].set(dims[0].start)
...@@ -65,7 +73,7 @@ class DropCutter: ...@@ -65,7 +73,7 @@ class DropCutter:
if dims[0].check_bounds(tolerance=d0): if dims[0].check_bounds(tolerance=d0):
# check if we are still within the strict limits # check if we are still within the strict limits
if not dims[0].check_bounds(): if not dims[0].check_bounds():
# we crossed the maximum, but we are still within step width # we exceeded the maximum, but we are still within step width
dims[0].set(dims[0].end) dims[0].set(dims[0].end)
else: else:
finished_line = True finished_line = True
...@@ -115,7 +123,12 @@ class DropCutter: ...@@ -115,7 +123,12 @@ class DropCutter:
self.physics.set_drill_position((x.get(), y.get(), dim_height.start)) self.physics.set_drill_position((x.get(), y.get(), dim_height.start))
if self.physics.check_collision(): if self.physics.check_collision():
# the object fills the whole range of z0..z1 - we should issue a warning # the object fills the whole range of z0..z1 - we should issue a warning
next_point = Point(x.get(), y.get(), INFINITE) next_point = Point(x.get(), y.get(), self._safe_height)
if not self._boundary_warning_already_shown:
print >>sys.stderr, "WARNING: DropCutter exceed the height" \
+ " of the boundary box: using a safe height " \
+ "instead. This warning is reported only once."
self._boundary_warning_already_shown = True
else: else:
next_point = Point(x.get(), y.get(), dim_height.start) next_point = Point(x.get(), y.get(), dim_height.start)
else: else:
...@@ -127,7 +140,7 @@ class DropCutter: ...@@ -127,7 +140,7 @@ class DropCutter:
if order is None: if order is None:
order = ["x", "y"] order = ["x", "y"]
p = Point(x.get(), y.get(), dim_height.get()) p = Point(x.get(), y.get(), dim_height.get())
height_max = -INFINITE height_max = -self._safe_height
cut_max = None cut_max = None
triangle_max = None triangle_max = None
self.cutter.moveto(p) self.cutter.moveto(p)
......
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