- refactoring all the references to object options property to obj_options to make a difference with the application options property
This commit is contained in:
@@ -56,7 +56,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
|
||||
self.kind = "cncjob"
|
||||
|
||||
self.options.update({
|
||||
self.obj_options.update({
|
||||
"plot": True,
|
||||
"tooldia": 0.03937, # 0.4mm in inches
|
||||
"append": "",
|
||||
@@ -191,11 +191,11 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
self.ui.cnc_tools_table.hide()
|
||||
self.ui.exc_cnc_tools_table.hide()
|
||||
|
||||
if self.options['type'].lower() == 'geometry':
|
||||
if self.obj_options['type'].lower() == 'geometry':
|
||||
self.build_cnc_tools_table()
|
||||
self.ui.cnc_tools_table.show()
|
||||
|
||||
if self.options['type'].lower() == 'excellon':
|
||||
if self.obj_options['type'].lower() == 'excellon':
|
||||
try:
|
||||
self.build_excellon_cnc_tools()
|
||||
except Exception as err:
|
||||
@@ -651,7 +651,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
self.app.defaults.report_usage("cncjob_on_exportgcode_button")
|
||||
|
||||
self.read_form()
|
||||
name = self.app.collection.get_active().options['name']
|
||||
name = self.app.collection.get_active().obj_options['name']
|
||||
save_gcode = False
|
||||
|
||||
if 'Roland' in self.pp_excellon_name or 'Roland' in self.pp_geometry_name:
|
||||
@@ -833,7 +833,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
start_comment = comment_start_symbol if comment_start_symbol is not None else '('
|
||||
stop_comment = comment_stop_symbol if comment_stop_symbol is not None else ')'
|
||||
|
||||
if self.options['type'].lower() == 'geometry':
|
||||
if self.obj_options['type'].lower() == 'geometry':
|
||||
try:
|
||||
for key in self.tools:
|
||||
ppg = self.tools[key]['data']['tools_mill_ppname_g']
|
||||
@@ -853,22 +853,22 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
pass
|
||||
|
||||
try:
|
||||
if 'marlin' in self.options['tools_drill_ppname_e'].lower() or \
|
||||
'repetier' in self.options['tools_drill_ppname_e'].lower():
|
||||
if 'marlin' in self.obj_options['tools_drill_ppname_e'].lower() or \
|
||||
'repetier' in self.obj_options['tools_drill_ppname_e'].lower():
|
||||
marlin = True
|
||||
except KeyError:
|
||||
# self.app.log.debug("FlatCAMCNCJob.gcode_header(): --> There is no such self.option: %s" % str(e))
|
||||
pass
|
||||
|
||||
try:
|
||||
if "toolchange_probe" in self.options['tools_drill_ppname_e'].lower():
|
||||
if "toolchange_probe" in self.obj_options['tools_drill_ppname_e'].lower():
|
||||
probe_pp = True
|
||||
except KeyError:
|
||||
# self.app.log.debug("FlatCAMCNCJob.gcode_header(): --> There is no such self.option: %s" % str(e))
|
||||
pass
|
||||
|
||||
try:
|
||||
if 'nccad' in self.options['tools_drill_ppname_e'].lower():
|
||||
if 'nccad' in self.obj_options['tools_drill_ppname_e'].lower():
|
||||
nccad_pp = True
|
||||
except KeyError:
|
||||
pass
|
||||
@@ -877,8 +877,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
gcode += ';Marlin(Repetier) G-CODE GENERATED BY FLATCAM v%s - www.flatcam.org - Version Date: %s\n' % \
|
||||
(str(self.app.version), str(self.app.version_date)) + '\n'
|
||||
|
||||
gcode += ';Name: ' + str(self.options['name']) + '\n'
|
||||
gcode += ';Type: ' + "G-code from " + str(self.options['type']) + '\n'
|
||||
gcode += ';Name: ' + str(self.obj_options['name']) + '\n'
|
||||
gcode += ';Type: ' + "G-code from " + str(self.obj_options['type']) + '\n'
|
||||
|
||||
gcode += ';Units: ' + self.units.upper() + '\n' + "\n"
|
||||
gcode += ';Created on ' + time_str + '\n' + '\n'
|
||||
@@ -886,8 +886,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
gcode += 'CO "HPGL CODE GENERATED BY FLATCAM v%s - www.flatcam.org - Version Date: %s' % \
|
||||
(str(self.app.version), str(self.app.version_date)) + '";\n'
|
||||
|
||||
gcode += 'CO "Name: ' + str(self.options['name']) + '";\n'
|
||||
gcode += 'CO "Type: ' + "HPGL code from " + str(self.options['type']) + '";\n'
|
||||
gcode += 'CO "Name: ' + str(self.obj_options['name']) + '";\n'
|
||||
gcode += 'CO "Type: ' + "HPGL code from " + str(self.obj_options['type']) + '";\n'
|
||||
|
||||
gcode += 'CO "Units: ' + self.units.upper() + '";\n'
|
||||
gcode += 'CO "Created on ' + time_str + '";\n'
|
||||
@@ -901,8 +901,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
'(mount the probe and adjust the Z so more or less the probe tip touch the plate. ' \
|
||||
'Then zero the Z axis.)\n' + '\n'
|
||||
|
||||
gcode += '(Name: ' + str(self.options['name']) + ')\n'
|
||||
gcode += '(Type: ' + "G-code from " + str(self.options['type']) + ')\n'
|
||||
gcode += '(Name: ' + str(self.obj_options['name']) + ')\n'
|
||||
gcode += '(Type: ' + "G-code from " + str(self.obj_options['type']) + ')\n'
|
||||
|
||||
gcode += '(Units: ' + self.units.upper() + ')\n' + "\n"
|
||||
gcode += '(Created on ' + time_str + ')\n' + '\n'
|
||||
@@ -910,8 +910,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
gcode += ';NCCAD9 G-CODE GENERATED BY FLATCAM v%s - www.flatcam.org - Version Date: %s\n' % \
|
||||
(str(self.app.version), str(self.app.version_date)) + '\n'
|
||||
|
||||
gcode += ';Name: ' + str(self.options['name']) + '\n'
|
||||
gcode += ';Type: ' + "G-code from " + str(self.options['type']) + '\n'
|
||||
gcode += ';Name: ' + str(self.obj_options['name']) + '\n'
|
||||
gcode += ';Type: ' + "G-code from " + str(self.obj_options['type']) + '\n'
|
||||
|
||||
gcode += ';Units: ' + self.units.upper() + '\n' + "\n"
|
||||
gcode += ';Created on ' + time_str + '\n' + '\n'
|
||||
@@ -919,8 +919,8 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
gcode += '%sG-CODE GENERATED BY FLATCAM v%s - www.flatcam.org - Version Date: %s%s\n' % \
|
||||
(start_comment, str(self.app.version), str(self.app.version_date), stop_comment) + '\n'
|
||||
|
||||
gcode += '%sName: ' % start_comment + str(self.options['name']) + '%s\n' % stop_comment
|
||||
gcode += '%sType: ' % start_comment + "G-code from " + str(self.options['type']) + '%s\n' % stop_comment
|
||||
gcode += '%sName: ' % start_comment + str(self.obj_options['name']) + '%s\n' % stop_comment
|
||||
gcode += '%sType: ' % start_comment + "G-code from " + str(self.obj_options['type']) + '%s\n' % stop_comment
|
||||
|
||||
gcode += '%sUnits: ' % start_comment + self.units.upper() + '%s\n' % stop_comment + "\n"
|
||||
gcode += '%sCreated on ' % start_comment + time_str + '%s\n' % stop_comment + '\n'
|
||||
@@ -974,7 +974,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
pass
|
||||
|
||||
# if this dict is not empty then the object is a Geometry object
|
||||
if self.options['type'].lower() == 'geometry':
|
||||
if self.obj_options['type'].lower() == 'geometry':
|
||||
# for the case that self.tools is empty: old projects
|
||||
try:
|
||||
first_key = list(self.tools.keys())[0]
|
||||
@@ -984,7 +984,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
include_header = self.app.preprocessors['default'].include_header
|
||||
|
||||
# if this dict is not empty then the object is an Excellon object
|
||||
if self.options['type'].lower() == 'excellon':
|
||||
if self.obj_options['type'].lower() == 'excellon':
|
||||
# for the case that self.tools is empty: old projects
|
||||
try:
|
||||
first_key = list(self.tools.keys())[0]
|
||||
@@ -1006,7 +1006,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
# detect if using multi-tool and make the Gcode summation correctly for each case
|
||||
if self.multitool is True:
|
||||
try:
|
||||
if self.options['type'].lower() == 'geometry':
|
||||
if self.obj_options['type'].lower() == 'geometry':
|
||||
for tooluid_key in self.tools:
|
||||
for key, value in self.tools[tooluid_key].items():
|
||||
if key == 'gcode':
|
||||
@@ -1033,7 +1033,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
if self.multitool is True:
|
||||
# for the case that self.tools is empty: old projects
|
||||
try:
|
||||
if self.options['type'].lower() == 'excellon':
|
||||
if self.obj_options['type'].lower() == 'excellon':
|
||||
for tooluid_key in self.tools:
|
||||
for key, value in self.tools[tooluid_key].items():
|
||||
if key == 'gcode' and value:
|
||||
@@ -1057,13 +1057,13 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
hpgl = False
|
||||
# for the case that self.tools is empty: old projects
|
||||
try:
|
||||
if self.options['type'].lower() == 'geometry':
|
||||
if self.obj_options['type'].lower() == 'geometry':
|
||||
for key in self.tools:
|
||||
if 'tools_mill_ppname_g' in self.tools[key]['data']:
|
||||
if 'hpgl' in self.tools[key]['data']['tools_mill_ppname_g']:
|
||||
hpgl = True
|
||||
break
|
||||
elif self.options['type'].lower() == 'excellon':
|
||||
elif self.obj_options['type'].lower() == 'excellon':
|
||||
for key in self.tools:
|
||||
if 'ppname_e' in self.tools[key]['data']:
|
||||
if 'hpgl' in self.tools[key]['data']['ppname_e']:
|
||||
@@ -1176,7 +1176,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
# """
|
||||
#
|
||||
# try:
|
||||
# if 'toolchange_custom' not in str(self.options['ppname_e']).lower():
|
||||
# if 'toolchange_custom' not in str(self.obj_options['ppname_e']).lower():
|
||||
# if self.ui.toolchange_cb.get_value():
|
||||
# self.ui.toolchange_cb.set_value(False)
|
||||
# self.app.inform.emit('[WARNING_NOTCL] %s' %
|
||||
@@ -1252,7 +1252,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
kind = self.ui.cncplot_method_combo.get_value()
|
||||
|
||||
self.shapes.clear(update=True)
|
||||
if self.options['type'].lower() == "excellon":
|
||||
if self.obj_options['type'].lower() == "excellon":
|
||||
for r in range(self.ui.exc_cnc_tools_table.rowCount()):
|
||||
row_dia = float('%.*f' % (self.decimals, float(self.ui.exc_cnc_tools_table.item(r, 1).text())))
|
||||
for tooluid_key in self.tools:
|
||||
@@ -1302,35 +1302,35 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
if not FlatCAMObj.plot(self):
|
||||
return
|
||||
|
||||
visible = visible if visible else self.options['plot']
|
||||
visible = visible if visible else self.obj_options['plot']
|
||||
|
||||
# Geometry shapes plotting
|
||||
try:
|
||||
if self.multitool is False: # single tool usage
|
||||
dia_plot = dia
|
||||
if dia_plot is None:
|
||||
if self.options['type'].lower() == "excellon":
|
||||
if self.obj_options['type'].lower() == "excellon":
|
||||
try:
|
||||
dia_plot = float(self.options["tooldia"])
|
||||
dia_plot = float(self.obj_options["tooldia"])
|
||||
except ValueError:
|
||||
# we may have a tuple with only one element and a comma
|
||||
dia_plot = [float(el) for el in self.options["tooldia"].split(',') if el != ''][0]
|
||||
dia_plot = [float(el) for el in self.obj_options["tooldia"].split(',') if el != ''][0]
|
||||
else:
|
||||
# try:
|
||||
# dia_plot = float(self.options["tools_mill_tooldia"])
|
||||
# dia_plot = float(self.obj_options["tools_mill_tooldia"])
|
||||
# except ValueError:
|
||||
# # we may have a tuple with only one element and a comma
|
||||
# dia_plot = [
|
||||
# float(el) for el in self.options["tools_mill_tooldia"].split(',') if el != ''
|
||||
# float(el) for el in self.obj_options["tools_mill_tooldia"].split(',') if el != ''
|
||||
# ][0]
|
||||
dia_plot = float(self.options["cncjob_tooldia"])
|
||||
dia_plot = float(self.obj_options["cncjob_tooldia"])
|
||||
|
||||
self.plot2(tooldia=dia_plot, obj=self, visible=visible, kind=kind)
|
||||
else:
|
||||
# I do this so the travel lines thickness will reflect the tool diameter
|
||||
# may work only for objects created within the app and not Gcode imported from elsewhere for which we
|
||||
# don't know the origin
|
||||
if self.options['type'].lower() == "excellon":
|
||||
if self.obj_options['type'].lower() == "excellon":
|
||||
if self.tools:
|
||||
for toolid_key in self.tools:
|
||||
dia_plot = self.app.dec_format(float(self.tools[toolid_key]['tooldia']), self.decimals)
|
||||
@@ -1406,7 +1406,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
|
||||
self.app.log.debug("FlatCAMObj.FlatCAMECNCjob.convert_units()")
|
||||
|
||||
factor = CNCjob.convert_units(self, units)
|
||||
self.options["tooldia"] = float(self.options["tooldia"]) * factor
|
||||
self.obj_options["tooldia"] = float(self.obj_options["tooldia"]) * factor
|
||||
|
||||
param_list = ['cutz', 'depthperpass', 'travelz', 'feedrate', 'feedrate_z', 'feedrate_rapid',
|
||||
'endz', 'toolchangez']
|
||||
|
||||
Reference in New Issue
Block a user