From: Ross Hendrickson Date: Fri, 30 Aug 2013 01:30:17 +0000 (-0500) Subject: Add simple output option to command line options X-Git-Tag: 13.10~67^2~2^2~2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=4cda2b2ad1416914afd1ab00ef0b23b5041b2e11;p=cura.git Add simple output option to command line options --- 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