From 983aca76693b0e2b82fc0608cbebd9c55e1267c2 Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Wed, 6 Mar 2024 14:57:13 +0800 Subject: [PATCH] FIX:repairing models during cutting allows cancellation Jira: STUDIO-6308 Change-Id: I217a8e55c0d5fdcc29a33c7e7c3401cc08307561 --- src/libslic3r/CutUtils.cpp | 6 +++++- src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/CutUtils.cpp b/src/libslic3r/CutUtils.cpp index 73f41cb2c..65663d9be 100644 --- a/src/libslic3r/CutUtils.cpp +++ b/src/libslic3r/CutUtils.cpp @@ -320,9 +320,13 @@ const ModelObjectPtrs &Cut::perform_with_plane() mo->clone_for_cut(&upper); ModelObject *lower{nullptr}; - if (m_attributes.has(ModelObjectCutAttribute::KeepLower) && !m_attributes.has(ModelObjectCutAttribute::CutToParts)) + if (m_attributes.has(ModelObjectCutAttribute::KeepLower) && !m_attributes.has(ModelObjectCutAttribute::CutToParts)) mo->clone_for_cut(&lower); + if (upper && lower &&!m_attributes.has(ModelObjectCutAttribute::CutToParts)) { + upper->name = upper->name + "_A"; + lower->name = lower->name + "_B"; + } std::vector dowels; // Because transformations are going to be applied to meshes directly, diff --git a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp index 00406f597..777ffa21f 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp @@ -904,6 +904,7 @@ void GLGizmoAdvancedCut::perform_cut(const Selection& selection) if (is_windows10()) { bool is_showed_dialog = false; bool user_fix_model = false; + Plater::TakeSnapshot snapshot(plater, "RepairingModelObjectInCut"); for (size_t i = 0; i < new_objects.size(); i++) { for (size_t j = 0; j < new_objects[i]->volumes.size(); j++) { if (its_num_open_edges(new_objects[i]->volumes[j]->mesh().its) > 0) { @@ -928,7 +929,8 @@ void GLGizmoAdvancedCut::perform_cut(const Selection& selection) wxString msg = _L("Repairing model object"); msg += ": " + from_u8(model_name) + "\n"; std::string res; - if (!fix_model_by_win10_sdk_gui(*model_object, vol_idx, progress_dlg, msg, res)) return false; + if (!fix_model_by_win10_sdk_gui(*model_object, vol_idx, progress_dlg, msg, res)) + return false; return true; }; ProgressDialog progress_dlg(_L("Repairing model object"), "", 100, find_toplevel_parent(plater), wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT, true); @@ -936,6 +938,7 @@ void GLGizmoAdvancedCut::perform_cut(const Selection& selection) auto model_name = new_objects[i]->name; if (!fix_and_update_progress(new_objects[i], j, model_name, progress_dlg, succes_models, failed_models)) { BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "run fix_and_update_progress error"; + plater->take_snapshot("RepairingModelObjectInCut"); }; }; }