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

@ -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)