- 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

@@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta
=================================================
1.04.2021
- fixed bug in the Drilling Tool when there are tools without drill points
29.03.2021
- Milling Plugin - finished the polish functionality

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,6 +2082,7 @@ class ToolDrilling(AppTool, Excellon):
if toolchange is False:
tool_points = []
for tool in sel_tools:
if tool in points:
tool_points += points[tool]
# use the first tool in the selection as the tool that we are going to use
@@ -2117,6 +2119,8 @@ class ToolDrilling(AppTool, Excellon):
# ####################### TOOLCHANGE ACTIVE ######################################################
else:
for tool_id in sel_tools:
tool_points = []
if tool_id in points:
tool_points = points[tool_id]
used_tooldia = self.excellon_tools[tool_id]['tooldia']
@@ -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,

View File

@@ -6533,6 +6533,17 @@ class App(QtCore.QObject):
self.ui.notebook.setCurrentWidget(self.ui.properties_tab)
self.ui.notebook.removeTab(2)
# HACK: the content was removed but let's create it again
self.ui.plugin_tab = QtWidgets.QWidget()
self.ui.plugin_tab.setObjectName("plugin_tab")
self.ui.plugin_tab_layout = QtWidgets.QVBoxLayout(self.ui.plugin_tab)
self.ui.plugin_tab_layout.setContentsMargins(2, 2, 2, 2)
# self.notebook.addTab(self.plugin_tab, _("Tool"))
self.ui.plugin_scroll_area = VerticalScrollArea()
# self.plugin_scroll_area.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
self.ui.plugin_tab_layout.addWidget(self.ui.plugin_scroll_area)
# def on_close_notebook_tab(self):
# self.tool_shapes.clear(update=True)