Commit dea5cfe3 authored by sumpfralle's avatar sumpfralle

fixed small migration issues of path generators


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1152 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent d1ba6ef7
...@@ -79,7 +79,8 @@ class EngraveCutter(object): ...@@ -79,7 +79,8 @@ class EngraveCutter(object):
if quit_requested: if quit_requested:
return self.pa_push.paths return self.pa_push.paths
drop_generator = pycam.PathGenerators.PushCutter(self.pa_drop) drop_generator = pycam.PathGenerators.DropCutter.DropCutter(self.pa_drop,
physics=self.physics)
drop_layers = motion_grid[-1:] drop_layers = motion_grid[-1:]
if draw_callback: if draw_callback:
draw_callback(text="Engrave: processing layer" + \ draw_callback(text="Engrave: processing layer" + \
......
...@@ -112,18 +112,10 @@ class PushCutter(object): ...@@ -112,18 +112,10 @@ class PushCutter(object):
def GenerateToolPathSlice(self, cutter, models, layer_grid, draw_callback=None, def GenerateToolPathSlice(self, cutter, models, layer_grid, draw_callback=None,
progress_counter=None): progress_counter=None):
""" only dx or (exclusive!) dy may be bigger than zero # settings for calculation of depth
"""
# max_deviation_x = dx/accuracy
accuracy = 20 accuracy = 20
max_depth = 20 max_depth = 20
min_depth = 4
# calculate the required number of steps in each direction
distance = layer_grid[0][-1].sub(layer_grid[0][0]).norm
step_width = distance / len(layer_grid[0])
depth = math.log(accuracy * distance / step_width) / math.log(2)
depth = max(ceil(depth), 4)
depth = min(depth, max_depth)
# the ContourCutter pathprocessor does not work with combined models # the ContourCutter pathprocessor does not work with combined models
if self._use_polygon_extractor: if self._use_polygon_extractor:
...@@ -134,6 +126,11 @@ class PushCutter(object): ...@@ -134,6 +126,11 @@ class PushCutter(object):
args = [] args = []
for line in layer_grid: for line in layer_grid:
p1, p2 = line p1, p2 = line
# calculate the required calculation depth (recursion)
distance = p2.sub(p1).norm
# TODO: accessing cutter.radius here is slightly ugly
depth = math.log(accuracy * distance / cutter.radius) / math.log(2)
depth = min(max(ceil(depth), 4), max_depth)
args.append((p1, p2, depth, models, cutter, self.physics)) args.append((p1, p2, depth, models, cutter, self.physics))
for points in run_in_parallel(_process_one_line, args, for points in run_in_parallel(_process_one_line, args,
......
...@@ -42,7 +42,9 @@ class Hit(object): ...@@ -42,7 +42,9 @@ class Hit(object):
def get_free_paths_triangles(models, cutter, p1, p2, return_triangles=False): def get_free_paths_triangles(models, cutter, p1, p2, return_triangles=False):
if len(models) == 1: if (len(models) == 0) or ((len(models) == 1) and (models[0] is None)):
return (p1, p2)
elif len(models) == 1:
# only one model is left - just continue # only one model is left - just continue
model = models[0] model = models[0]
else: else:
...@@ -224,6 +226,8 @@ def get_max_height_ode(physics, x, y, minz, maxz): ...@@ -224,6 +226,8 @@ def get_max_height_ode(physics, x, y, minz, maxz):
return Point(x, y, safe_z) return Point(x, y, safe_z)
def get_max_height_triangles(model, cutter, x, y, minz, maxz): def get_max_height_triangles(model, cutter, x, y, minz, maxz):
if model is None:
return Point(x, y, minz)
p = Point(x, y, maxz) p = Point(x, y, maxz)
height_max = None height_max = None
box_x_min = cutter.get_minx(p) box_x_min = cutter.get_minx(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