diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index d298ff1aca..3e66edc203 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -379,6 +379,14 @@ class CuraEngineBackend(QObject, Backend): else: self.backendStateChange.emit(BackendState.NotStarted) + if job.getResult() == StartSliceJob.StartJobResult.ObjectsWithDisabledExtruder: + self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because there are objects associated with disabled Extruder %s." % job.getMessage()), + title = catalog.i18nc("@info:title", "Unable to slice")) + self._error_message.show() + self.backendStateChange.emit(BackendState.Error) + self.backendError.emit(job) + return + if job.getResult() == StartSliceJob.StartJobResult.NothingToSlice: if Application.getInstance().platformActivity: self._error_message = Message(catalog.i18nc("@info:status", "Nothing to slice because none of the models fit the build volume. Please scale or rotate models to fit."), diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py index 467351dd4b..b704ca0d2f 100644 --- a/plugins/CuraEngineBackend/StartSliceJob.py +++ b/plugins/CuraEngineBackend/StartSliceJob.py @@ -32,6 +32,7 @@ class StartJobResult(IntEnum): MaterialIncompatible = 5 BuildPlateError = 6 ObjectSettingError = 7 #When an error occurs in per-object settings. + ObjectsWithDisabledExtruder = 8 ## Formatter class that handles token expansion in start/end gcod @@ -213,16 +214,27 @@ class StartSliceJob(Job): extruders_enabled = {position: stack.isEnabled for position, stack in Application.getInstance().getGlobalContainerStack().extruders.items()} filtered_object_groups = [] + has_model_with_disabled_extruders = False + associated_siabled_extruders = set() for group in object_groups: stack = Application.getInstance().getGlobalContainerStack() skip_group = False for node in group: - if not extruders_enabled[node.callDecoration("getActiveExtruderPosition")]: + extruder_position = node.callDecoration("getActiveExtruderPosition") + if not extruders_enabled[extruder_position]: skip_group = True + has_model_with_disabled_extruders = True + associated_siabled_extruders.add(extruder_position) break if not skip_group: filtered_object_groups.append(group) + if has_model_with_disabled_extruders: + self.setResult(StartJobResult.ObjectsWithDisabledExtruder) + associated_siabled_extruders = [str(c) for c in sorted([int(p) + 1 for p in associated_siabled_extruders])] + self.setMessage(", ".join(associated_siabled_extruders)) + return + # There are cases when there is nothing to slice. This can happen due to one at a time slicing not being # able to find a possible sequence or because there are no objects on the build plate (or they are outside # the build volume)