From aa4c018cd5857814ed9ac0cd93d526f3f172d4ab Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Fri, 5 Feb 2021 17:58:55 +0100 Subject: [PATCH] Fix of Slicing hangs when Infill Percentage set very low #5910 When passing a PrintRegionConfig to the slicing back end, zero an infill density if it is already nearly zero. This avoids an ugly division by zero in the infill code and it also makes clear to the back end that we don't want an infill. --- src/libslic3r/PrintObject.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index d639d03c8..2fe93ec07 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -1601,6 +1601,12 @@ PrintRegionConfig PrintObject::region_config_from_model_volume(const PrintRegion clamp_exturder_to_default(config.infill_extruder, num_extruders); clamp_exturder_to_default(config.perimeter_extruder, num_extruders); clamp_exturder_to_default(config.solid_infill_extruder, num_extruders); + if (config.fill_density.value < 0.00011f) + // Switch of infill for very low infill rates, also avoid division by zero in infill generator for these very low rates. + // See GH issue #5910. + config.fill_density.value = 0; + else + config.fill_density.value = std::min(config.fill_density.value, 1.); return config; }