Jelajahi Sumber

- on Set Origin, Move to Origin and Move actions for Gerber and Excellon objects the source file will be also updated (the export functions will export an updated object)

Marius Stanciu 6 tahun lalu
induk
melakukan
72ce53182d
3 mengubah file dengan 36 tambahan dan 1 penghapusan
  1. 25 1
      FlatCAMApp.py
  2. 1 0
      README.md
  3. 10 0
      flatcamTools/ToolMove.py

+ 25 - 1
FlatCAMApp.py

@@ -7307,7 +7307,9 @@ class App(QtCore.QObject):
 
         def worker_task():
             with self.proc_container.new(_("Setting Origin...")):
-                for obj in self.collection.get_list():
+                obj_list = self.collection.get_list()
+
+                for obj in obj_list:
                     obj.offset((x, y))
                     self.object_changed.emit(obj)
 
@@ -7318,6 +7320,17 @@ class App(QtCore.QObject):
                     obj.options['xmax'] = c
                     obj.options['ymax'] = d
                 self.inform.emit('[success] %s...' % _('Origin set'))
+
+                for obj in obj_list:
+                    out_name = obj.options["name"]
+
+                    if obj.kind == 'gerber':
+                        obj.source_file = self.export_gerber(
+                            obj_name=out_name, filename=None, local_use=obj, use_thread=False)
+                    elif obj.kind == 'excellon':
+                        obj.source_file = self.export_excellon(
+                            obj_name=out_name, filename=None, local_use=obj, use_thread=False)
+
                 if noplot_sig is False:
                     self.replot_signal.emit([])
 
@@ -7400,6 +7413,17 @@ class App(QtCore.QObject):
 
                 for obj in obj_list:
                     obj.plot()
+
+                for obj in obj_list:
+                    out_name = obj.options["name"]
+
+                    if obj.kind == 'gerber':
+                        obj.source_file = self.export_gerber(
+                            obj_name=out_name, filename=None, local_use=obj, use_thread=False)
+                    elif obj.kind == 'excellon':
+                        obj.source_file = self.export_excellon(
+                            obj_name=out_name, filename=None, local_use=obj, use_thread=False)
+
                 self.inform.emit('[success] %s...' % _('Origin set'))
 
         if use_thread is True:

+ 1 - 0
README.md

@@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing.
 
 - fixed some issues in the Geometry Editor; the jump sigmal disconnect was failing for repeated Editor tool operation
 - fixed an issue in Gerber Editor where the multiprocessing pool was reported as closed and an ValueError exception was raised in a certain scneraio
+- on Set Origin, Move to Origin and Move actions for Gerber and Excellon objects the source file will be also updated (the export functions will export an updated object)
 
 17.02.2020
 

+ 10 - 0
flatcamTools/ToolMove.py

@@ -188,6 +188,16 @@ class ToolMove(FlatCAMTool):
                                     sel_obj.options['ymin'] = b
                                     sel_obj.options['xmax'] = c
                                     sel_obj.options['ymax'] = d
+
+                                # update the source_file with the new positions
+                                for sel_obj in obj_list:
+                                    out_name = sel_obj.options["name"]
+                                    if sel_obj.kind == 'gerber':
+                                        sel_obj.source_file = self.app.export_gerber(
+                                            obj_name=out_name, filename=None, local_use=sel_obj, use_thread=False)
+                                    elif sel_obj.kind == 'excellon':
+                                        sel_obj.source_file = self.app.export_excellon(
+                                            obj_name=out_name, filename=None, local_use=sel_obj, use_thread=False)
                             except Exception as e:
                                 log.debug('[ERROR_NOTCL] %s --> %s' % ('ToolMove.on_left_click()', str(e)))
                                 return "fail"