From c2fab4da4728aa95e07f93b6f5cbb79aad28cae8 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 18 Jul 2016 10:25:51 +0200 Subject: [PATCH] Print information handles single extrusion machines correctly again CURA-1931 and CURA-1038 --- cura/PrintInformation.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 6ba1274a49..4dedf9db16 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -89,8 +89,12 @@ class PrintInformation(QObject): for index, amount in enumerate(material_amounts): ## Find the right extruder stack. As the list isn't sorted because it's a annoying generator, we do some # list comprehension filtering to solve this for us. - extruder_stack = [extruder for extruder in extruder_stacks if extruder.getMetaDataEntry("position") == str(index)][0] - density = extruder_stack.getMetaDataEntry("properties", {}).get("density", 0) + if extruder_stacks: # Multi extrusion machine + extruder_stack = [extruder for extruder in extruder_stacks if extruder.getMetaDataEntry("position") == str(index)][0] + density = extruder_stack.getMetaDataEntry("properties", {}).get("density", 0) + else: # Machine with no extruder stacks + density = Application.getInstance().getGlobalContainerStack().getMetaDataEntry("properties", {}).get("density", 0) + self._material_weights.append(float(amount) * float(density)) self._material_lengths.append(round((amount / (math.pi * r ** 2)) / 1000, 2)) self.materialLengthsChanged.emit()