瀏覽代碼

- optimized the FlatCAMCNCJob.on_plot_cb_click_table() plot function and solved a bug regarding having tools numbers not in sync with the cnc tool table

Marius Stanciu 7 年之前
父節點
當前提交
97c5c3fe1c
共有 2 個文件被更改,包括 6 次插入2 次删除
  1. 5 2
      FlatCAMObj.py
  2. 1 0
      README.md

+ 5 - 2
FlatCAMObj.py

@@ -4189,13 +4189,16 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
         cw_row = cw_index.row()
         cw_row = cw_index.row()
 
 
         self.shapes.clear(update=True)
         self.shapes.clear(update=True)
+
         for tooluid_key in self.cnc_tools:
         for tooluid_key in self.cnc_tools:
             tooldia = float('%.4f' % float(self.cnc_tools[tooluid_key]['tooldia']))
             tooldia = float('%.4f' % float(self.cnc_tools[tooluid_key]['tooldia']))
             gcode_parsed = self.cnc_tools[tooluid_key]['gcode_parsed']
             gcode_parsed = self.cnc_tools[tooluid_key]['gcode_parsed']
             # tool_uid = int(self.ui.cnc_tools_table.item(cw_row, 3).text())
             # tool_uid = int(self.ui.cnc_tools_table.item(cw_row, 3).text())
 
 
-            if self.ui.cnc_tools_table.cellWidget((tooluid_key - 1), 6).isChecked():
-                self.plot2(tooldia=tooldia, obj=self, visible=True, gcode_parsed=gcode_parsed)
+            for r in range(self.ui.cnc_tools_table.rowCount()):
+                if int(self.ui.cnc_tools_table.item(r, 5).text()) == int(tooluid_key):
+                    if self.ui.cnc_tools_table.cellWidget(r, 6).isChecked():
+                        self.plot2(tooldia=tooldia, obj=self, visible=True, gcode_parsed=gcode_parsed)
 
 
         self.shapes.redraw()
         self.shapes.redraw()
 
 

+ 1 - 0
README.md

@@ -23,6 +23,7 @@ CAD program, and create G-Code for Isolation routing.
 - fixed Freeform Cutout gaps issue (it was double than the value set)
 - fixed Freeform Cutout gaps issue (it was double than the value set)
 - added protection so the Cutout (either Freeform or Rectangular) cannot be done on a multigeo Geometry
 - added protection so the Cutout (either Freeform or Rectangular) cannot be done on a multigeo Geometry
 - added 2Sided Tool default values in Edit -> Preferences -> Tools
 - added 2Sided Tool default values in Edit -> Preferences -> Tools
+- optimized the FlatCAMCNCJob.on_plot_cb_click_table() plot function and solved a bug regarding having tools numbers not in sync with the cnc tool table
 
 
 28.01.2018
 28.01.2018