- 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:
@@ -203,7 +203,7 @@ class TclCommandCncjob(TclCommandSignaled):
|
||||
if 'dwelltime' in args:
|
||||
args["dwell"] = True
|
||||
if args['dwelltime'] is None:
|
||||
args["dwelltime"] = float(obj.options["dwelltime"])
|
||||
args["dwelltime"] = float(obj.obj_options["dwelltime"])
|
||||
else:
|
||||
args["dwelltime"] = float(args['dwelltime'])
|
||||
else:
|
||||
|
||||
@@ -139,10 +139,10 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
||||
self.app.log.error('Expected ExcellonObject, got %s %s.' % (name, type(obj)))
|
||||
return "fail"
|
||||
|
||||
xmin = obj.options['xmin']
|
||||
ymin = obj.options['ymin']
|
||||
xmax = obj.options['xmax']
|
||||
ymax = obj.options['ymax']
|
||||
xmin = obj.obj_options['xmin']
|
||||
ymin = obj.obj_options['ymin']
|
||||
xmax = obj.obj_options['xmax']
|
||||
ymax = obj.obj_options['ymax']
|
||||
|
||||
def job_init(job_obj, app_obj):
|
||||
# tools = args["tools"] if "tools" in args else 'all'
|
||||
@@ -230,7 +230,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
||||
used_tools_info.append([str(tool_no), str(tool_dia_used), str(drill_cnt), str(slot_cnt)])
|
||||
|
||||
drillz = args["drillz"] if "drillz" in args and args["drillz"] is not None else \
|
||||
obj.options["tools_drill_cutz"]
|
||||
obj.obj_options["tools_drill_cutz"]
|
||||
|
||||
toolchange = self.app.defaults["tools_drill_toolchange"]
|
||||
if "toolchangez" in args:
|
||||
@@ -238,7 +238,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
||||
if args["toolchangez"] is not None:
|
||||
toolchangez = args["toolchangez"]
|
||||
else:
|
||||
toolchangez = obj.options["tools_drill_toolchangez"]
|
||||
toolchangez = obj.obj_options["tools_drill_toolchangez"]
|
||||
else:
|
||||
toolchangez = float(self.app.defaults["tools_drill_toolchangez"])
|
||||
|
||||
@@ -281,14 +281,14 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
||||
# ##########################################################################################
|
||||
# ################# Set parameters #########################################################
|
||||
# ##########################################################################################
|
||||
job_obj.options['type'] = 'Excellon'
|
||||
job_obj.obj_options['type'] = 'Excellon'
|
||||
job_obj.multigeo = True
|
||||
job_obj.multitool = True
|
||||
|
||||
# preprocessor
|
||||
pp_excellon_name = args["pp"] if "pp" in args and args["pp"] else self.app.defaults["tools_drill_ppname_e"]
|
||||
job_obj.pp_excellon_name = pp_excellon_name
|
||||
job_obj.options['ppname_e'] = pp_excellon_name
|
||||
job_obj.obj_options['ppname_e'] = pp_excellon_name
|
||||
|
||||
# multidepth
|
||||
if 'dpp' in args:
|
||||
@@ -296,7 +296,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
||||
if args['dpp'] is not None:
|
||||
job_obj.z_depthpercut = abs(float(args['dpp']))
|
||||
else:
|
||||
job_obj.z_depthpercut = abs(float(obj.options["dpp"]))
|
||||
job_obj.z_depthpercut = abs(float(obj.obj_options["dpp"]))
|
||||
else:
|
||||
job_obj.multidepth = self.app.defaults["tools_drill_multidepth"]
|
||||
job_obj.z_depthpercut = self.app.defaults["tools_drill_depthperpass"]
|
||||
@@ -337,10 +337,10 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
||||
job_obj.coords_decimals = int(self.app.defaults["cncjob_coords_decimals"])
|
||||
job_obj.fr_decimals = int(self.app.defaults["cncjob_fr_decimals"])
|
||||
|
||||
job_obj.options['xmin'] = xmin
|
||||
job_obj.options['ymin'] = ymin
|
||||
job_obj.options['xmax'] = xmax
|
||||
job_obj.options['ymax'] = ymax
|
||||
job_obj.obj_options['xmin'] = xmin
|
||||
job_obj.obj_options['ymin'] = ymin
|
||||
job_obj.obj_options['xmax'] = xmax
|
||||
job_obj.obj_options['ymax'] = ymax
|
||||
|
||||
# Cut Z
|
||||
job_obj.z_cut = float(drillz)
|
||||
@@ -378,7 +378,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
||||
for t_item in job_obj.tools:
|
||||
job_obj.tools[t_item]['data']['tools_drill_offset'] = \
|
||||
float(job_obj.tools[t_item]['offset_z']) + float(drillz)
|
||||
job_obj.tools[t_item]['data']['tools_drill_ppname_e'] = job_obj.options['ppname_e']
|
||||
job_obj.tools[t_item]['data']['tools_drill_ppname_e'] = job_obj.obj_options['ppname_e']
|
||||
|
||||
used_tooldia = obj.tools[t_item]['tooldia']
|
||||
job_obj.tools[t_item]['tooldia'] = used_tooldia
|
||||
@@ -392,7 +392,7 @@ class TclCommandDrillcncjob(TclCommandSignaled):
|
||||
first_tool = 1
|
||||
job_obj.tools[first_tool]['data']['tools_drill_offset'] = \
|
||||
float(job_obj.tools[first_tool]['offset_z']) + float(drillz)
|
||||
job_obj.tools[first_tool]['data']['tools_drill_ppname_e'] = job_obj.options['ppname_e']
|
||||
job_obj.tools[first_tool]['data']['tools_drill_ppname_e'] = job_obj.obj_options['ppname_e']
|
||||
|
||||
used_tooldia = obj.tools[first_tool]['tooldia']
|
||||
job_obj.tools[first_tool]['tooldia'] = used_tooldia
|
||||
|
||||
@@ -188,10 +188,10 @@ class TclCommandGeoCutout(TclCommandSignaled):
|
||||
|
||||
# Get min and max data for each object as we just cut rectangles across X or Y
|
||||
xmin, ymin, xmax, ymax = cutout_obj.bounds()
|
||||
cutout_obj.options['xmin'] = xmin
|
||||
cutout_obj.options['ymin'] = ymin
|
||||
cutout_obj.options['xmax'] = xmax
|
||||
cutout_obj.options['ymax'] = ymax
|
||||
cutout_obj.obj_options['xmin'] = xmin
|
||||
cutout_obj.obj_options['ymin'] = ymin
|
||||
cutout_obj.obj_options['xmax'] = xmax
|
||||
cutout_obj.obj_options['ymax'] = ymax
|
||||
|
||||
px = 0.5 * (xmin + xmax) + margin
|
||||
py = 0.5 * (ymin + ymax) + margin
|
||||
@@ -260,10 +260,10 @@ class TclCommandGeoCutout(TclCommandSignaled):
|
||||
ymax + gapsize)
|
||||
|
||||
geo_obj.solid_geometry = deepcopy(geo)
|
||||
geo_obj.options['xmin'] = cutout_obj.options['xmin']
|
||||
geo_obj.options['ymin'] = cutout_obj.options['ymin']
|
||||
geo_obj.options['xmax'] = cutout_obj.options['xmax']
|
||||
geo_obj.options['ymax'] = cutout_obj.options['ymax']
|
||||
geo_obj.obj_options['xmin'] = cutout_obj.obj_options['xmin']
|
||||
geo_obj.obj_options['ymin'] = cutout_obj.obj_options['ymin']
|
||||
geo_obj.obj_options['xmax'] = cutout_obj.obj_options['xmax']
|
||||
geo_obj.obj_options['ymax'] = cutout_obj.obj_options['ymax']
|
||||
|
||||
if not geo_obj.solid_geometry:
|
||||
app_obj.log("TclCommandGeoCutout.execute(). No geometry after geo-cutout.")
|
||||
|
||||
@@ -50,5 +50,5 @@ class TclCommandOptions(TclCommandSignaled):
|
||||
|
||||
name = args['name']
|
||||
|
||||
ops = self.app.collection.get_by_name(str(name)).options
|
||||
ops = self.app.collection.get_by_name(str(name)).obj_options
|
||||
return '\n'.join(["%s: %s" % (o, ops[o]) for o in ops])
|
||||
|
||||
@@ -198,7 +198,7 @@ class TclCommandPanelize(TclCommand):
|
||||
# # deselect all to avoid delete selected object when run delete from shell
|
||||
# self.app.collection.set_all_inactive()
|
||||
# for delobj in objs:
|
||||
# self.app.collection.set_active(delobj.options['name'])
|
||||
# self.app.collection.set_active(delobj.obj_options['name'])
|
||||
# self.app.on_delete()
|
||||
# else:
|
||||
# return "fail"
|
||||
@@ -238,10 +238,10 @@ class TclCommandPanelize(TclCommand):
|
||||
obj_fin.tools = copied_tools
|
||||
obj_fin.solid_geometry = []
|
||||
|
||||
for option in obj.options:
|
||||
for option in obj.obj_options:
|
||||
if option != 'name':
|
||||
try:
|
||||
obj_fin.options[option] = obj.options[option]
|
||||
obj_fin.obj_options[option] = obj.obj_options[option]
|
||||
except Exception as e:
|
||||
app_obj.log.error("Failed to copy option: %s" % str(option))
|
||||
app_obj.log.error(
|
||||
|
||||
@@ -72,7 +72,7 @@ class TclCommandPlotAll(TclCommandSignaled):
|
||||
plot_status = True
|
||||
|
||||
for obj in self.app.collection.get_list():
|
||||
obj.options["plot"] = True if plot_status is True else False
|
||||
obj.obj_options["plot"] = True if plot_status is True else False
|
||||
|
||||
if self.app.cmd_line_headless != 1:
|
||||
self.app.plot_all(use_thread=threaded)
|
||||
|
||||
@@ -68,7 +68,7 @@ class TclCommandPlotObjects(TclCommand):
|
||||
objs = []
|
||||
for name in names:
|
||||
obj = self.app.collection.get_by_name(name)
|
||||
obj.options["plot"] = True if plot_status is True else False
|
||||
obj.obj_options["plot"] = True if plot_status is True else False
|
||||
objs.append(obj)
|
||||
|
||||
for obj in objs:
|
||||
|
||||
Reference in New Issue
Block a user