From a5cc52beb7eef5848368e660ca4f14e95ad5f7d5 Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Tue, 28 May 2024 18:11:28 +0800 Subject: [PATCH] FIX:z offset is error after copy and paste several objects jira: STUDIO-6753 STUDIO-7135 Change-Id: I6d9c8eb0c957ff1e3194709704ceb6c3920baa4f (cherry picked from commit 847a7141a6f47e409566b19e73c0ebdeb08f39e2) --- src/slic3r/GUI/Selection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 9bb74d1a8..857197447 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -3008,14 +3008,14 @@ void Selection::paste_objects_from_clipboard() Vec3d displacement; bool in_current = plate->intersects(bbox); auto start_point = in_current ? bbox.center() : plate->get_build_volume().center(); + auto start_offset = in_current ? src_object->instances.front()->get_offset() : plate->get_build_volume().center(); if (shift_all(0) != 0 || shift_all(1) != 0) { // BBS: if multiple objects are selected, move them as a whole after copy if (i == 0) empty_cell_all = wxGetApp().plater()->canvas3D()->get_nearest_empty_cell({start_point(0), start_point(1)}, {bbox.size()(0)+1,bbox.size()(1)+1}); auto instance_shift = src_object->instances.front()->get_offset() - src_objects[0]->instances.front()->get_offset(); - displacement = {shift_all.x() + empty_cell_all.x()+instance_shift.x(), shift_all.y() + empty_cell_all.y()+instance_shift.y(), start_point(2)}; + displacement = {shift_all.x() + empty_cell_all.x() + instance_shift.x(), shift_all.y() + empty_cell_all.y() + instance_shift.y(), start_offset(2)}; } else { // BBS: if only one object is copied, find an empty cell to put it - auto start_offset = in_current ? src_object->instances.front()->get_offset() : plate->get_build_volume().center(); auto point_offset = start_offset - start_point; auto empty_cell = wxGetApp().plater()->canvas3D()->get_nearest_empty_cell({start_point(0), start_point(1)}, {bbox.size()(0)+1, bbox.size()(1)+1}); displacement = {empty_cell.x() + point_offset.x(), empty_cell.y() + point_offset.y(), start_offset(2)};