- added the outname parameter (and established an default name when outname not used) for the AlignDrillGrid and AlignDrill TclCommands
This commit is contained in:
@@ -28,6 +28,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
- made sure that all TclCommands are not threaded
|
- made sure that all TclCommands are not threaded
|
||||||
- added new TclCommands: NewExcellon, NewGerber
|
- added new TclCommands: NewExcellon, NewGerber
|
||||||
- fixed the TclCommand open_project
|
- fixed the TclCommand open_project
|
||||||
|
- added the outname parameter (and established an default name when outname not used) for the AlignDrillGrid and AlignDrill TclCommands
|
||||||
|
|
||||||
14.09.2019
|
14.09.2019
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class TclCommandAlignDrill(TclCommandSignaled):
|
|||||||
('axisoffset', float),
|
('axisoffset', float),
|
||||||
('dia', float),
|
('dia', float),
|
||||||
('dist', float),
|
('dist', float),
|
||||||
|
('outname', str),
|
||||||
])
|
])
|
||||||
|
|
||||||
# array of mandatory options for current Tcl command: required = {'name','outname'}
|
# 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.'),
|
('minoffset', 'min and max distance between align hole and pcb.'),
|
||||||
('axisoffset', 'Offset on second axis before aligment holes'),
|
('axisoffset', 'Offset on second axis before aligment holes'),
|
||||||
('axis', 'Mirror axis parallel to the X or Y axis.'),
|
('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):
|
def execute(self, args, unnamed_args):
|
||||||
@@ -64,6 +67,11 @@ class TclCommandAlignDrill(TclCommandSignaled):
|
|||||||
|
|
||||||
name = args['name']
|
name = args['name']
|
||||||
|
|
||||||
|
if 'outname' in args:
|
||||||
|
outname = args['outname']
|
||||||
|
else:
|
||||||
|
outname = name + "_aligndrill"
|
||||||
|
|
||||||
# Get source object.
|
# Get source object.
|
||||||
try:
|
try:
|
||||||
obj = self.app.collection.get_by_name(str(name))
|
obj = self.app.collection.get_by_name(str(name))
|
||||||
@@ -176,9 +184,7 @@ class TclCommandAlignDrill(TclCommandSignaled):
|
|||||||
px = 0.5 * (xmin + xmax)
|
px = 0.5 * (xmin + xmax)
|
||||||
py = 0.5 * (ymin + ymax)
|
py = 0.5 * (ymin + ymax)
|
||||||
|
|
||||||
obj.app.new_object("excellon",
|
obj.app.new_object("excellon", outname, alligndrill_init_me, plot=False)
|
||||||
name + "_aligndrill",
|
|
||||||
alligndrill_init_me, plot=False)
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return "Operation failed: %s" % str(e)
|
return "Operation failed: %s" % str(e)
|
||||||
@@ -194,8 +200,8 @@ class TclCommandAlignDrill(TclCommandSignaled):
|
|||||||
try:
|
try:
|
||||||
px = dist
|
px = dist
|
||||||
py = 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:
|
except Exception as e:
|
||||||
return "Operation failed: %s" % str(e)
|
return "Operation failed: %s" % str(e)
|
||||||
|
|
||||||
return 'Ok. Align Drills Excelon object created'
|
return 'Ok. Align Drills Excellon object created'
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class TclCommandAlignDrillGrid(TclCommandSignaled):
|
|||||||
# Dictionary of types from Tcl command, needs to be ordered.
|
# Dictionary of types from Tcl command, needs to be ordered.
|
||||||
# For positional arguments
|
# For positional arguments
|
||||||
arg_names = collections.OrderedDict([
|
arg_names = collections.OrderedDict([
|
||||||
('outname', str)
|
|
||||||
])
|
])
|
||||||
|
|
||||||
# Dictionary of types from Tcl command, needs to be ordered.
|
# Dictionary of types from Tcl command, needs to be ordered.
|
||||||
@@ -29,11 +29,12 @@ class TclCommandAlignDrillGrid(TclCommandSignaled):
|
|||||||
('gridy', float),
|
('gridy', float),
|
||||||
('gridoffsety', float),
|
('gridoffsety', float),
|
||||||
('columns', int),
|
('columns', int),
|
||||||
('rows', int)
|
('rows', int),
|
||||||
|
('outname', str)
|
||||||
])
|
])
|
||||||
|
|
||||||
# array of mandatory options for current Tcl command: required = {'name','outname'}
|
# 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
|
# structured help for current command, args needs to be ordered
|
||||||
help = {
|
help = {
|
||||||
@@ -48,7 +49,7 @@ class TclCommandAlignDrillGrid(TclCommandSignaled):
|
|||||||
('colums', 'Number of grid holes on X axis.'),
|
('colums', 'Number of grid holes on X axis.'),
|
||||||
('rows', 'Number of grid holes on Y 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):
|
def execute(self, args, unnamed_args):
|
||||||
@@ -61,6 +62,11 @@ class TclCommandAlignDrillGrid(TclCommandSignaled):
|
|||||||
:return: None or exception
|
:return: None or exception
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if 'outname' in args:
|
||||||
|
outname = args['outname']
|
||||||
|
else:
|
||||||
|
outname = "new_aligndrill_grid"
|
||||||
|
|
||||||
if 'gridoffsetx' not in args:
|
if 'gridoffsetx' not in args:
|
||||||
gridoffsetx = 0
|
gridoffsetx = 0
|
||||||
else:
|
else:
|
||||||
@@ -102,4 +108,4 @@ class TclCommandAlignDrillGrid(TclCommandSignaled):
|
|||||||
init_obj.create_geometry()
|
init_obj.create_geometry()
|
||||||
|
|
||||||
# Create the new object
|
# 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)
|
||||||
|
|||||||
Reference in New Issue
Block a user