- fixed bug in the Drilling Tool when there are tools without drill points

This commit is contained in:
Marius Stanciu
2021-04-01 19:34:46 +03:00
committed by Marius
parent 71e16aa13c
commit c2677cac26
3 changed files with 26 additions and 3 deletions

View File

@@ -1828,6 +1828,7 @@ class ToolDrilling(AppTool, Excellon):
points[tool_key].append(drill_pt)
except KeyError:
points[tool_key] = [drill_pt]
log.debug("Found %d TOOLS with drills." % len(points))
# #############################################################################################################
@@ -2081,7 +2082,8 @@ class ToolDrilling(AppTool, Excellon):
if toolchange is False:
tool_points = []
for tool in sel_tools:
tool_points += points[tool]
if tool in points:
tool_points += points[tool]
# use the first tool in the selection as the tool that we are going to use
used_tool = sel_tools[0]
@@ -2117,7 +2119,9 @@ class ToolDrilling(AppTool, Excellon):
# ####################### TOOLCHANGE ACTIVE ######################################################
else:
for tool_id in sel_tools:
tool_points = points[tool_id]
tool_points = []
if tool_id in points:
tool_points = points[tool_id]
used_tooldia = self.excellon_tools[tool_id]['tooldia']
# those are used by the preprocessors to display data on the toolchange line
@@ -2127,7 +2131,7 @@ class ToolDrilling(AppTool, Excellon):
# if slots are converted to drill for this tool, update the number of drills and make slots nr zero
convert_slots = self.excellon_tools[tool_id]['data']['tools_drill_drill_slots']
if convert_slots is True:
nr_drills = len(points[tool_id])
nr_drills = len(tool_points)
nr_slots = 0
job_obj.tools[used_tooldia]['nr_drills'] = nr_drills
job_obj.tools[used_tooldia]['nr_slots'] = nr_slots
@@ -2138,6 +2142,10 @@ class ToolDrilling(AppTool, Excellon):
is_last_tool = True if tool_id == sel_tools[-1] else False
is_first_tool = True if tool_id == sel_tools[0] else False
if not tool_points:
self.app.log.debug("%s" % "Tool has no drill points. Skipping.")
continue
# Generate Gcode for the current tool
tool_gcode, last_pt, start_gcode = job_obj.excellon_tool_gcode_gen(tool_id, tool_points,
self.excellon_tools,