TclCommandExportExcellon.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. from tclCommands.TclCommand import TclCommand
  2. import collections
  3. class TclCommandExportExcellon(TclCommand):
  4. """
  5. Tcl shell command to export a Excellon Object as an Excellon File.
  6. example:
  7. export_exc path/my_excellon filename
  8. """
  9. # List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  10. aliases = ['export_exc', 'ee', 'export_excellon']
  11. description = '%s %s' % ("--", "Export a Excellon object as a Excellon File.")
  12. # Dictionary of types from Tcl command, needs to be ordered
  13. arg_names = collections.OrderedDict([
  14. ('name', str),
  15. ('filename', str)
  16. ])
  17. # Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
  18. option_types = collections.OrderedDict([
  19. ])
  20. # array of mandatory options for current Tcl command: required = ['name','outname']
  21. required = ['name']
  22. # structured help for current command, args needs to be ordered
  23. help = {
  24. 'main': "Export a Excellon object as a Excellon File.",
  25. 'args': collections.OrderedDict([
  26. ('name', 'Name of the Excellon object to export.'),
  27. ('filename', 'Absolute path to file to export.\n'
  28. 'WARNING: no spaces are allowed. If unsure enclose the entire path with quotes.'),
  29. ]),
  30. 'examples': ['export_excellon my_excellon path/my_file.drl', 'export_excellon My_Excellon D:/drill_file.DRL']
  31. }
  32. def execute(self, args, unnamed_args):
  33. """
  34. :param args:
  35. :param unnamed_args:
  36. :return:
  37. """
  38. if 'filename' not in args:
  39. args['filename'] = self.app.defaults["global_last_save_folder"] + '/' + args['name']
  40. self.app.f_handlers.export_excellon(use_thread=False, **args)