diff --git a/FlatCAMApp.py b/FlatCAMApp.py index e1be9814..e06a211e 100644 --- a/FlatCAMApp.py +++ b/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: diff --git a/README.md b/README.md index 4d15d52e..c4358a4f 100644 --- a/README.md +++ b/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 diff --git a/flatcamTools/ToolMove.py b/flatcamTools/ToolMove.py index 7b6f9079..9b21c2da 100644 --- a/flatcamTools/ToolMove.py +++ b/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"