Add message for unable to slice due to disabled extruders

CURA-5456
This commit is contained in:
Lipu Fei 2018-06-13 11:09:18 +02:00
parent b0b4f78cf2
commit 439ea79c60
2 changed files with 21 additions and 1 deletions

View file

@ -379,6 +379,14 @@ class CuraEngineBackend(QObject, Backend):
else: else:
self.backendStateChange.emit(BackendState.NotStarted) 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 job.getResult() == StartSliceJob.StartJobResult.NothingToSlice:
if Application.getInstance().platformActivity: 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."), 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."),

View file

@ -32,6 +32,7 @@ class StartJobResult(IntEnum):
MaterialIncompatible = 5 MaterialIncompatible = 5
BuildPlateError = 6 BuildPlateError = 6
ObjectSettingError = 7 #When an error occurs in per-object settings. ObjectSettingError = 7 #When an error occurs in per-object settings.
ObjectsWithDisabledExtruder = 8
## Formatter class that handles token expansion in start/end gcod ## 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()} extruders_enabled = {position: stack.isEnabled for position, stack in Application.getInstance().getGlobalContainerStack().extruders.items()}
filtered_object_groups = [] filtered_object_groups = []
has_model_with_disabled_extruders = False
associated_siabled_extruders = set()
for group in object_groups: for group in object_groups:
stack = Application.getInstance().getGlobalContainerStack() stack = Application.getInstance().getGlobalContainerStack()
skip_group = False skip_group = False
for node in group: 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 skip_group = True
has_model_with_disabled_extruders = True
associated_siabled_extruders.add(extruder_position)
break break
if not skip_group: if not skip_group:
filtered_object_groups.append(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 # 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 # able to find a possible sequence or because there are no objects on the build plate (or they are outside
# the build volume) # the build volume)