from Cura.util import meshLoader
import shutil
- def commandlineProgressCallback(progress, ready):
- if progress >= 0 and not ready:
- print 'Preparing: %d%%' % (progress * 100)
+ def commandlineProgressCallback(progress):
+ if progress >= 0:
+ #print 'Preparing: %d%%' % (progress * 100)
+ pass
scene = objectScene.Scene()
scene.updateMachineDimensions()
- slicer = sliceEngine.Slicer(commandlineProgressCallback)
+ engine = sliceEngine.Engine(commandlineProgressCallback)
for m in meshLoader.loadMeshes(args[0]):
scene.add(m)
- slicer.runSlicer(scene)
- slicer.wait()
- profile.replaceGCodeTagsFromSlicer(slicer.getGCodeFilename(), slicer)
+ engine.runEngine(scene)
+ engine.wait()
- if 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')
+ if not options.output:
+ options.output = args[0] + '.gcode'
+ with open(options.output, "wb") as f:
+ f.write(engine.getResult().getGCode())
+ print 'GCode file saved : %s' % options.output
- slicer.cleanup()
+ engine.cleanup()
else:
from Cura.gui import app
app.CuraApp(args).MainLoop()