Przeglądaj źródła

- fixed a weird error that created a crash in the following scenario: create a new excellon, edit it, add some drills/slots, delete it without saving, create a new excellon, try to edit and a crash is issued due of a wrapped C++ error
- fixed bug selection in Excellon editor with a selection window in case that the number of selected items is even
- updated the default values to more convenient ones

Marius Stanciu 6 lat temu
rodzic
commit
bbc00c8f35
4 zmienionych plików z 59 dodań i 49 usunięć
  1. 40 41
      FlatCAMApp.py
  2. 3 0
      README.md
  3. 12 5
      flatcamEditors/FlatCAMExcEditor.py
  4. 4 3
      flatcamEditors/FlatCAMGrbEditor.py

+ 40 - 41
FlatCAMApp.py

@@ -763,16 +763,16 @@ class App(QtCore.QObject):
             "gerber_plot": True,
             "gerber_solid": True,
             "gerber_multicolored": False,
-            "gerber_isotooldia": 0.016,
+            "gerber_isotooldia": 0.00787402,
             "gerber_isopasses": 1,
-            "gerber_isooverlap": 0.15,
+            "gerber_isooverlap": 0.00393701,
 
             # Gerber Options
             "gerber_combine_passes": False,
             "gerber_milling_type": "cl",
-            "gerber_noncoppermargin": 0.1,
+            "gerber_noncoppermargin": 0.00393701,
             "gerber_noncopperrounded": False,
-            "gerber_bboxmargin": 0.1,
+            "gerber_bboxmargin": 0.00393701,
             "gerber_bboxrounded": False,
             "gerber_circle_steps": 128,
             "gerber_use_buffer_for_union": True,
@@ -805,9 +805,9 @@ class App(QtCore.QObject):
             "excellon_search_time": 3,
 
             # Excellon Options
-            "excellon_drillz": -0.1,
-            "excellon_travelz": 0.1,
-            "excellon_feedrate": 3.0,
+            "excellon_drillz": -0.0590551,
+            "excellon_travelz": 0.0787402,
+            "excellon_feedrate": 3.14961,
             "excellon_spindlespeed": None,
             "excellon_spindledir": 'CW',
             "excellon_dwell": False,
@@ -815,8 +815,8 @@ class App(QtCore.QObject):
             "excellon_toolchange": False,
             "excellon_toolchangez": 0.5,
             "excellon_ppname_e": 'default',
-            "excellon_tooldia": 0.016,
-            "excellon_slot_tooldia": 0.016,
+            "excellon_tooldia": 0.0314961,
+            "excellon_slot_tooldia": 0.0708661,
             "excellon_gcode_type": "drills",
 
             # Excellon Advanced Options
@@ -824,9 +824,9 @@ class App(QtCore.QObject):
             "excellon_toolchangexy": "0.0, 0.0",
             "excellon_startz": None,
             "excellon_endz": 0.5,
-            "excellon_feedrate_rapid": 3.0,
+            "excellon_feedrate_rapid": 3.14961,
             "excellon_z_pdepth": -0.02,
-            "excellon_feedrate_probe": 3.0,
+            "excellon_feedrate_probe": 3.14961,
             "excellon_f_plunge": False,
             "excellon_f_retract": False,
 
@@ -862,19 +862,19 @@ class App(QtCore.QObject):
             # Geometry General
             "geometry_plot": True,
             "geometry_circle_steps": 128,
-            "geometry_cnctooldia": "0.016",
+            "geometry_cnctooldia": "0.0944882",
 
             # Geometry Options
-            "geometry_cutz": -0.002,
+            "geometry_cutz": -0.0944882,
             "geometry_vtipdia": 0.1,
             "geometry_vtipangle": 30,
             "geometry_multidepth": False,
-            "geometry_depthperpass": 0.002,
-            "geometry_travelz": 0.1,
+            "geometry_depthperpass": 0.0314961,
+            "geometry_travelz": 0.0787402,
             "geometry_toolchange": False,
             "geometry_toolchangez": 0.5,
-            "geometry_feedrate": 3.0,
-            "geometry_feedrate_z": 3.0,
+            "geometry_feedrate": 3.14961,
+            "geometry_feedrate_z": 3.14961,
             "geometry_spindlespeed": None,
             "geometry_spindledir": 'CW',
             "geometry_dwell": False,
