From 6883919a7bbabf68830c19d5cc50f05367a2c604 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Mon, 29 Nov 2021 16:33:44 +0100 Subject: [PATCH] Fixed handling of "clip_multipart_objects". This was a regression of 2.4.0-alpha1 wrt. 2.3.3, where handling of multiple volumes was refactored. As a result, handling multi-part objects with clip_multipart_objects disabled was broken. With clip_multipart_objects disabled, the multi-part objects no more clip one another and it is sole responsibility of the user to handle overlaps. Fixes "add part" error - PrusaSlicer 2.4.0 b2 #7366 --- src/libslic3r/PrintObjectSlice.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libslic3r/PrintObjectSlice.cpp b/src/libslic3r/PrintObjectSlice.cpp index 84b212938..4b91714e5 100644 --- a/src/libslic3r/PrintObjectSlice.cpp +++ b/src/libslic3r/PrintObjectSlice.cpp @@ -379,11 +379,7 @@ static std::vector> slices_to_regions( int j = i; bool merged = false; ExPolygons &expolygons = temp_slices[i].expolygons; - for (++ j; - j < int(temp_slices.size()) && - temp_slices[i].region_id == temp_slices[j].region_id && - (clip_multipart_objects || temp_slices[i].volume_id == temp_slices[j].volume_id); - ++ j) + for (++ j; j < int(temp_slices.size()) && temp_slices[i].region_id == temp_slices[j].region_id; ++ j) if (ExPolygons &expolygons2 = temp_slices[j].expolygons; ! expolygons2.empty()) { if (expolygons.empty()) { expolygons = std::move(expolygons2); @@ -392,7 +388,10 @@ static std::vector> slices_to_regions( merged = true; } } - if (merged) + // Don't unite the regions if ! clip_multipart_objects. In that case it is user's responsibility + // to handle region overlaps. Indeed, one may intentionally let the regions overlap to produce crossing perimeters + // for example. + if (merged && clip_multipart_objects) expolygons = closing_ex(expolygons, float(scale_(EPSILON))); slices_by_region[temp_slices[i].region_id][z_idx] = std::move(expolygons); i = j;