WIP fix sacrificial layer.cpp (#13018)

* fix sacrificial layer.cpp

Fix sacrificial layer edgecase , with 2 perimeters only

* copilot suggsetions

* one perimeter left

Update PerimeterGenerator.cpp

* Update offset calculation in PerimeterGenerator

Adjust the offset calculation for unsupported filtered polygons.
This commit is contained in:
Rodrigo Faselli
2026-04-26 09:31:56 -03:00
committed by GitHub
parent 6242b0e8cd
commit 08463f02c4

View File

@@ -1729,8 +1729,12 @@ void PerimeterGenerator::process_no_bridge(Surfaces& all_surfaces, coord_t perim
//compute our unsupported surface
ExPolygons unsupported = diff_ex(last, *this->lower_slices, ApplySafetyOffset::Yes);
if (!unsupported.empty()) {
//remove small overhangs
ExPolygons unsupported_filtered = offset2_ex(unsupported, double(-perimeter_spacing), double(perimeter_spacing));
// remove small overhangs (when using chbFilled we need to be less aggressive in removing small overhangs,
// to avoid affecting bridging detection.)
const int outset_divisor = this->config->counterbore_hole_bridging.value == chbFilled ? 2 : 1;
ExPolygons unsupported_filtered = offset2_ex(unsupported, double(-perimeter_spacing),
double(perimeter_spacing) / outset_divisor);
if (!unsupported_filtered.empty()) {
//to_draw.insert(to_draw.end(), last.begin(), last.end());
//extract only the useful part of the lower layer. The safety offset is really needed here.
@@ -1773,7 +1777,7 @@ void PerimeterGenerator::process_no_bridge(Surfaces& all_surfaces, coord_t perim
}
}
unsupported_filtered = intersection_ex(last,
offset2_ex(unsupported_filtered, double(-perimeter_spacing / 2), double(bridged_infill_margin + perimeter_spacing / 2)));
offset_ex(unsupported_filtered, 0.5 * double(bridged_infill_margin)));
if (this->config->counterbore_hole_bridging.value == chbFilled) {
for (ExPolygon& expol : unsupported_filtered) {
//check if the holes won't be covered by the upper layer