- 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:
parent
1b14e9d451
commit
742180d6e3
|
@ -1029,8 +1029,10 @@ class App(QtCore.QObject):
|
||||||
'gbl, gbo, gbp, gbr, gbs, gdo, ger, gko, gm1, gm2, gm3, grb, gtl, gto, gtp, gts, ly15, ly2, '
|
'gbl, gbo, gbp, gbr, gbs, gdo, ger, gko, gm1, gm2, gm3, grb, gtl, gto, gtp, gts, ly15, ly2, '
|
||||||
'mil, pho, plc, pls, smb, smt, sol, spb, spt, ssb, sst, stc, sts, top, tsm',
|
'mil, pho, plc, pls, smb, smt, sol, spb, spt, ssb, sst, stc, sts, top, tsm',
|
||||||
# Keyword list
|
# Keyword list
|
||||||
"util_autocomplete_keywords": 'Desktop, Documents, FlatConfig, FlatPrj, Marius, My Documents, Paste_1, '
|
"util_autocomplete_keywords": 'Desktop, Documents, FlatConfig, FlatPrj, False, '
|
||||||
'Repetier, Roland_MDX_20, Users, Toolchange_Custom, Toolchange_Probe_MACH3, '
|
'Marius, My Documents, Paste_1, '
|
||||||
|
'Repetier, Roland_MDX_20, True, Users, Toolchange_Custom, '
|
||||||
|
'Toolchange_Probe_MACH3, '
|
||||||
'Toolchange_manual, Users, all, angle_x, angle_y, axis, auto, axisoffset, '
|
'Toolchange_manual, Users, all, angle_x, angle_y, axis, auto, axisoffset, '
|
||||||
'box, center_x, center_y, columns, combine, connect, contour, default, '
|
'box, center_x, center_y, columns, combine, connect, contour, default, '
|
||||||
'depthperpass, dia, diatol, dist, drilled_dias, drillz, dwelltime, '
|
'depthperpass, dia, diatol, dist, drilled_dias, drillz, dwelltime, '
|
||||||
|
@ -2305,28 +2307,30 @@ class App(QtCore.QObject):
|
||||||
# ######################### Auto-complete KEYWORDS ####################################
|
# ######################### Auto-complete KEYWORDS ####################################
|
||||||
# #####################################################################################
|
# #####################################################################################
|
||||||
self.tcl_commands_list = ['add_circle', 'add_poly', 'add_polygon', 'add_polyline', 'add_rectangle',
|
self.tcl_commands_list = ['add_circle', 'add_poly', 'add_polygon', 'add_polyline', 'add_rectangle',
|
||||||
'aligndrill', 'aligndrillgrid', 'bbox', 'bounding_box', 'clear', 'cncjob', 'cutout',
|
'aligndrill', 'aligndrillgrid', 'bbox', 'clear', 'cncjob', 'cutout',
|
||||||
'del', 'delete', 'drillcncjob', 'export_dxf', 'edxf', 'export_excellon', 'ee',
|
'del', 'drillcncjob', 'export_dxf', 'edxf', 'export_excellon',
|
||||||
'export_exc',
|
'export_exc',
|
||||||
'export_gcode', 'export_gerber', 'egr', 'export_svg', 'ext', 'exteriors', 'follow',
|
'export_gcode', 'export_gerber', 'export_svg', 'ext', 'exteriors', 'follow',
|
||||||
'geo_union', 'geocutout', 'get_names', 'get_sys', 'getsys', 'help', 'import_svg',
|
'geo_union', 'geocutout', 'get_bounds', 'get_names', 'get_sys', 'help', 'import_svg',
|
||||||
'interiors', 'isolate', 'join_excellon', 'join_excellons', 'join_geometries',
|
'interiors', 'isolate', 'join_excellon',
|
||||||
'join_geometry', 'list_sys', 'listsys', 'milld', 'mills', 'milldrills', 'millslots',
|
'join_geometry', 'list_sys', 'milld', 'mills', 'milldrills', 'millslots',
|
||||||
'mirror', 'ncc',
|
'mirror', 'ncc',
|
||||||
'ncc_clear', 'ncr', 'new', 'new_geometry', 'non_copper_regions', 'offset',
|
'ncr', 'new', 'new_geometry', 'non_copper_regions', 'offset',
|
||||||
'open_excellon', 'open_gcode', 'open_gerber', 'open_project', 'options', 'origin',
|
'open_excellon', 'open_gcode', 'open_gerber', 'open_project', 'options', 'origin',
|
||||||
'paint', 'pan', 'panel', 'panelize', 'plot_all', 'plot_objects', 'quit_flatcam',
|
'paint', 'panelize', 'plot_all', 'plot_objects', 'plot_status', 'quit_flatcam',
|
||||||
'save', 'save_project',
|
'save', 'save_project',
|
||||||
'save_sys', 'scale', 'set_active', 'set_origin', 'set_sys',
|
'save_sys', 'scale', 'set_active', 'set_origin', 'set_sys',
|
||||||
'setsys', 'skew', 'subtract_poly', 'subtract_rectangle',
|
'skew', 'subtract_poly', 'subtract_rectangle',
|
||||||
'version', 'write_gcode'
|
'version', 'write_gcode'
|
||||||
]
|
]
|
||||||
|
|
||||||
self.default_keywords = ['Desktop', 'Documents', 'FlatConfig', 'FlatPrj', 'Marius', 'My Documents', 'Paste_1',
|
self.default_keywords = ['Desktop', 'Documents', 'FlatConfig', 'FlatPrj', 'False', 'Marius', 'My Documents',
|
||||||
|
'Paste_1',
|
||||||
'Repetier', 'Roland_MDX_20', 'Users', 'Toolchange_Custom', 'Toolchange_Probe_MACH3',
|
'Repetier', 'Roland_MDX_20', 'Users', 'Toolchange_Custom', 'Toolchange_Probe_MACH3',
|
||||||
'Toolchange_manual', 'Users', 'all', 'angle_x', 'angle_y', 'auto', 'axis',
|
'Toolchange_manual', 'True', 'Users',
|
||||||
'axisoffset',
|
'all', 'angle_x', 'angle_y', 'auto', 'axis',
|
||||||
'box', 'center_x', 'center_y', 'columns', 'combine', 'connect', 'contour', 'default',
|
'axisoffset', 'box', 'center_x', 'center_y', 'columns', 'combine', 'connect',
|
||||||
|
'contour', 'default',
|
||||||
'depthperpass', 'dia', 'diatol', 'dist', 'drilled_dias', 'drillz',
|
'depthperpass', 'dia', 'diatol', 'dist', 'drilled_dias', 'drillz',
|
||||||
'dwelltime', 'extracut_length', 'f',
|
'dwelltime', 'extracut_length', 'f',
|
||||||
'feedrate_z', 'grbl_11', 'GRBL_laser', 'gridoffsety', 'gridx', 'gridy',
|
'feedrate_z', 'grbl_11', 'GRBL_laser', 'gridoffsety', 'gridx', 'gridy',
|
||||||
|
|
|
@ -912,6 +912,11 @@ class ObjectCollection(QtCore.QAbstractItemModel):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_list(self):
|
def get_list(self):
|
||||||
|
"""
|
||||||
|
Will return a list of all objects currently opened.
|
||||||
|
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
obj_list = []
|
obj_list = []
|
||||||
for group in self.root_item.child_items:
|
for group in self.root_item.child_items:
|
||||||
for item in group.child_items:
|
for item in group.child_items:
|
||||||
|
|
|
@ -17,6 +17,7 @@ CAD program, and create G-Code for Isolation routing.
|
||||||
- in Tcl Shell, the 'help' command will add also a brief description for each command in the list
|
- in Tcl Shell, the 'help' command will add also a brief description for each command in the list
|
||||||
- updated the App.plot_all() method giving it the possibility to be run as threaded or not
|
- updated the App.plot_all() method giving it the possibility to be run as threaded or not
|
||||||
- updated the Tcl command PlotAll to be able to run threaded or not
|
- updated the Tcl command PlotAll to be able to run threaded or not
|
||||||
|
- 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
|
||||||
|
|
||||||
11.04.2020
|
11.04.2020
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ class TclCommandPlotAll(TclCommandSignaled):
|
||||||
|
|
||||||
# Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
|
# Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
|
||||||
option_types = collections.OrderedDict([
|
option_types = collections.OrderedDict([
|
||||||
|
('plot_status', str),
|
||||||
('use_thread', str)
|
('use_thread', str)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -33,9 +34,10 @@ class TclCommandPlotAll(TclCommandSignaled):
|
||||||
help = {
|
help = {
|
||||||
'main': "Plots all objects on GUI.",
|
'main': "Plots all objects on GUI.",
|
||||||
'args': collections.OrderedDict([
|
'args': collections.OrderedDict([
|
||||||
|
('plot_status', 'If to display or not the objects: True (1) or False (0).'),
|
||||||
('use_thread', 'If to use multithreading: True (1) or False (0).')
|
('use_thread', 'If to use multithreading: True (1) or False (0).')
|
||||||
]),
|
]),
|
||||||
'examples': ['plot_all']
|
'examples': ['plot_all', 'plot_all -plot_status False']
|
||||||
}
|
}
|
||||||
|
|
||||||
def execute(self, args, unnamed_args):
|
def execute(self, args, unnamed_args):
|
||||||
|
@ -51,5 +53,16 @@ class TclCommandPlotAll(TclCommandSignaled):
|
||||||
else:
|
else:
|
||||||
threaded = False
|
threaded = False
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
for obj in self.app.collection.get_list():
|
||||||
|
obj.options["plot"] = True if plot_status is True else False
|
||||||
|
|
||||||
if self.app.cmd_line_headless != 1:
|
if self.app.cmd_line_headless != 1:
|
||||||
self.app.plot_all(use_thread=threaded)
|
self.app.plot_all(use_thread=threaded)
|
||||||
|
|
|
@ -30,7 +30,7 @@ class TclCommandPlotObjects(TclCommand):
|
||||||
|
|
||||||
# Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
|
# Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
|
||||||
option_types = collections.OrderedDict([
|
option_types = collections.OrderedDict([
|
||||||
|
('plot_status', str)
|
||||||
])
|
])
|
||||||
|
|
||||||
# array of mandatory options for current Tcl command: required = {'name','outname'}
|
# 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.",
|
'main': "Plot a specified list of objects in GUI.",
|
||||||
'args': collections.OrderedDict([
|
'args': collections.OrderedDict([
|
||||||
('names', "A list of object names to be plotted separated by comma. Required.\n"
|
('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"]
|
'examples': ["plot_objects gerber_obj.GRB,excellon_obj.DRL"]
|
||||||
}
|
}
|
||||||
|
@ -53,11 +54,22 @@ class TclCommandPlotObjects(TclCommand):
|
||||||
:param unnamed_args:
|
:param unnamed_args:
|
||||||
:return:
|
: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:
|
if self.app.cmd_line_headless != 1:
|
||||||
names = [x.strip() for x in args['names'].split(",") if x != '']
|
names = [x.strip() for x in args['names'].split(",") if x != '']
|
||||||
objs = []
|
objs = []
|
||||||
for name in names:
|
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:
|
for obj in objs:
|
||||||
obj.plot()
|
obj.plot()
|
||||||
|
|
Loading…
Reference in New Issue