From: daid303 Date: Tue, 11 Jun 2013 08:49:05 +0000 (+0200) Subject: Fix commandline slicing, only print the plugin result if there was an error. X-Git-Tag: 13.06.2~20 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=e7f830cdf53717ec86bda62bbd40e5970fb1e445;p=cura.git Fix commandline slicing, only print the plugin result if there was an error. --- diff --git a/Cura/cura.py b/Cura/cura.py index 6ea2989a..d93a57f9 100644 --- a/Cura/cura.py +++ b/Cura/cura.py @@ -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() diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index 70bdce2c..38b283ce 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -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() diff --git a/Cura/util/sliceEngine.py b/Cura/util/sliceEngine.py index 87a986e8..56698d78 100644 --- a/Cura/util/sliceEngine.py +++ b/Cura/util/sliceEngine.py @@ -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: