TclCommandGetSys.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 TclCommand
  8. import collections
  9. class TclCommandGetSys(TclCommand):
  10. """
  11. Tcl shell command to get the value of a system variable
  12. example:
  13. get_sys excellon_zeros
  14. """
  15. # List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  16. aliases = ['get_sys', 'getsys']
  17. # Dictionary of types from Tcl command, needs to be ordered
  18. arg_names = collections.OrderedDict([
  19. ('name', str)
  20. ])
  21. # Dictionary of types from Tcl command, needs to be ordered , this is 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 = ['name']
  26. # structured help for current command, args needs to be ordered
  27. help = {
  28. 'main': "Returns the value of the system variable.",
  29. 'args': collections.OrderedDict([
  30. ('name', 'Name of the system variable.'),
  31. ]),
  32. 'examples': ['get_sys excellon_zeros']
  33. }
  34. def execute(self, args, unnamed_args):
  35. """
  36. :param args:
  37. :param unnamed_args:
  38. :return:
  39. """
  40. name = args['name']
  41. if name in self.app.defaults:
  42. return self.app.defaults[name]