Browse Source

Fix saving g-code if no quality profile is set

If the quality profile was 'empty', then the container type wasn't properly set, so you can't find any quality profile. This gets the quality profile from the stacks, so you will find the empty profile (which has the wrong type but at least you can try to request metadata from it).
Ghostkeeper 7 years ago
parent
commit
bd75102ee5
1 changed files with 3 additions and 3 deletions
  1. 3 3
      plugins/GCodeWriter/GCodeWriter.py

+ 3 - 3
plugins/GCodeWriter/GCodeWriter.py

@@ -1,4 +1,4 @@
-# Copyright (c) 2016 Ultimaker B.V.
+# Copyright (c) 2017 Ultimaker B.V.
 # Cura is released under the terms of the AGPLv3 or higher.
 
 from UM.Mesh.MeshWriter import MeshWriter
@@ -113,7 +113,7 @@ class GCodeWriter(MeshWriter):
 
         # Ensure that quality_type is set. (Can happen if we have empty quality changes).
         if flat_global_container.getMetaDataEntry("quality_type", None) is None:
-            flat_global_container.addMetaDataEntry("quality_type", stack.findContainer({"type": "quality"}).getMetaDataEntry("quality_type", "normal"))
+            flat_global_container.addMetaDataEntry("quality_type", stack.quality.getMetaDataEntry("quality_type", "normal"))
 
         serialized = flat_global_container.serialize()
         data = {"global_quality": serialized}
@@ -134,7 +134,7 @@ class GCodeWriter(MeshWriter):
 
             # Ensure that quality_type is set. (Can happen if we have empty quality changes).
             if flat_extruder_quality.getMetaDataEntry("quality_type", None) is None:
-                flat_extruder_quality.addMetaDataEntry("quality_type", extruder.findContainer({"type": "quality"}).getMetaDataEntry("quality_type", "normal"))
+                flat_extruder_quality.addMetaDataEntry("quality_type", extruder.quality.getMetaDataEntry("quality_type", "normal"))
             extruder_serialized = flat_extruder_quality.serialize()
             data.setdefault("extruder_quality", []).append(extruder_serialized)