From 1c2314149c27793878c30416289608fcb22995c5 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Wed, 25 Nov 2020 01:40:56 +0200 Subject: [PATCH] - added a way to keep compatibility with old projects --- CHANGELOG.md | 1 + appObjects/AppObject.py | 8 +++++--- appObjects/FlatCAMCNCJob.py | 12 +++++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 757e3080..bfd66227 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ CHANGELOG for FlatCAM beta - fixed an issue for importing DXF as Geometry when the DXF geometry is a single line - updated the convert_any2geo() method such that resulting geometry objects have the tools attribute required in the newer versions of the app +- added a way to keep compatibility with old projects 21.11.2020 diff --git a/appObjects/AppObject.py b/appObjects/AppObject.py index 67e8fb5d..5377b0e1 100644 --- a/appObjects/AppObject.py +++ b/appObjects/AppObject.py @@ -138,13 +138,15 @@ class AppObject(QtCore.QObject): # add some of the FlatCAM Tools related properties if kind == 'excellon': for option in self.app.options: - if option.find('tools_drill_') == 0 or option.find('tools_mill_') == 0: + if option.find('tools_drill_') == 0: obj.options[option] = self.app.options[option] if kind == 'gerber': for option in self.app.options: - if option.find('tools_iso_') == 0 or option.find('tools_mill_') == 0: + if option.find('tools_iso_') == 0: obj.options[option] = self.app.options[option] - if kind == 'geometry': + + # the milling options should be inherited by all manufacturing objects + if kind in ['excellon', 'gerber', 'geometry']: for option in self.app.options: if option.find('tools_mill_') == 0: obj.options[option] = self.app.options[option] diff --git a/appObjects/FlatCAMCNCJob.py b/appObjects/FlatCAMCNCJob.py index 5db4ef13..3ceafe90 100644 --- a/appObjects/FlatCAMCNCJob.py +++ b/appObjects/FlatCAMCNCJob.py @@ -2230,9 +2230,15 @@ class CNCJobObject(FlatCAMObj, CNCjob): # if this dict is not empty then the object is an Excellon object if self.exc_cnc_tools: first_key = next(iter(self.exc_cnc_tools)) - include_header = self.app.preprocessors[ - self.exc_cnc_tools[first_key]['data']['tools_drill_ppname_e'] - ].include_header + try: + include_header = self.app.preprocessors[ + self.exc_cnc_tools[first_key]['data']['tools_drill_ppname_e'] + ].include_header + except KeyError: + # for older loaded projects + include_header = self.app.preprocessors[ + self.exc_cnc_tools[first_key]['data']['ppname_e'] + ].include_header gcode = '' if include_header is False: