chiark / gitweb /
Fix commandline slicing, only print the plugin result if there was an error.
authordaid303 <daid303@gmail.com>
Tue, 11 Jun 2013 08:49:05 +0000 (10:49 +0200)
committerdaid303 <daid303@gmail.com>
Tue, 11 Jun 2013 08:49:05 +0000 (10:49 +0200)
Cura/cura.py
Cura/gui/sceneView.py
Cura/util/sliceEngine.py

index 6ea2989ab4cda61e7e76ab15f96a26dec46da7c5..d93a57f98310b09a1cf4b451bd595d8fa1ae204c 100644 (file)
@@ -40,12 +40,20 @@ def main():
                from Cura.util import sliceEngine
                from Cura.util import objectScene
                from Cura.util import meshLoader
+               import shutil
 
+               def commandlineProgessCallback(progress, ready):
+                       if progress >= 0 and not ready:
+                               print 'Preparing: %d%%' % (progress * 100)
                scene = objectScene.Scene()
-               slicer = sliceEngine.Slicer()
+               slicer = sliceEngine.Slicer(commandlineProgessCallback)
                for m in meshLoader.loadMeshes(args[0]):
                        scene.add(m)
                slicer.runSlicer(scene)
+               slicer.wait()
+               shutil.copyfile(slicer.getGCodeFilename(), args[0] + '.gcode')
+               print 'GCode file saved as: %s' % (args[0] + '.gcode')
+               slicer.cleanup()
        else:
                from Cura.gui import app
                app.CuraApp(args).MainLoop()
index 70bdce2cd7f1c8c2d11e54af7ce59088b93723b0..38b283ced791bed9f42c583895b9cbe696371a2e 100644 (file)
@@ -383,7 +383,8 @@ class SceneView(openglGui.glGuiPanel):
                        return
                self._scene.remove(self._focusObj)
                for obj in self._focusObj.split(self._splitCallback):
-                       self._scene.add(obj)
+                       if numpy.max(obj.getSize()) > 2.0:
+                               self._scene.add(obj)
                self._scene.centerAll()
                self._selectObject(None)
                self.sceneUpdated()
index 87a986e88f3feef60a90f566d4e985af078fb720..56698d784db3b9e30b0626f3b022c518bd88663a 100644 (file)
@@ -59,6 +59,10 @@ class Slicer(object):
                                pass
                        self._thread.join()
 
+       def wait(self):
+               if self._process is not None:
+                       self._thread.join()
+
        def getGCodeFilename(self):
                return self._exportFilename
 
@@ -188,7 +192,9 @@ class Slicer(object):
                returnCode = self._process.wait()
                try:
                        if returnCode == 0:
-                               print profile.runPostProcessingPlugins(self._exportFilename)
+                               pluginError = profile.runPostProcessingPlugins(self._exportFilename)
+                               if pluginError is not None:
+                                       print pluginError
                                self._callback(1.0, True)
                        else:
                                for line in self._sliceLog: