TclCommandExportSVG.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. from tclCommands.TclCommand import TclCommand
  2. import collections
  3. from copy import copy
  4. class TclCommandExportSVG(TclCommand):
  5. """
  6. Tcl shell command to export a Geometry Object as an SVG File.
  7. example:
  8. export_svg my_geometry filename
  9. """
  10. # List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  11. aliases = ['export_svg']
  12. description = '%s %s' % ("--", "Export a Geometry object as a SVG File.")
  13. # Dictionary of types from Tcl command, needs to be ordered
  14. arg_names = collections.OrderedDict([
  15. ('name', str),
  16. ('filename', str),
  17. ('scale_factor', float)
  18. ])
  19. # Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
  20. option_types = collections.OrderedDict([
  21. ('scale_factor', float)
  22. ])
  23. # array of mandatory options for current Tcl command: required = {'name','outname'}
  24. required = ['name']
  25. # structured help for current command, args needs to be ordered
  26. help = {
  27. 'main': "Export a Geometry object as a SVG File.",
  28. 'args': collections.OrderedDict([
  29. ('name', 'Name of the object export. Required.'),
  30. ('filename', 'Absolute path to file to export.\n'
  31. 'WARNING: no spaces are allowed. If unsure enclose the entire path with quotes.'),
  32. ('scale_factor', 'Multiplication factor used for scaling line widths during export.')
  33. ]),
  34. 'examples': ['export_svg my_geometry my_file.svg']
  35. }
  36. def execute(self, args, unnamed_args):
  37. """
  38. :param args:
  39. :param unnamed_args:
  40. :return:
  41. """
  42. self.app.export_svg(**args)