FIX: merge the patch from Prusa

Thanks for PrusaSlicer and YuSanka
Jira:STUDIO-5175
commit 510d59687b3b19c4a0f4e6540620d0694dd1b7ac
Author: YuSanka <yusanka@gmail.com>
Date:   Thu Oct 5 14:13:14 2023 +0200
    Follow-up 1b451cdf: Fixed #11415 - Connectors disappear when slicing => only when using multiple cut planes AND excluding parts

Change-Id: I9ccd5b85f482d723d21fccf5e104c9e0a9cc4849
This commit is contained in:
zhou.xu 2023-11-08 18:37:44 +08:00 committed by Lane.Wei
parent dfa707fc7a
commit f5637dac77
2 changed files with 11 additions and 8 deletions

View File

@ -471,6 +471,10 @@ const ModelObjectPtrs &Cut::perform_by_contour(std::vector<Part> parts, int dowe
// Just add Upper and Lower objects to cut_object_ptrs // Just add Upper and Lower objects to cut_object_ptrs
post_process(upper, lower, cut_object_ptrs); post_process(upper, lower, cut_object_ptrs);
// Now merge all model parts together:
merge_solid_parts_inside_object(cut_object_ptrs);
finalize(cut_object_ptrs);
} else if (volumes.size() > cut_parts_cnt) { } else if (volumes.size() > cut_parts_cnt) {
// Means that object is cut with connectors // Means that object is cut with connectors
@ -493,16 +497,15 @@ const ModelObjectPtrs &Cut::perform_by_contour(std::vector<Part> parts, int dowe
// Add Upper and Lower objects to cut_object_ptrs // Add Upper and Lower objects to cut_object_ptrs
post_process(upper, lower, cut_object_ptrs); post_process(upper, lower, cut_object_ptrs);
// Now merge all model parts together:
merge_solid_parts_inside_object(cut_object_ptrs);
finalize(cut_object_ptrs);
// Add Dowel-connectors as separate objects to cut_object_ptrs // Add Dowel-connectors as separate objects to cut_object_ptrs
if (cut_connectors_obj.size() >= 3) if (cut_connectors_obj.size() >= 3)
for (size_t id = 2; id < cut_connectors_obj.size(); id++) cut_object_ptrs.push_back(cut_connectors_obj[id]); for (size_t id = 2; id < cut_connectors_obj.size(); id++)
m_model.add_object(*cut_connectors_obj[id]);
} }
// Now merge all model parts together:
merge_solid_parts_inside_object(cut_object_ptrs);
finalize(cut_object_ptrs);
return m_model.objects; return m_model.objects;
} }

View File

@ -888,7 +888,7 @@ void GLGizmoAdvancedCut::perform_cut(const Selection& selection)
const bool has_connectors = !mo->cut_connectors.empty(); const bool has_connectors = !mo->cut_connectors.empty();
// update connectors pos as offset of its center before cut performing // update connectors pos as offset of its center before cut performing
apply_connectors_in_model(cut_mo, dowels_count); apply_connectors_in_model(cut_mo, dowels_count);
if (dowels_count > 0) { cut_by_contour = false; }
wxBusyCursor wait; wxBusyCursor wait;
ModelObjectCutAttributes attributes = only_if(has_connectors ? true : m_keep_upper, ModelObjectCutAttribute::KeepUpper) | ModelObjectCutAttributes attributes = only_if(has_connectors ? true : m_keep_upper, ModelObjectCutAttribute::KeepUpper) |