@@ -885,11 +885,11 @@ class App(QtCore.QObject):
             "geometry_toolchangexy": "0.0, 0.0",
             "geometry_startz": None,
             "geometry_endz": 0.5,
-            "geometry_feedrate_rapid": 3.0,
+            "geometry_feedrate_rapid": 3.14961,
             "geometry_extracut": False,
             "geometry_z_pdepth": -0.02,
             "geometry_f_plunge": False,
-            "geometry_feedrate_probe": 3.0,
+            "geometry_feedrate_probe": 3.14961,
             "geometry_segx": 0.0,
             "geometry_segy": 0.0,
 
@@ -917,7 +917,7 @@ class App(QtCore.QObject):
 
             "tools_ncctools": "0.0393701, 0.019685",
             "tools_nccoverlap": 0.015748,
-            "tools_nccmargin": 0.00393701,
+            "tools_nccmargin": 0.0393701,
             "tools_nccmethod": "seed",
             "tools_nccconnect": True,
             "tools_ncccontour": True,
@@ -926,15 +926,15 @@ class App(QtCore.QObject):
             "tools_ncc_offset_value": 0.0000,
             "tools_nccref": 'itself',
 
-            "tools_cutouttooldia": 0.00393701,
+            "tools_cutouttooldia": 0.0944882,
             "tools_cutoutkind": "single",
             "tools_cutoutmargin": 0.00393701,
-            "tools_cutoutgapsize": 0.005905512,
-            "tools_gaps_ff": "8",
+            "tools_cutoutgapsize": 0.15748,
+            "tools_gaps_ff": "4",
             "tools_cutout_convexshape": False,
 
-            "tools_painttooldia": 0.07,
-            "tools_paintoverlap": 0.15,
+            "tools_painttooldia": 0.023622,
+            "tools_paintoverlap": 0.015748,
             "tools_paintmargin": 0.0,
             "tools_paintmethod": "seed",
             "tools_selectmethod": "single",
@@ -2371,6 +2371,12 @@ class App(QtCore.QObject):
             # store the Geometry Editor Toolbar visibility before entering in the Editor
             self.geo_editor.toolbar_old_state = True if self.ui.geo_edit_toolbar.isVisible() else False
 
+            # we set the notebook to hidden
+            self.ui.splitter.setSizes([0, 1])
+
+            # set call source to the Editor we go into
+            self.call_source = 'geo_editor'
+
             if edited_object.multigeo is True:
                 edited_tools = [int(x.text()) for x in edited_object.ui.geo_tools_table.selectedItems()]
                 if len(edited_tools) > 1:
@@ -2392,16 +2398,9 @@ class App(QtCore.QObject):
             else:
                 self.geo_editor.edit_fcgeometry(edited_object)
 
-            # we set the notebook to hidden
-            self.ui.splitter.setSizes([0, 1])
-
-            # set call source to the Editor we go into
-            self.call_source = 'geo_editor'
-
         elif isinstance(edited_object, FlatCAMExcellon):
             # store the Excellon Editor Toolbar visibility before entering in the Editor
             self.exc_editor.toolbar_old_state = True if self.ui.exc_edit_toolbar.isVisible() else False
-            self.exc_editor.edit_fcexcellon(edited_object)
 
             # set call source to the Editor we go into
             self.call_source = 'exc_editor'
@@ -2409,10 +2408,11 @@ class App(QtCore.QObject):
             if self.ui.splitter.sizes()[0] == 0:
                 self.ui.splitter.setSizes([1, 1])
 
+            self.exc_editor.edit_fcexcellon(edited_object)
+
         elif isinstance(edited_object, FlatCAMGerber):
             # store the Gerber Editor Toolbar visibility before entering in the Editor
             self.grb_editor.toolbar_old_state = True if self.ui.grb_edit_toolbar.isVisible() else False
-            self.grb_editor.edit_fcgerber(edited_object)
 
             # set call source to the Editor we go into
             self.call_source = 'grb_editor'
@@ -2420,7 +2420,9 @@ class App(QtCore.QObject):
             if self.ui.splitter.sizes()[0] == 0:
                 self.ui.splitter.setSizes([1, 1])
 
