TclCommandNewExcellon.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # ##########################################################
  2. # FlatCAM: 2D Post-processing for Manufacturing #
  3. # File Author: Marius Adrian Stanciu (c) #
  4. # Date: 8/17/2019 #
  5. # MIT Licence #
  6. # ##########################################################
  7. from tclCommands.TclCommand import TclCommandSignaled
  8. import collections
  9. class TclCommandNewExcellon(TclCommandSignaled):
  10. """
  11. Tcl shell command to subtract polygon from the given Geometry object.
  12. """
  13. # array of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  14. aliases = ['new_excellon']
  15. description = '%s %s' % ("--", "Creates a new empty Excellon object.")
  16. # Dictionary of types from Tcl command, needs to be ordered.
  17. # For positional arguments
  18. arg_names = collections.OrderedDict([
  19. ('name', str)
  20. ])
  21. # Dictionary of types from Tcl command, needs to be ordered.
  22. # For options like -optionname value
  23. option_types = collections.OrderedDict([
  24. ])
  25. # array of mandatory options for current Tcl command: required = {'name','outname'}
  26. required = []
  27. # structured help for current command, args needs to be ordered
  28. help = {
  29. 'main': "Creates a new empty Excellon object.",
  30. 'args': collections.OrderedDict([
  31. ('name', 'New object name.'),
  32. ]),
  33. 'examples': ['new_excellon my_excellon', 'new_excellon']
  34. }
  35. def execute(self, args, unnamed_args):
  36. """
  37. execute current TCL shell command
  38. :param args: array of known named arguments and options
  39. :param unnamed_args: array of other values which were passed into command
  40. without -somename and we do not have them in known arg_names
  41. :return: None or exception
  42. """
  43. if 'name' in args:
  44. name = args['name']
  45. else:
  46. name = 'new_exc'
  47. self.app.app_obj.new_object('excellon', name, lambda x, y: None, plot=False)