- multiple fixes in the Tcl commands (especially regarding the interchange between True/false and 1/0 values)

- updated the help for all Tcl Commands
- in Tcl Shell, the 'help' command will add also a brief description for each command in the list
This commit is contained in:
Marius Stanciu
2020-04-13 19:15:20 +03:00
committed by Marius
parent 5dcddb168e
commit 8a299e8fc8
66 changed files with 350 additions and 172 deletions

View File

@@ -20,6 +20,8 @@ class TclCommandCncjob(TclCommandSignaled):
# array of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
aliases = ['cncjob']
description = '%s %s' % ("--", "Generates a CNC Job object from a Geometry Object.")
# dictionary of types from Tcl command, needs to be ordered
arg_names = collections.OrderedDict([
('name', str)
@@ -42,7 +44,7 @@ class TclCommandCncjob(TclCommandSignaled):
('spindlespeed', int),
('dwelltime', float),
('pp', str),
('muted', int),
('muted', str),
('outname', str)
])
@@ -51,7 +53,7 @@ class TclCommandCncjob(TclCommandSignaled):
# structured help for current command, args needs to be ordered
help = {
'main': "Generates a CNC Job from a Geometry Object.",
'main': "Generates a CNC Job object from a Geometry Object.",
'args': collections.OrderedDict([
('name', 'Name of the source object.'),
('dia', 'Tool diameter to show on screen.'),
@@ -72,7 +74,7 @@ class TclCommandCncjob(TclCommandSignaled):
'If it is not used in command then it will not be included'),
('outname', 'Name of the resulting Geometry object.'),
('pp', 'Name of the Geometry preprocessor. No quotes, case sensitive'),
('muted', 'It will not put errors in the Shell.')
('muted', 'It will not put errors in the Shell. Can be True (1) or False (0)')
]),
'examples': ['cncjob geo_name -dia 0.5 -z_cut -1.7 -z_move 2 -feedrate 120 -pp default']
}
@@ -90,14 +92,14 @@ class TclCommandCncjob(TclCommandSignaled):
name = ''
if 'muted' in args:
muted = args['muted']
muted = bool(eval(args['muted']))
else:
muted = 0
muted = False
try:
name = args['name']
except KeyError:
if muted == 0:
if muted is False:
self.raise_tcl_error("Object name is missing")
else:
return "fail"
@@ -108,13 +110,13 @@ class TclCommandCncjob(TclCommandSignaled):
obj = self.app.collection.get_by_name(str(name), isCaseSensitive=False)
if obj is None:
if muted == 0:
if muted is False:
self.raise_tcl_error("Object not found: %s" % str(name))
else:
return "fail"
if not isinstance(obj, FlatCAMGeometry):
if muted == 0:
if muted is False:
self.raise_tcl_error('Expected FlatCAMGeometry, got %s %s.' % (str(name), type(obj)))
else:
return
@@ -187,7 +189,7 @@ class TclCommandCncjob(TclCommandSignaled):
else:
if args[arg] is None:
print(arg, args[arg])
if muted == 0:
if muted is False:
self.raise_tcl_error('One of the command parameters that have to be not None, is None.\n'
'The parameter that is None is in the default values found in the list \n'
'generated by the TclCommand "list_sys geom". or in the arguments.')