Commit e91e1d5a authored by sumpfralle's avatar sumpfralle

fixed progress counter for DropCutter

fixed calculation of stepping for toolpath generation (based on overlap and tool radius)
 * previously the calculation returned twice as many lines as required


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@568 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 60549c42
...@@ -97,7 +97,7 @@ class DropCutter: ...@@ -97,7 +97,7 @@ class DropCutter:
grid.append(zip(x_steps, [y] * (len(x_steps) + 1))) grid.append(zip(x_steps, [y] * (len(x_steps) + 1)))
dim_attrs = ["y", "x"] dim_attrs = ["y", "x"]
num_of_lines = len(grid) + 1 num_of_lines = len(grid)
num_of_grid_positions = num_of_x_lines * num_of_y_lines num_of_grid_positions = num_of_x_lines * num_of_y_lines
progress_counter = ProgressCounter(num_of_grid_positions, draw_callback) progress_counter = ProgressCounter(num_of_grid_positions, draw_callback)
current_line = 0 current_line = 0
......
...@@ -225,7 +225,8 @@ def generate_toolpath(model, tool_settings=None, ...@@ -225,7 +225,8 @@ def generate_toolpath(model, tool_settings=None,
if (overlap < 0) or (overlap >= 1): if (overlap < 0) or (overlap >= 1):
return "Invalid overlap value (%f): should be greater or equal 0 " \ return "Invalid overlap value (%f): should be greater or equal 0 " \
+ "and lower than 1" + "and lower than 1"
effective_toolradius =number(tool_settings["tool_radius"]) * (1 - overlap) # factor "2" since we are based on radius instead of diameter
stepping = 2 * number(tool_settings["tool_radius"]) * (1 - overlap)
if path_generator == "DropCutter": if path_generator == "DropCutter":
if direction == "x": if direction == "x":
direction_param = 0 direction_param = 0
...@@ -235,24 +236,22 @@ def generate_toolpath(model, tool_settings=None, ...@@ -235,24 +236,22 @@ def generate_toolpath(model, tool_settings=None,
return "Invalid direction value (%s): not one of %s" \ return "Invalid direction value (%s): not one of %s" \
% (direction, DIRECTIONS) % (direction, DIRECTIONS)
if safety_height < maxz: if safety_height < maxz:
print "%s / %s / %s / %s" % (safety_height, maxz, type(safety_height), type(maxz))
return ("Safety height (%.4f) is within the bounding box height " \ return ("Safety height (%.4f) is within the bounding box height " \
+ "(%.4f) - this can cause collisions of the tool with " \ + "(%.4f) - this can cause collisions of the tool with " \
+ "the material.") % (safety_height, maxz) + "the material.") % (safety_height, maxz)
toolpath = generator.GenerateToolPath(minx, maxx, miny, maxy, minz, toolpath = generator.GenerateToolPath(minx, maxx, miny, maxy, minz,
maxz, effective_toolradius, effective_toolradius, maxz, stepping, stepping, direction_param, callback)
direction_param, callback)
elif path_generator == "PushCutter": elif path_generator == "PushCutter":
if step_down > 0: if step_down > 0:
dz = step_down dz = step_down
else: else:
dz = maxz - minz dz = maxz - minz
if direction == "x": if direction == "x":
dx, dy = 0, effective_toolradius dx, dy = 0, stepping
elif direction == "y": elif direction == "y":
dx, dy = effective_toolradius, 0 dx, dy = stepping, 0
elif direction == "xy": elif direction == "xy":
dx, dy = effective_toolradius, effective_toolradius dx, dy = stepping, stepping
else: else:
return "Invalid direction (%s): not one of %s" \ return "Invalid direction (%s): not one of %s" \
% (direction, DIRECTIONS) % (direction, DIRECTIONS)
...@@ -264,8 +263,8 @@ def generate_toolpath(model, tool_settings=None, ...@@ -264,8 +263,8 @@ def generate_toolpath(model, tool_settings=None,
dz = step_down dz = step_down
else: else:
dz = maxz - minz dz = maxz - minz
toolpath = generator.GenerateToolPath(minz, maxz, effective_toolradius, toolpath = generator.GenerateToolPath(minz, maxz, stepping, dz,
dz, callback) callback)
return toolpath return toolpath
def _get_pathgenerator_instance(trimesh_model, contour_model, cutter, def _get_pathgenerator_instance(trimesh_model, contour_model, cutter,
......
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