From c2a1a8c39b2c18d1666627f00c68de60b88ce90c Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Sun, 30 Mar 2025 00:05:06 +0800 Subject: [PATCH] Use different threshold for top & bottom surfaces --- src/libslic3r/PrintObject.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 6db0900349..80adfc7a24 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -1312,7 +1312,8 @@ void PrintObject::detect_surfaces_type() Layer *upper_layer = (idx_layer + 1 < this->layer_count()) ? m_layers[idx_layer + 1] : nullptr; Layer *lower_layer = (idx_layer > 0) ? m_layers[idx_layer - 1] : nullptr; // collapse very narrow parts (using the safety offset in the diff is not enough) - float offset = layerm->flow(frExternalPerimeter).scaled_width() / 10.f; + const float offset_top = layerm->flow(frExternalPerimeter).scaled_width() / 10.f; + const float offset_bottom = layerm->flow(frExternalPerimeter).scaled_width(); ExPolygons layerm_slices_surfaces = to_expolygons(layerm->slices.surfaces); // no_perimeter_full_bridge allow to put bridges where there are nothing, hence adding area to slice, that's why we need to start from the result of PerimeterGenerator. @@ -1327,7 +1328,7 @@ void PrintObject::detect_surfaces_type() ExPolygons upper_slices = interface_shells ? diff_ex(layerm_slices_surfaces, upper_layer->m_regions[region_id]->slices.surfaces, ApplySafetyOffset::Yes) : diff_ex(layerm_slices_surfaces, upper_layer->lslices, ApplySafetyOffset::Yes); - surfaces_append(top, opening_ex(upper_slices, offset), stTop); + surfaces_append(top, opening_ex(upper_slices, offset_top), stTop); } else { // if no upper layer, all surfaces of this one are solid // we clone surfaces because we're going to clear the slices collection @@ -1353,7 +1354,7 @@ void PrintObject::detect_surfaces_type() bottom, opening_ex( diff_ex(layerm_slices_surfaces, lower_layer->lslices, ApplySafetyOffset::Yes), - offset), + offset_bottom), surface_type_bottom_other); // if user requested internal shells, we need to identify surfaces // lying on other slices not belonging to this region @@ -1367,7 +1368,7 @@ void PrintObject::detect_surfaces_type() intersection(layerm_slices_surfaces, lower_layer->lslices), // supported lower_layer->m_regions[region_id]->slices.surfaces, ApplySafetyOffset::Yes), - offset), + offset_bottom), stBottom); } #endif @@ -1385,7 +1386,7 @@ void PrintObject::detect_surfaces_type() if (! top.empty() && ! bottom.empty()) { const auto cracks = intersection_ex(top, bottom); if (!cracks.empty()) { - const float small_crack_threshold = -(layerm->flow(frExternalPerimeter).scaled_width()); + const float small_crack_threshold = -offset_bottom; for (const auto& crack : cracks) { if (offset_ex(crack, small_crack_threshold).empty()) {