TclCommandExportExcellon.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. # Dictionary of types from Tcl command, needs to be ordered
  12. arg_names = collections.OrderedDict([
  13. ('obj_name', str),
  14. ('filename', str)
  15. ])
  16. # Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
  17. option_types = collections.OrderedDict([
  18. ])
  19. # array of mandatory options for current Tcl command: required = ['name','outname']
  20. required = ['obj_name']
  21. # structured help for current command, args needs to be ordered
  22. help = {
  23. 'main': "Export a Excellon Object as a Excellon File.",
  24. 'args': collections.OrderedDict([
  25. ('obj_name', 'Name of the object to export.'),
  26. ('filename', 'Path to the file to export.')
  27. ]),
  28. 'examples': ['export_excellon my_excellon path/my_file.drl']
  29. }
  30. def execute(self, args, unnamed_args):
  31. """
  32. :param args:
  33. :param unnamed_args:
  34. :return:
  35. """
  36. if 'filename' not in args:
  37. args['filename'] = self.app.defaults["global_last_save_folder"] + '/' + args['obj_name']
  38. self.app.export_excellon(use_thread=False,**args)