-        # # make sure that we can't select another object while in Editor Mode:
+            self.grb_editor.edit_fcgerber(edited_object)
+
+        # make sure that we can't select another object while in Editor Mode:
         # self.collection.view.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
         self.ui.project_frame.setDisabled(True)
 
@@ -4974,7 +4976,8 @@ class App(QtCore.QObject):
 
         # Make sure that the deletion will happen only after the Editor is no longer active otherwise we might delete
         # a geometry object before we update it.
-        if self.geo_editor.editor_active is False and self.exc_editor.editor_active is False:
+        if self.geo_editor.editor_active is False and self.exc_editor.editor_active is False \
+                and self.grb_editor.editor_active is False:
             if self.defaults["global_delete_confirmation"] is True:
                 msgbox = QtWidgets.QMessageBox()
                 msgbox.setWindowTitle(_("Delete objects"))
@@ -5026,16 +5029,12 @@ class App(QtCore.QObject):
             self.log.debug("Nothing selected for deletion")
             return
 
-        # Remove plot
-        # self.plotcanvas.figure.delaxes(self.collection.get_active().axes)
-        # self.plotcanvas.auto_adjust_axes()
+        # Remove from dictionary
+        self.collection.delete_active()
 
         # Clear form
         self.setup_component_editor()
 
-        # Remove from dictionary
-        self.collection.delete_active()
-
         self.inform.emit("Object deleted: %s" % name)
 
     def on_set_origin(self):

+ 3 - 0
README.md

@@ -12,6 +12,9 @@ CAD program, and create G-Code for Isolation routing.
 16.08.2019
 
 - working in Excellon Editor to Tool Resize to consider the slots, too
+- fixed a weird error that created a crash in the following scenario: create a new excellon, edit it, add some drills/slots, delete it without saving, create a new excellon, try to edit and a crash is issued due of a wrapped C++ error
+- fixed bug selection in Excellon editor with a selection window in case that the number of selected items is even
+- updated the default values to more convenient ones
 
 15.08.2019
 

+ 12 - 5
flatcamEditors/FlatCAMExcEditor.py

@@ -3358,11 +3358,18 @@ class FlatCAMExcEditor(QtCore.QObject):
         for storage in self.storage_dict:
             for shape_s in self.selected:
                 if shape_s in self.storage_dict[storage].get_objects():
-                    for key in self.tool2tooldia:
-                        if self.tool2tooldia[key] == storage:
-                            item = self.tools_table_exc.item((key - 1), 1)
-                            self.tools_table_exc.setCurrentItem(item)
-                            self.last_tool_selected = int(key)
+                    for key_tool_nr in self.tool2tooldia:
+                        if self.tool2tooldia[key_tool_nr] == storage:
+                            row_to_sel = key_tool_nr - 1
+                            # item = self.tools_table_exc.item(row_to_sel, 1)
+                            # self.tools_table_exc.setCurrentItem(item)
+                            # item.setSelected(True)
+
+                            # if the row to be selected is not already in the selected rows then select it
+                            # otherwise don't do it as it seems that we have a toggle effect
+                            if row_to_sel not in set(index.row() for index in self.tools_table_exc.selectedIndexes()):
+                                self.tools_table_exc.selectRow(row_to_sel)
+                            self.last_tool_selected = int(key_tool_nr)
 
         self.tools_table_exc.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
 

+ 4 - 3
flatcamEditors/FlatCAMGrbEditor.py

@@ -4205,9 +4205,10 @@ class FlatCAMGrbEditor(QtCore.QObject):
         # select the aperture code of the selected geometry, in the tool table
         self.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
         for aper in sel_aperture:
-            for row in range(self.apertures_table.rowCount()):
-                if str(aper) == self.apertures_table.item(row, 1).text():
-                    self.apertures_table.selectRow(row)
+            for row_to_sel in range(self.apertures_table.rowCount()):
+                if str(aper) == self.apertures_table.item(row_to_sel, 1).text():
+                    if row_to_sel not in set(index.row() for index in self.apertures_table.selectedIndexes()):
+                        self.apertures_table.selectRow(row_to_sel)
                     self.last_aperture_selected = aper
         self.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)