- updated the Tcl commands PlotAll and PlotObjects to have a parameter that control if the objects are to be plotted or not on canvas; it serve as a disable/enable

This commit is contained in:
Marius Stanciu
2020-04-13 20:28:39 +03:00
committed by Marius
parent 1b14e9d451
commit 742180d6e3
5 changed files with 54 additions and 19 deletions

View File

@@ -30,7 +30,7 @@ class TclCommandPlotObjects(TclCommand):
# Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
option_types = collections.OrderedDict([
('plot_status', str)
])
# array of mandatory options for current Tcl command: required = {'name','outname'}
@@ -41,7 +41,8 @@ class TclCommandPlotObjects(TclCommand):
'main': "Plot a specified list of objects in GUI.",
'args': collections.OrderedDict([
('names', "A list of object names to be plotted separated by comma. Required.\n"
"WARNING: no spaces are allowed. If unsure enclose the entire list with quotes.")
"WARNING: no spaces are allowed. If unsure enclose the entire list with quotes."),
('plot_status', 'If to display or not the objects: True (1) or False (0).')
]),
'examples': ["plot_objects gerber_obj.GRB,excellon_obj.DRL"]
}
@@ -53,11 +54,22 @@ class TclCommandPlotObjects(TclCommand):
:param unnamed_args:
:return:
"""
if 'plot_status' in args:
if args['plot_status'] is None:
plot_status = True
else:
plot_status = bool(eval(args['plot_status']))
else:
plot_status = True
if self.app.cmd_line_headless != 1:
names = [x.strip() for x in args['names'].split(",") if x != '']
objs = []
for name in names:
objs.append(self.app.collection.get_by_name(name))
obj= self.app.collection.get_by_name(name)
obj.options["plot"] = True if plot_status is True else False
objs.append(obj)
for obj in objs:
obj.plot()