From a91d043d67a8e764e9bb323ae43d3b87253cb1f8 Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Mon, 16 Jan 2023 10:10:32 +0800 Subject: [PATCH] FIX: The relative position is incorrect when loading part Change-Id: Ie176d69631589e414048c61cfb3ca2128f8f9ead (cherry picked from commit de33e37829b62579218d4c5f307104604dabbbc0) --- src/slic3r/GUI/GUI_ObjectList.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 79b8eae520..1c9a5b5d8c 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1923,11 +1923,9 @@ void ObjectList::load_modifier(const wxArrayString& input_files, ModelObject& mo ModelVolume* new_volume = model_object.add_volume(std::move(mesh), type); new_volume->name = boost::filesystem::path(input_file).filename().string(); - // adjust the position according to the bounding box - const BoundingBoxf3 mesh_bb = new_volume->mesh().bounding_box(); - new_volume->set_transformation(Geometry::Transformation::volume_to_bed_transformation(v->get_instance_transformation(), mesh_bb)); - auto offset = Vec3d(instance_bb.max.x(), instance_bb.min.y(), instance_bb.min.z()) + 0.5 * mesh_bb.size() - v->get_instance_offset(); - new_volume->set_offset(v->get_instance_transformation().get_matrix(true).inverse() * offset); + // BBS: object_mesh.get_init_shift() keep the relative position + TriangleMesh object_mesh = model_object.volumes[0]->mesh(); + new_volume->set_offset(new_volume->mesh().get_init_shift() - object_mesh.get_init_shift()); // set a default extruder value, since user can't add it manually // BBS