- added the outname parameter (and established an default name when outname not used) for the AlignDrillGrid and AlignDrill TclCommands

This commit is contained in:
Marius Stanciu
2019-09-16 03:12:37 +03:00
committed by Marius
parent 7aebf1c60a
commit 4c1163eedd
3 changed files with 25 additions and 12 deletions

View File

@@ -17,7 +17,7 @@ class TclCommandAlignDrillGrid(TclCommandSignaled):
# Dictionary of types from Tcl command, needs to be ordered.
# For positional arguments
arg_names = collections.OrderedDict([
('outname', str)
])
# Dictionary of types from Tcl command, needs to be ordered.
@@ -29,11 +29,12 @@ class TclCommandAlignDrillGrid(TclCommandSignaled):
('gridy', float),
('gridoffsety', float),
('columns', int),
('rows', int)
('rows', int),
('outname', str)
])
# array of mandatory options for current Tcl command: required = {'name','outname'}
required = ['outname', 'gridx', 'gridy', 'columns', 'rows']
required = ['gridx', 'gridy', 'columns', 'rows']
# structured help for current command, args needs to be ordered
help = {
@@ -48,7 +49,7 @@ class TclCommandAlignDrillGrid(TclCommandSignaled):
('colums', 'Number of grid holes on X axis.'),
('rows', 'Number of grid holes on Y axis.'),
]),
'examples': []
'examples': ['aligndrillgrid -rows 2 -columns 2 -gridoffsetx 10 -gridoffsety 10 -gridx 2.54 -gridy 5.08']
}
def execute(self, args, unnamed_args):
@@ -61,6 +62,11 @@ class TclCommandAlignDrillGrid(TclCommandSignaled):
:return: None or exception
"""
if 'outname' in args:
outname = args['outname']
else:
outname = "new_aligndrill_grid"
if 'gridoffsetx' not in args:
gridoffsetx = 0
else:
@@ -102,4 +108,4 @@ class TclCommandAlignDrillGrid(TclCommandSignaled):
init_obj.create_geometry()
# Create the new object
self.app.new_object("excellon", args['outname'], aligndrillgrid_init_me, plot=False)
self.app.new_object("excellon", outname, aligndrillgrid_init_me, plot=False)