From 26a6cb21296cf8472639f26714f2ac5e6690ee34 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Thu, 2 Dec 2021 18:18:26 +0100 Subject: [PATCH] Fixed ironing over areas with modifier meshes: 1) Areas inside modifier meshes were ironed multiple times. 2) Ironing areas were not properly merged. Layer::lslices were not always properly merged with modifier meshes applied, which lead to the ironed surface being split and not fully ironed, as there were artificial gaps created between regions as if they were covered by perimeters (we don't iron over perimeters). --- src/libslic3r/Fill/Fill.cpp | 20 +++++++++++++------- src/libslic3r/Layer.cpp | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index 726ba17a44..a3e4aee311 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -539,7 +539,7 @@ void Layer::make_ironing() fill_params.density = 1.; fill_params.monotonic = true; - for (size_t i = 0; i < by_extruder.size(); ++ i) { + for (size_t i = 0; i < by_extruder.size();) { // Find span of regions equivalent to the ironing operation. IroningParams &ironing_params = by_extruder[i]; size_t j = i; @@ -589,14 +589,17 @@ void Layer::make_ironing() polygons_append(infills, surface.expolygon); } } + + if (! infills.empty() || j > i + 1) { + // Ironing over more than a single region or over solid internal infill. + if (! infills.empty()) + // For IroningType::AllSolid only: + // Add solid infill areas for layers, that contain some non-ironable infil (sparse infill, bridge infill). + append(polys, std::move(infills)); + polys = union_safety_offset(polys); + } // Trim the top surfaces with half the nozzle diameter. ironing_areas = intersection_ex(polys, offset(this->lslices, - float(scale_(0.5 * nozzle_dmr)))); - if (! infills.empty()) { - // For IroningType::AllSolid only: - // Add solid infill areas for layers, that contain some non-ironable infil (sparse infill, bridge infill). - append(infills, to_polygons(std::move(ironing_areas))); - ironing_areas = union_safety_offset_ex(infills); - } } // Create the filler object. @@ -626,6 +629,9 @@ void Layer::make_ironing() flow_mm3_per_mm, extrusion_width, float(extrusion_height)); } } + + // Regions up to j were processed. + i = j; } } diff --git a/src/libslic3r/Layer.cpp b/src/libslic3r/Layer.cpp index 39228516c0..5c661ed68b 100644 --- a/src/libslic3r/Layer.cpp +++ b/src/libslic3r/Layer.cpp @@ -45,7 +45,7 @@ void Layer::make_slices() Polygons slices_p; for (LayerRegion *layerm : m_regions) polygons_append(slices_p, to_polygons(layerm->slices.surfaces)); - slices = union_ex(slices_p); + slices = union_safety_offset_ex(slices_p); } this->lslices.clear();