2019-12-02 18:54:18 +00:00
|
|
|
from tclCommands.TclCommand import TclCommand
|
|
|
|
|
|
|
|
import collections
|
|
|
|
|
|
|
|
|
|
|
|
class TclCommandExportExcellon(TclCommand):
|
|
|
|
"""
|
|
|
|
Tcl shell command to export a Excellon Object as an Excellon File.
|
|
|
|
|
|
|
|
example:
|
|
|
|
export_exc path/my_excellon filename
|
|
|
|
"""
|
|
|
|
|
|
|
|
# List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
|
|
|
|
aliases = ['export_exc', 'ee', 'export_excellon']
|
|
|
|
|
2020-04-13 16:15:20 +00:00
|
|
|
description = '%s %s' % ("--", "Export a Excellon object as a Excellon File.")
|
|
|
|
|
2019-12-02 18:54:18 +00:00
|
|
|
# Dictionary of types from Tcl command, needs to be ordered
|
|
|
|
arg_names = collections.OrderedDict([
|
2020-04-13 16:15:20 +00:00
|
|
|
('name', str),
|
2019-12-02 18:54:18 +00:00
|
|
|
('filename', str)
|
|
|
|
])
|
|
|
|
|
|
|
|
# Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
|
|
|
|
option_types = collections.OrderedDict([
|
|
|
|
])
|
|
|
|
|
|
|
|
# array of mandatory options for current Tcl command: required = ['name','outname']
|
2020-04-13 16:15:20 +00:00
|
|
|
required = ['name']
|
2019-12-02 18:54:18 +00:00
|
|
|
|
|
|
|
# structured help for current command, args needs to be ordered
|
|
|
|
help = {
|
2020-04-13 16:15:20 +00:00
|
|
|
'main': "Export a Excellon object as a Excellon File.",
|
2019-12-02 18:54:18 +00:00
|
|
|
'args': collections.OrderedDict([
|
2020-04-13 16:15:20 +00:00
|
|
|
('name', 'Name of the Excellon object to export.'),
|
|
|
|
('filename', 'Absolute path to file to export.\n'
|
|
|
|
'WARNING: no spaces are allowed. If unsure enclose the entire path with quotes.'),
|
2019-12-02 18:54:18 +00:00
|
|
|
]),
|
2020-04-13 16:15:20 +00:00
|
|
|
'examples': ['export_excellon my_excellon path/my_file.drl', 'export_excellon My_Excellon D:/drill_file.DRL']
|
2019-12-02 18:54:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def execute(self, args, unnamed_args):
|
|
|
|
"""
|
|
|
|
|
|
|
|
:param args:
|
|
|
|
:param unnamed_args:
|
|
|
|
:return:
|
|
|
|
"""
|
2020-04-13 16:15:20 +00:00
|
|
|
if 'filename' not in args:
|
|
|
|
args['filename'] = self.app.defaults["global_last_save_folder"] + '/' + args['name']
|
|
|
|
self.app.export_excellon(use_thread=False, **args)
|