chiark / gitweb /
Add more documentation, fix commandline slicing.
[cura.git] / Cura / cura.py
index 2208d983f7b02aaf9901b1383ca4ba2089d5b4a5..a8b22ef53a33d86cf2eebf5e3479f8ae6fb71dd9 100644 (file)
@@ -46,26 +46,25 @@ def main():
                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()