From e7f830cdf53717ec86bda62bbd40e5970fb1e445 Mon Sep 17 00:00:00 2001 From: daid303 Date: Tue, 11 Jun 2013 10:49:05 +0200 Subject: [PATCH] Fix commandline slicing, only print the plugin result if there was an error. --- Cura/cura.py | 10 +++++++++- Cura/gui/sceneView.py | 3 ++- Cura/util/sliceEngine.py | 8 +++++++- 3 files changed, 18 insertions(+), 3 deletions(-) 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: -- 2.30.2