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.
This commit is contained in:
Vojtech Bubnik 2021-02-05 17:58:55 +01:00
parent c2e956c6d1
commit aa4c018cd5

View File

@ -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;
}