Commit 1a73f35f authored by sumpfralle's avatar sumpfralle

r684@erker: lars | 2010-02-18 04:01:41 +0100

 make sure that the toolpath always covers the outermost bounding box limit, even if the step width is not an integer divider of the bounding dimension


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@142 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent e252cdc5
......@@ -663,6 +663,7 @@ class ProjectGui:
self.update_physics()
# TODO: check, why this offset is used
offset = radius/2
minx = float(self.settings.get("minx"))-offset
......
......@@ -12,10 +12,13 @@ class Dimension:
self.downward = start > end
self.value = 0.0
def check_bounds(self, value=None):
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:
......@@ -64,12 +67,14 @@ class DropCutter:
dim_height.set(dim_height.start)
pa.new_direction(direction)
dims[1].set(dims[1].start)
while dims[1].check_bounds():
finished_plane = False
while not finished_plane:
finished_line = False
dims[0].set(dims[0].start)
pa.new_scanline()
self._triangle_last = None
self._cut_last = None
while dims[0].check_bounds():
while not finished_line:
if self.physics:
points = self.get_max_height_with_ode(dims[x], dims[y], dim_height, order=dim_attrs[:])
else:
......@@ -83,9 +88,27 @@ class DropCutter:
dims[0].shift(d0)
# make sure, that the we also handle the outmost border of the bounding box
if dims[0].check_bounds(tolerance=d0):
# check if we are still within the strict limits
if not dims[0].check_bounds():
# we crossed the maximum, but we are still within step width
dims[0].set(dims[0].end)
else:
finished_line = True
pa.end_scanline()
dims[1].shift(d1)
# make sure, that the we also handle the outmost border of the bounding box
if dims[1].check_bounds(tolerance=d1):
# check if we are still within the strict limits
if not dims[1].check_bounds():
# we crossed the maximum, but we are still within step width
dims[1].set(dims[1].end)
else:
finished_plane = True
pa.end_direction()
pa.finish()
......
......@@ -59,6 +59,10 @@ class PushCutter:
paths += self.pa.paths
z -= dz
if (z < minz) and (z + dz > minz):
# never skip the outermost bounding limit - reduce the step size if required
z = minz
if DEBUG_PUSHCUTTER2:
self.svg.fill('none')
self.svg.stroke('black')
......@@ -247,10 +251,16 @@ class PushCutter:
if dx != 0:
x += dx
# never skip the outermost bounding limit - reduce the step size if required
if (x > maxx) and (x - dx < maxx):
x = maxx
else:
x = minx
if dy != 0:
y += dy
# never skip the outermost bounding limit - reduce the step size if required
if (y > maxy) and (y - dy < maxy):
y = maxy
else:
y = miny
......
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