diff options
author | Lipu Fei <lipu.fei815@gmail.com> | 2019-09-03 21:01:10 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2019-09-03 21:01:41 +0300 |
commit | 05247961459191ed28655a457e0e11f57f97733d (patch) | |
tree | 8e028393764e88d2621f519d7136fa3915ffb7c4 /plugins/CuraEngineBackend/CuraEngineBackend.py | |
parent | 09dc2099569b65a82774a503b072ca812956acb1 (diff) |
Do not trigger slicing if there's no slicable object
CURA-6604
Diffstat (limited to 'plugins/CuraEngineBackend/CuraEngineBackend.py')
-rwxr-xr-x | plugins/CuraEngineBackend/CuraEngineBackend.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 994966f9b7..ddf7864bb3 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -543,6 +543,15 @@ class CuraEngineBackend(QObject, Backend): if error.getErrorCode() == Arcus.ErrorCode.BindFailedError and self._start_slice_job is not None: self._start_slice_job.setIsCancelled(False) + # Check if there's any slicable object in the scene. + def hasSlicableObject(self) -> bool: + has_slicable = False + for node in DepthFirstIterator(self._scene.getRoot()): + if node.callDecoration("isSliceable"): + has_slicable = True + break + return has_slicable + ## Remove old layer data (if any) def _clearLayerData(self, build_plate_numbers: Set = None) -> None: # Clear out any old gcode @@ -561,6 +570,10 @@ class CuraEngineBackend(QObject, Backend): ## Convenient function: mark everything to slice, emit state and clear layer data def needsSlicing(self) -> None: + # CURA-6604: If there's no slicable object, do not (try to) trigger slice, which will clear all the current + # gcode. This can break Gcode file loading if it tries to remove it afterwards. + if not self.hasSlicableObject(): + return self.determineAutoSlicing() self.stopSlicing() self.markSliceAll() |