TclCommandNewExcellon.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. # Dictionary of types from Tcl command, needs to be ordered.
  16. # For positional arguments
  17. arg_names = collections.OrderedDict([
  18. ('name', str)
  19. ])
  20. # Dictionary of types from Tcl command, needs to be ordered.
  21. # For options like -optionname value
  22. option_types = collections.OrderedDict([
  23. ])
  24. # array of mandatory options for current Tcl command: required = {'name','outname'}
  25. required = []
  26. # structured help for current command, args needs to be ordered
  27. help = {
  28. 'main': "Creates a new empty Excellon object.",
  29. 'args': collections.OrderedDict([
  30. ('name', 'New object name.'),
  31. ]),
  32. 'examples': ['new_excellon my_excellon', 'new_excellon']
  33. }
  34. def execute(self, args, unnamed_args):
  35. """
  36. execute current TCL shell command
  37. :param args: array of known named arguments and options
  38. :param unnamed_args: array of other values which were passed into command
  39. without -somename and we do not have them in known arg_names
  40. :return: None or exception
  41. """
  42. if 'name' in args:
  43. name = args['name']
  44. else:
  45. name = 'new_exc'
  46. self.app.new_object('excellon', name, lambda x, y: None, plot=False)