Bläddra i källkod

Added preamble and postamble to write_gcode tcl command.

Juan Pablo Caram 9 år sedan
förälder
incheckning
93e2d953a4
2 ändrade filer med 8 tillägg och 5 borttagningar
  1. 1 1
      tclCommands/TclCommandExportGcode.py
  2. 7 4
      tclCommands/TclCommandWriteGCode.py

+ 1 - 1
tclCommands/TclCommandExportGcode.py

@@ -4,7 +4,7 @@ import TclCommand
 
 
 class TclCommandExportGcode(TclCommand.TclCommandSignaled):
 class TclCommandExportGcode(TclCommand.TclCommandSignaled):
     """
     """
-    Tcl shell command to export gcode as  tcl output for "set X [export_gcode ...]"
+    Tcl shell command to export gcode as tcl output for "set X [export_gcode ...]"
 
 
     Requires name to be available. It might still be in the
     Requires name to be available. It might still be in the
     making at the time this function is called, so check for
     making at the time this function is called, so check for

+ 7 - 4
tclCommands/TclCommandWriteGCode.py

@@ -21,7 +21,8 @@ class TclCommandWriteGCode(TclCommand.TclCommandSignaled):
     # Dictionary of types from Tcl command, needs to be ordered.
     # Dictionary of types from Tcl command, needs to be ordered.
     # For options like -optionname value
     # For options like -optionname value
     option_types = collections.OrderedDict([
     option_types = collections.OrderedDict([
-
+        ('preamble', str),
+        ('postamble', str)
     ])
     ])
 
 
     # array of mandatory options for current Tcl command: required = {'name','outname'}
     # array of mandatory options for current Tcl command: required = {'name','outname'}
@@ -32,7 +33,9 @@ class TclCommandWriteGCode(TclCommand.TclCommandSignaled):
         'main': "Saves G-code of a CNC Job object to file.",
         'main': "Saves G-code of a CNC Job object to file.",
         'args': collections.OrderedDict([
         'args': collections.OrderedDict([
             ('name', 'Source CNC Job object.'),
             ('name', 'Source CNC Job object.'),
-            ('filename', 'Output filename'),
+            ('filename', 'Output filename.'),
+            ('preamble', 'Text to append at the beginning.'),
+            ('postamble', 'Text to append at the end.')
         ]),
         ]),
         'examples': []
         'examples': []
     }
     }
@@ -56,8 +59,8 @@ class TclCommandWriteGCode(TclCommand.TclCommandSignaled):
         obj_name = args['name']
         obj_name = args['name']
         filename = args['filename']
         filename = args['filename']
 
 
-        preamble = ''
-        postamble = ''
+        preamble = args['preamble'] if 'preamble' in args else ''
+        postamble = args['postamble'] if 'postamble' in args else ''
 
 
         # TODO: This is not needed any more? All targets should be present.
         # TODO: This is not needed any more? All targets should be present.
         # If there are promised objects, wait until all promises have been fulfilled.
         # If there are promised objects, wait until all promises have been fulfilled.