- allow the old projects to be loaded without crashing the app, although the load is incomplete
This commit is contained in:
@@ -14,6 +14,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
- small fix in the Toolchange_Manual preprocessor
|
- small fix in the Toolchange_Manual preprocessor
|
||||||
- Drilling Plugin - added in the UI the toolchange X,Y parameter and made it to work as expected
|
- Drilling Plugin - added in the UI the toolchange X,Y parameter and made it to work as expected
|
||||||
- Milling Plugin - added in the UI the toolchange X,Y parameter and made it to work as expected
|
- Milling Plugin - added in the UI the toolchange X,Y parameter and made it to work as expected
|
||||||
|
- allow the old projects to be loaded without crashing the app, although the load is incomplete
|
||||||
|
|
||||||
13.03.2021
|
13.03.2021
|
||||||
|
|
||||||
|
|||||||
@@ -297,6 +297,9 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
|||||||
self.ui.cnc_tools_table.setMaximumHeight(self.ui.cnc_tools_table.getHeight())
|
self.ui.cnc_tools_table.setMaximumHeight(self.ui.cnc_tools_table.getHeight())
|
||||||
|
|
||||||
def build_excellon_cnc_tools(self):
|
def build_excellon_cnc_tools(self):
|
||||||
|
# for the case that self.tools is empty: old projects
|
||||||
|
if not self.tools:
|
||||||
|
return
|
||||||
|
|
||||||
n = len(self.tools)
|
n = len(self.tools)
|
||||||
self.ui.exc_cnc_tools_table.setRowCount(n)
|
self.ui.exc_cnc_tools_table.setRowCount(n)
|
||||||
@@ -925,6 +928,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
|||||||
|
|
||||||
# if this dict is not empty then the object is an Excellon object
|
# if this dict is not empty then the object is an Excellon object
|
||||||
if self.options['type'].lower() == 'excellon':
|
if self.options['type'].lower() == 'excellon':
|
||||||
|
# for the case that self.tools is empty: old projects
|
||||||
|
try:
|
||||||
first_key = next(iter(self.tools))
|
first_key = next(iter(self.tools))
|
||||||
try:
|
try:
|
||||||
include_header = self.app.preprocessors[
|
include_header = self.app.preprocessors[
|
||||||
@@ -935,6 +940,9 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
|||||||
include_header = self.app.preprocessors[
|
include_header = self.app.preprocessors[
|
||||||
self.tools[first_key]['data']['ppname_e']
|
self.tools[first_key]['data']['ppname_e']
|
||||||
].include_header
|
].include_header
|
||||||
|
except TypeError:
|
||||||
|
# when self.tools is empty - old projects
|
||||||
|
include_header = self.app.preprocessors['default'].include_header
|
||||||
|
|
||||||
gcode = ''
|
gcode = ''
|
||||||
if include_header is False:
|
if include_header is False:
|
||||||
@@ -965,6 +973,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
|||||||
|
|
||||||
# detect if using multi-tool and make the Gcode summation correctly for each case
|
# detect if using multi-tool and make the Gcode summation correctly for each case
|
||||||
if self.multitool is True:
|
if self.multitool is True:
|
||||||
|
# for the case that self.tools is empty: old projects
|
||||||
|
try:
|
||||||
if self.options['type'].lower() == 'excellon':
|
if self.options['type'].lower() == 'excellon':
|
||||||
for tooluid_key in self.tools:
|
for tooluid_key in self.tools:
|
||||||
for key, value in self.tools[tooluid_key].items():
|
for key, value in self.tools[tooluid_key].items():
|
||||||
@@ -977,6 +987,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
|||||||
if key == 'gcode' and value:
|
if key == 'gcode' and value:
|
||||||
gcode += value
|
gcode += value
|
||||||
break
|
break
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
gcode += self.gcode
|
gcode += self.gcode
|
||||||
|
|
||||||
@@ -984,6 +996,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
|||||||
|
|
||||||
# detect if using a HPGL preprocessor
|
# detect if using a HPGL preprocessor
|
||||||
hpgl = False
|
hpgl = False
|
||||||
|
# for the case that self.tools is empty: old projects
|
||||||
|
try:
|
||||||
if self.options['type'].lower() == 'geometry':
|
if self.options['type'].lower() == 'geometry':
|
||||||
for key in self.cnc_tools:
|
for key in self.cnc_tools:
|
||||||
if 'tools_mill_ppname_g' in self.cnc_tools[key]['data']:
|
if 'tools_mill_ppname_g' in self.cnc_tools[key]['data']:
|
||||||
@@ -996,6 +1010,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
|||||||
if 'hpgl' in self.tools[key]['data']['ppname_e']:
|
if 'hpgl' in self.tools[key]['data']['ppname_e']:
|
||||||
hpgl = True
|
hpgl = True
|
||||||
break
|
break
|
||||||
|
except TypeError:
|
||||||
|
hpgl = False
|
||||||
|
|
||||||
if hpgl:
|
if hpgl:
|
||||||
processed_body_gcode = ''
|
processed_body_gcode = ''
|
||||||
|
|||||||
Reference in New Issue
Block a user