From e7e24caf97851f999c807fc88e9588fbd42108b2 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Fri, 22 Sep 2017 09:31:11 +0200 Subject: [PATCH] CURA-4269 small code improvement for z-offset in project loading --- plugins/3MFReader/ThreeMFReader.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/3MFReader/ThreeMFReader.py b/plugins/3MFReader/ThreeMFReader.py index c264c381f8..283a685498 100755 --- a/plugins/3MFReader/ThreeMFReader.py +++ b/plugins/3MFReader/ThreeMFReader.py @@ -204,10 +204,11 @@ class ThreeMFReader(MeshReader): # Pre multiply the transformation with the loaded transformation, so the data is handled correctly. um_node.setTransformation(um_node.getLocalTransformation().preMultiply(transformation_matrix)) - # If the object in a saved project is below the bed, keep it that way - if um_node.getMeshData() != None and um_node.getMeshData().getExtents(um_node.getWorldTransformation()).minimum.y < 0: + # Check if the model is positioned below the build plate and honor that when loading project files. + if um_node.getMeshData() is not None: + z_offset_value = um_node.getMeshData().getExtents(um_node.getWorldTransformation()).minimum.y um_node.addDecorator(ZOffsetDecorator()) - um_node.callDecoration("setZOffset",um_node.getMeshData().getExtents(um_node.getWorldTransformation()).minimum.y) + um_node.callDecoration("setZOffset", z_offset_value) result.append(um_node)