TclCommandNewGeometry.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. from tclCommands.TclCommand import *
  2. class TclCommandNewGeometry(TclCommandSignaled):
  3. """
  4. Tcl shell command to subtract polygon from the given Geometry object.
  5. """
  6. # array of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  7. aliases = ['new_geometry']
  8. # Dictionary of types from Tcl command, needs to be ordered.
  9. # For positional arguments
  10. arg_names = collections.OrderedDict([
  11. ('name', 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. ])
  17. # array of mandatory options for current Tcl command: required = {'name','outname'}
  18. required = ['name']
  19. # structured help for current command, args needs to be ordered
  20. help = {
  21. 'main': "Creates a new empty geometry object.",
  22. 'args': collections.OrderedDict([
  23. ('name', 'New object name.'),
  24. ]),
  25. 'examples': []
  26. }
  27. def execute(self, args, unnamed_args):
  28. """
  29. execute current TCL shell command
  30. :param args: array of known named arguments and options
  31. :param unnamed_args: array of other values which were passed into command
  32. without -somename and we do not have them in known arg_names
  33. :return: None or exception
  34. """
  35. name = args['name']
  36. self.app.new_object('geometry', str(name), lambda x, y: None)