TclCommandOpenExcellon.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. from tclCommands.TclCommand import *
  2. class TclCommandOpenExcellon(TclCommandSignaled):
  3. """
  4. Tcl shell command to open an Excellon file.
  5. """
  6. # array of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  7. aliases = ['open_excellon']
  8. # Dictionary of types from Tcl command, needs to be ordered.
  9. # For positional arguments
  10. arg_names = collections.OrderedDict([
  11. ('filename', str)
  12. ])
  13. # Dictionary of types from Tcl command, needs to be ordered.
  14. # For options like -optionname value
  15. option_types = collections.OrderedDict([
  16. ('outname', str)
  17. ])
  18. # array of mandatory options for current Tcl command: required = {'name','outname'}
  19. required = ['filename']
  20. # structured help for current command, args needs to be ordered
  21. help = {
  22. 'main': "Opens an Excellon file.",
  23. 'args': collections.OrderedDict([
  24. ('filename', 'Path to file to open.'),
  25. ('outname', 'Name of the resulting Excellon object.')
  26. ]),
  27. 'examples': []
  28. }
  29. def execute(self, args, unnamed_args):
  30. """
  31. execute current TCL shell command
  32. :param args: array of known named arguments and options
  33. :param unnamed_args: array of other values which were passed into command
  34. without -somename and we do not have them in known arg_names
  35. :return: None or exception
  36. """
  37. filename = args.pop('filename')
  38. self.app.open_excellon(filename, **args)