From 277d48bd510dbbe48d9ced2ef7b40b83a2c7ee5c Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Fri, 13 Oct 2023 09:27:57 +0200 Subject: [PATCH 1/2] 3mf Meshes load in correct location CURA-9755 --- plugins/3MFReader/ThreeMFReader.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/3MFReader/ThreeMFReader.py b/plugins/3MFReader/ThreeMFReader.py index e06e9dcf4e..7675a3f040 100755 --- a/plugins/3MFReader/ThreeMFReader.py +++ b/plugins/3MFReader/ThreeMFReader.py @@ -186,6 +186,14 @@ class ThreeMFReader(MeshReader): if len(um_node.getAllChildren()) == 1: # We don't want groups of one, so move the node up one "level" child_node = um_node.getChildren()[0] + # Move all the meshes of children so that toolhandles are shown in the correct place. + if child_node.getMeshData(): + print("child name: ", child_node.getId()) + extents = child_node.getMeshData().getExtents() + m = Matrix() + m.translate(-extents.center) + child_node.setMeshData(child_node.getMeshData().getTransformed(m)) + child_node.translate(extents.center) parent_transformation = um_node.getLocalTransformation() child_transformation = child_node.getLocalTransformation() child_node.setTransformation(parent_transformation.multiply(child_transformation)) From 7880cb5bdeb6e0c5b494b245fe3703866bd524b5 Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Fri, 13 Oct 2023 11:29:44 +0200 Subject: [PATCH 2/2] remove debug statement CURA-9755 --- plugins/3MFReader/ThreeMFReader.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/3MFReader/ThreeMFReader.py b/plugins/3MFReader/ThreeMFReader.py index 7675a3f040..13a97d5a89 100755 --- a/plugins/3MFReader/ThreeMFReader.py +++ b/plugins/3MFReader/ThreeMFReader.py @@ -188,11 +188,10 @@ class ThreeMFReader(MeshReader): child_node = um_node.getChildren()[0] # Move all the meshes of children so that toolhandles are shown in the correct place. if child_node.getMeshData(): - print("child name: ", child_node.getId()) extents = child_node.getMeshData().getExtents() - m = Matrix() - m.translate(-extents.center) - child_node.setMeshData(child_node.getMeshData().getTransformed(m)) + move_matrix = Matrix() + move_matrix.translate(-extents.center) + child_node.setMeshData(child_node.getMeshData().getTransformed(move_matrix)) child_node.translate(extents.center) parent_transformation = um_node.getLocalTransformation() child_transformation = child_node.getLocalTransformation()