From 7813b52fe97b5c76f6970da841da4b7a7d7fcd8c Mon Sep 17 00:00:00 2001 From: Arthur Date: Wed, 16 Oct 2024 11:32:39 +0800 Subject: [PATCH] FIX: skip auto arrange when switching from small to big jira: STUDIO-8464 Change-Id: I4bdfb89f8cfa94a1dd68427ab03072c42a8705bc --- src/slic3r/GUI/Plater.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f500508e6..f79482ddd 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -6467,6 +6467,7 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt) PartPlateList& old_plate_list = this->partplate_list; PartPlate* old_plate = old_plate_list.get_selected_plate(); Vec3d old_plate_pos = old_plate->get_center_origin(); + Vec3d old_plate_size = old_plate->get_plate_box().size(); // BBS: Save the model in the current platelist std::vector > plate_object; @@ -6536,15 +6537,20 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt) PartPlateList& cur_plate_list = this->partplate_list; PartPlate* cur_plate = cur_plate_list.get_curr_plate(); Vec3d cur_plate_pos = cur_plate->get_center_origin(); + Vec3d cur_plate_size = cur_plate->get_bounding_box().size(); + bool cur_plate_is_smaller = cur_plate_size.x() + 1.0 < old_plate_size.x() || cur_plate_size.y() + 1.0 < old_plate_size.y(); + BOOST_LOG_TRIVIAL(info) << format("change bed pos from (%.0f,%.0f) to (%.0f,%.0f)", old_plate_pos.x(), old_plate_pos.y(), cur_plate_pos.x(), cur_plate_pos.y()); - if (old_plate_pos.x() != cur_plate_pos.x() || old_plate_pos.y() != cur_plate_pos.y()) { + if (old_plate_pos.x() != cur_plate_pos.x() || old_plate_pos.y() != cur_plate_pos.y() || cur_plate_is_smaller) { for (int i = 0; i < plate_object.size(); ++i) { view3D->select_object_from_idx(plate_object[i]); this->sidebar->obj_list()->update_selections(); view3D->center_selected_plate(i); } - if (std::any_of(plate_object.begin(), plate_object.end(), [](const std::vector &obj_idxs) { return !obj_idxs.empty(); })) { + BOOST_LOG_TRIVIAL(info) << format("change bed size from (%.0f,%.0f) to (%.0f,%.0f)", old_plate_size.x(), old_plate_size.y(), cur_plate_size.x(), cur_plate_size.y()); + if (cur_plate_is_smaller && + std::any_of(plate_object.begin(), plate_object.end(), [](const std::vector &obj_idxs) { return !obj_idxs.empty(); })) { take_snapshot("Arrange after bed size changes"); q->set_prepare_state(Job::PREPARE_STATE_OUTSIDE_BED); q->arrange();