From 4cda2b2ad1416914afd1ab00ef0b23b5041b2e11 Mon Sep 17 00:00:00 2001 From: Ross Hendrickson Date: Thu, 29 Aug 2013 20:30:17 -0500 Subject: [PATCH] Add simple output option to command line options --- Cura/cura.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Cura/cura.py b/Cura/cura.py index d93a57f9..6b314a61 100644 --- a/Cura/cura.py +++ b/Cura/cura.py @@ -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 -- 2.30.2