Просмотр исходного кода

- added a new function (and shortcut key Escape) that when triggered it deselects all selected objects and delete the selection box(es)
- fixed bug in Excellon Gcode generation that made the toolchange X,Y always none regardless of the value in Preferences

Marius Stanciu 7 лет назад
Родитель
Сommit
2ee80990e5
6 измененных файлов с 32 добавлено и 23 удалено
  1. 4 0
      FlatCAMApp.py
  2. 17 8
      FlatCAMGUI.py
  3. 2 1
      FlatCAMObj.py
  4. 2 0
      README.md
  5. 1 1
      postprocessors/default.py
  6. 6 13
      tclCommands/TclCommandGeoCutout.py

+ 4 - 0
FlatCAMApp.py

@@ -3229,6 +3229,10 @@ class App(QtCore.QObject):
         self.general_defaults_form.general_gui_group.sel_draw_color_entry.set_value(new_val_sel)
         self.defaults['global_sel_draw_color'] = new_val_sel
 
+    def on_deselect_all(self):
+        self.collection.set_all_inactive()
+        self.delete_selection_shape()
+
     def on_workspace_modified(self):
         self.save_defaults(silent=True)
         self.plotcanvas.draw_workspace()

+ 17 - 8
FlatCAMGUI.py

@@ -988,6 +988,10 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
 			<td height="20"><strong>SPACE</strong></td>
 			<td>&nbsp;En(Dis)able Obj Plot</td>
 		</tr>
+		<tr height="20">
+			<td height="20"><strong>Escape</strong></td>
+			<td>&nbsp;Deselects all objects</td>
+		</tr>
 	</tbody>
 </table>
 
@@ -1539,7 +1543,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
                 self.app.on_file_saveproject()
 
             # Toggle Plot Area
-            if key == QtCore.Qt.Key_F10:
+            if key == QtCore.Qt.Key_F10 or key == 'F10':
                 self.app.on_toggle_plotarea()
 
             return
@@ -1647,16 +1651,16 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
                 return
 
             # Toggle Fullscreen
-            if key == QtCore.Qt.Key_F10:
+            if key == QtCore.Qt.Key_F10 or key == 'F10':
                 self.app.on_fullscreen()
                 return
         else:
             # Open Manual
-            if key == QtCore.Qt.Key_F1:
+            if key == QtCore.Qt.Key_F1 or key == 'F1':
                 webbrowser.open(self.app.manual_url)
 
             # Open Video Help
-            if key == QtCore.Qt.Key_F2:
+            if key == QtCore.Qt.Key_F2 or key == 'F2':
                 webbrowser.open(self.app.video_url)
 
             # Switch to Project Tab
@@ -1672,10 +1676,15 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
                 self.app.on_select_tab('tool')
 
             # Delete
-            if key == QtCore.Qt.Key_Delete and active:
-                # Delete via the application to
-                # ensure cleanup of the GUI
-                active.app.on_delete()
+            if key == QtCore.Qt.Key_Delete or key == 'Delete':
+                if active:
+                    # Delete via the application to
+                    # ensure cleanup of the GUI
+                    active.app.on_delete()
+
+            # Escape = Deselect All
+            if key == QtCore.Qt.Key_Escape or key == 'Escape':
+                self.app.on_deselect_all()
 
             # Space = Toggle Active/Inactive
             if key == QtCore.Qt.Key_Space:

+ 2 - 1
FlatCAMObj.py

@@ -1701,7 +1701,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
             job_obj.dwell = self.options["dwell"]
             job_obj.dwelltime = self.options["dwelltime"]
             job_obj.pp_excellon_name = pp_excellon_name
-            job_obj.toolchange_xy = self.app.defaults["excellon_toolchangexy"]
+
             job_obj.toolchange_xy_type = "excellon"
             job_obj.coords_decimals = int(self.app.defaults["cncjob_coords_decimals"])
             job_obj.fr_decimals = int(self.app.defaults["cncjob_fr_decimals"])
@@ -1740,6 +1740,7 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
             ret_val = job_obj.generate_from_excellon_by_tool(self, tools_csv,
                                                              drillz=self.options['drillz'],
                                                              toolchange=self.options["toolchange"],
+                                                             toolchangexy=self.app.defaults["excellon_toolchangexy"],
                                                              toolchangez=self.options["toolchangez"],
                                                              startz=self.options["startz"],
                                                              endz=self.options["endz"],

+ 2 - 0
README.md

@@ -23,6 +23,8 @@ CAD program, and create G-Code for Isolation routing.
 - renamed the theme to layout because it is really a layout change
 - added plot kind for CNC Job in the App Preferences
 - combined the geocutout and cutout_any TCL commands - work in progress
+- added a new function (and shortcut key Escape) that when triggered it deselects all selected objects and delete the selection box(es) 
+- fixed bug in Excellon Gcode generation that made the toolchange X,Y always none regardless of the value in Preferences
 
 5.02.3019
 

+ 1 - 1
postprocessors/default.py

@@ -45,7 +45,7 @@ class default(FlatCAMPostProc):
         gcode += '(Steps per circle: ' + str(p['steps_per_circle']) + ')\n'
 
         if str(p['options']['type']) == 'Excellon' or str(p['options']['type']) == 'Excellon Geometry':
-            gcode += '(Postprocessor Excellon: ' + str(p['pp_excellon_name']) + ')\n'
+            gcode += '(Postprocessor Excellon: ' + str(p['pp_excellon_name']) + ')\n' + '\n'
         else:
             gcode += '(Postprocessor Geometry: ' + str(p['pp_geometry_name']) + ')\n' + '\n'
 

+ 6 - 13
tclCommands/TclCommandGeoCutout.py

@@ -1,6 +1,6 @@
 from ObjectCollection import *
 from tclCommands.TclCommand import TclCommandSignaled
-
+from copy import deepcopy
 
 class TclCommandGeoCutout(TclCommandSignaled):
     """
@@ -124,21 +124,14 @@ class TclCommandGeoCutout(TclCommandSignaled):
         elif isinstance(cutout_obj, FlatCAMGerber):
 
             def geo_init(geo_obj, app_obj):
-                geo_obj.solid_geometry = obj_exteriors
+                try:
+                    geo_obj.solid_geometry = cutout_obj.isolation_geometry((dia / 2), iso_type=0)
+                except Exception as e:
+                    log.debug("TclCommandGeoCutout.execute() --> %s" % str(e))
+                    return 'fail'
 
             outname = cutout_obj.options["name"] + "_cutout"
-            cutout_obj.isolate(dia=dia, passes=1, overlap=1, combine=False, outname="_temp")
-            ext_obj = self.app.collection.get_by_name("_temp")
-
-            try:
-                obj_exteriors = ext_obj.get_exteriors()
-            except:
-                obj_exteriors = ext_obj.solid_geometry
-
             self.app.new_object('geometry', outname, geo_init)
-            self.app.collection.set_all_inactive()
-            self.app.collection.set_active("_temp")
-            self.app.on_delete()
 
             cutout_obj = self.app.collection.get_by_name(outname)
         else: