chiark / gitweb /
Add simple output option to command line options
[cura.git] / Cura / cura.py
index d93a57f98310b09a1cf4b451bd595d8fa1ae204c..6b314a61ac03a9289c0b80a02cc2068b96b9f493 100644 (file)
@@ -23,6 +23,9 @@ def main():
                help="Internal option, do not use!")
        parser.add_option("-s", "--slice", action="store_true", dest="slice",
                help="Slice the given files instead of opening them in Cura")
+       parser.add_option("-o", "--output", action="store", type="string", dest="output",
+               help="Directory or file to write sliced files to")
+
        (options, args) = parser.parse_args()
 
        profile.loadPreferences(profile.getPreferencePath())
@@ -51,8 +54,15 @@ def main():
                        scene.add(m)
                slicer.runSlicer(scene)
                slicer.wait()
-               shutil.copyfile(slicer.getGCodeFilename(), args[0] + '.gcode')
-               print 'GCode file saved as: %s' % (args[0] + '.gcode')
+
+               if options.output:
+                       print 'output', options.output
+                       shutil.copyfile(slicer.getGCodeFilename(), options.output)
+                       print 'GCode file saved : %s' % options.output
+               else:
+                       shutil.copyfile(slicer.getGCodeFilename(), args[0] + '.gcode')
+                       print 'GCode file saved as: %s' % (args[0] + '.gcode')
+
                slicer.cleanup()
        else:
                from Cura.gui import app