Commit dcb47576 authored by sumpfralle's avatar sumpfralle

fixed lowest layer for engraving: proper dropcutter steps


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1169 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 68ed74fa
...@@ -49,8 +49,6 @@ class DropCutter(object): ...@@ -49,8 +49,6 @@ class DropCutter(object):
def GenerateToolPath(self, cutter, models, motion_grid, minz=None, maxz=None, draw_callback=None): def GenerateToolPath(self, cutter, models, motion_grid, minz=None, maxz=None, draw_callback=None):
quit_requested = False quit_requested = False
model = pycam.Geometry.Model.get_combined_model(models) model = pycam.Geometry.Model.get_combined_model(models)
if not model:
return
# Transfer the grid (a generator) into a list of lists and count the # Transfer the grid (a generator) into a list of lists and count the
# items. # items.
......
...@@ -260,9 +260,9 @@ def generate_toolpath(model, tool_settings=None, ...@@ -260,9 +260,9 @@ def generate_toolpath(model, tool_settings=None,
"conventional": pycam.Toolpath.MotionGrid.MILLING_STYLE_CONVENTIONAL, "conventional": pycam.Toolpath.MotionGrid.MILLING_STYLE_CONVENTIONAL,
"climb": pycam.Toolpath.MotionGrid.MILLING_STYLE_CLIMB} "climb": pycam.Toolpath.MotionGrid.MILLING_STYLE_CLIMB}
if path_generator in ("DropCutter", "PushCutter"): if path_generator in ("DropCutter", "PushCutter"):
motion_grid = pycam.Toolpath.MotionGrid.get_fixed_grid(bounds, motion_grid = pycam.Toolpath.MotionGrid.get_fixed_grid(
layer_distance, line_stepping, step_width=step_width, (bounds_low, bounds_high), layer_distance, line_stepping,
grid_direction=direction_dict[direction], step_width=step_width, grid_direction=direction_dict[direction],
milling_style=milling_style_grid[milling_style]) milling_style=milling_style_grid[milling_style])
if path_generator == "DropCutter": if path_generator == "DropCutter":
toolpath = generator.GenerateToolPath(motion_grid, minz, maxz, toolpath = generator.GenerateToolPath(motion_grid, minz, maxz,
......
...@@ -158,16 +158,11 @@ def get_fixed_grid_layer(minx, maxx, miny, maxy, z, line_distance, ...@@ -158,16 +158,11 @@ def get_fixed_grid_layer(minx, maxx, miny, maxy, z, line_distance,
return result, end_position return result, end_position
return get_lines(start, end, end_position) return get_lines(start, end, end_position)
def get_fixed_grid(bounds, layer_distance, line_distance=None, step_width=None, def get_fixed_grid((low, high), layer_distance, line_distance=None, step_width=None,
grid_direction=GRID_DIRECTION_X, milling_style=MILLING_STYLE_IGNORE, grid_direction=GRID_DIRECTION_X, milling_style=MILLING_STYLE_IGNORE,
start_position=START_Z): start_position=START_Z):
""" Calculate the grid positions for toolpath moves """ Calculate the grid positions for toolpath moves
""" """
#TODO: remove the obsolete "get_absolute_limits" call
if hasattr(bounds, "get_absolute_limits"):
low, high = bounds.get_absolute_limits()
else:
low, high = bounds
if isiterable(layer_distance): if isiterable(layer_distance):
layers = layer_distance layers = layer_distance
elif layer_distance is None: elif layer_distance is None:
...@@ -232,19 +227,19 @@ def get_lines_layer(lines, z, last_z=None, step_width=None, ...@@ -232,19 +227,19 @@ def get_lines_layer(lines, z, last_z=None, step_width=None,
"%s / %s / %s / %s" % (line.p1, line.p2, z, last_z)) "%s / %s / %s / %s" % (line.p1, line.p2, z, last_z))
# process all projected lines # process all projected lines
for line in projected_lines: for line in projected_lines:
points = []
if step_width is None: if step_width is None:
yield (line.p1, line.p2) points.append(line.p1)
points.append(line.p2)
else: else:
if isiterable(step_width): if isiterable(step_width):
steps = step_width steps = step_width
else: else:
steps = floatrange(0.0, line.len, inc=step_width) steps = floatrange(0.0, line.len, inc=step_width)
prior = None
for step in steps: for step in steps:
next_point = line.p1.add(line.dir.mul(step)) next_point = line.p1.add(line.dir.mul(step))
if not prior is None: points.append(next_point)
yield (prior, next_point) yield points
prior = next_point
def _get_sorted_polygons(models, callback=None): def _get_sorted_polygons(models, callback=None):
# Sort the polygons according to their directions (first inside, then # Sort the polygons according to their directions (first inside, then
...@@ -261,14 +256,9 @@ def _get_sorted_polygons(models, callback=None): ...@@ -261,14 +256,9 @@ def _get_sorted_polygons(models, callback=None):
outer_sorter = PolygonSorter(outer_polys, callback=callback) outer_sorter = PolygonSorter(outer_polys, callback=callback)
return inner_sorter.get_polygons() + outer_sorter.get_polygons() return inner_sorter.get_polygons() + outer_sorter.get_polygons()
def get_lines_grid(models, bounds, layer_distance, line_distance=None, def get_lines_grid(models, (low, high), layer_distance, line_distance=None,
step_width=None, milling_style=MILLING_STYLE_CONVENTIONAL, step_width=None, milling_style=MILLING_STYLE_CONVENTIONAL,
start_position=START_Z, callback=None): start_position=START_Z, callback=None):
#TODO: remove the obsolete "get_absolute_limits" call
if hasattr(bounds, "get_absolute_limits"):
low, high = bounds.get_absolute_limits()
else:
low, high = bounds
# the lower limit is never below the model # the lower limit is never below the model
polygons = _get_sorted_polygons(models, callback=callback) polygons = _get_sorted_polygons(models, callback=callback)
if polygons: if polygons:
......
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