- 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

@@ -29,6 +29,7 @@ class TclCommandAlignDrill(TclCommandSignaled):
('axisoffset', float),
('dia', float),
('dist', float),
('outname', str),
])
# array of mandatory options for current Tcl command: required = {'name','outname'}
@@ -47,9 +48,11 @@ class TclCommandAlignDrill(TclCommandSignaled):
('minoffset', 'min and max distance between align hole and pcb.'),
('axisoffset', 'Offset on second axis before aligment holes'),
('axis', 'Mirror axis parallel to the X or Y axis.'),
('dist', 'Distance of the mirror axis to the X or Y axis.')
('dist', 'Distance of the mirror axis to the X or Y axis.'),
('outname', 'Name of the resulting Excellon object.'),
]),
'examples': []
'examples': ['aligndrill my_object -axis X -box my_object -dia 3.125 -grid 1 '
'-gridoffset 0 -minoffset 2 -axisoffset 2']
}
def execute(self, args, unnamed_args):
@@ -64,6 +67,11 @@ class TclCommandAlignDrill(TclCommandSignaled):
name = args['name']
if 'outname' in args:
outname = args['outname']
else:
outname = name + "_aligndrill"
# Get source object.
try:
obj = self.app.collection.get_by_name(str(name))
@@ -176,9 +184,7 @@ class TclCommandAlignDrill(TclCommandSignaled):
px = 0.5 * (xmin + xmax)
py = 0.5 * (ymin + ymax)
obj.app.new_object("excellon",
name + "_aligndrill",
alligndrill_init_me, plot=False)
obj.app.new_object("excellon", outname, alligndrill_init_me, plot=False)
except Exception as e:
return "Operation failed: %s" % str(e)
@@ -194,8 +200,8 @@ class TclCommandAlignDrill(TclCommandSignaled):
try:
px = dist
py = dist
obj.app.new_object("excellon", name + "_alligndrill", alligndrill_init_me, plot=False)
obj.app.new_object("excellon", outname, alligndrill_init_me, plot=False)
except Exception as e:
return "Operation failed: %s" % str(e)
return 'Ok. Align Drills Excelon object created'
return 'Ok. Align Drills Excellon object created'