Use the extruder count in the global stack in project loading

CURA-4167

Custom FDM printers have multiple extruder stacks by default but not all
of them may be used. The actual number of extruders depends on what's
defined in the global stack. Because in the current architecture,
single-extrusion machines don't have extruder stacks, in project
loading, the extruder count in the global stack should be used so these
cases can be handled properly.
This commit is contained in:
Lipu Fei 2017-08-15 14:16:33 +02:00
parent 3a46a337ff
commit 3ebaacfa11

View file

@ -674,8 +674,18 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
self._container_registry.removeContainer(container.getId())
return
#
# Use the number of extruders from the global stack instead of the number of extruder stacks this project file
# contains. The Custom FDM Printer can have multiple extruders, but the actual number of extruders in used is
# defined in the global stack.
# Because for single-extrusion machines, there won't be an extruder stack, so relying on the the extruder count
# in the global stack can avoid problems in those cases.
#
extruder_count_from_global_stack = global_stack.getProperty("machine_extruder_count", "value")
# --
# load extruder stack files
if extruder_count_from_global_stack > 1:
try:
for extruder_stack_file in extruder_stack_files:
container_id = self._stripFileToId(extruder_stack_file)
@ -823,9 +833,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
if extruder_stacks:
for stack in extruder_stacks:
ExtruderManager.getInstance().registerExtruder(stack, global_stack.getId())
else:
# Machine has no extruders, but it needs to be registered with the extruder manager.
ExtruderManager.getInstance().registerExtruder(None, global_stack.getId())
Logger.log("d", "Workspace loading is notifying rest of the code of changes...")