Since prepare_infill is not actually idempotent, recalculate perimeters every time. #3827

This commit is contained in:
Alessandro Ranellucci 2017-04-04 17:10:43 +02:00
parent 1cd4bca648
commit de1c900d8f
3 changed files with 22 additions and 9 deletions

View File

@ -155,12 +155,18 @@ sub detect_surfaces_type {
sub prepare_infill { sub prepare_infill {
my ($self) = @_; my ($self) = @_;
# prerequisites
$self->make_perimeters; # do we need them? TODO: check
$self->detect_surfaces_type;
return if $self->step_done(STEP_PREPARE_INFILL); return if $self->step_done(STEP_PREPARE_INFILL);
$self->set_step_started(STEP_PREPARE_INFILL); $self->set_step_started(STEP_PREPARE_INFILL);
# This prepare_infill() is not really idempotent.
# TODO: It should clear and regenerate fill_surfaces at every run
# instead of modifying it in place.
$self->invalidate_step(STEP_PERIMETERS);
$self->make_perimeters;
# prerequisites
$self->detect_surfaces_type;
$self->print->status_cb->(30, "Preparing infill"); $self->print->status_cb->(30, "Preparing infill");
# decide what surfaces are to be filled # decide what surfaces are to be filled

View File

@ -66,7 +66,7 @@ LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollection*
g.process(); g.process();
} }
// This function reads layer->slices andlower_layer->slices // This function reads layer->slices and lower_layer->slices
// and writes this->bridged and this->fill_surfaces, so it's thread-safe. // and writes this->bridged and this->fill_surfaces, so it's thread-safe.
void void
LayerRegion::process_external_surfaces() LayerRegion::process_external_surfaces()
@ -106,7 +106,6 @@ LayerRegion::process_external_surfaces()
} }
SurfaceCollection bottom; SurfaceCollection bottom;
Polygons removed_holes;
for (const Surface &surface : surfaces) { for (const Surface &surface : surfaces) {
if (!surface.is_bottom()) continue; if (!surface.is_bottom()) continue;

View File

@ -85,11 +85,19 @@ PrintRegion::invalidate_state_by_config(const PrintConfigBase &config)
steps.insert(posPerimeters); steps.insert(posPerimeters);
} else if (opt_key == "first_layer_extrusion_width") { } else if (opt_key == "first_layer_extrusion_width") {
steps.insert(posSupportMaterial); steps.insert(posSupportMaterial);
} else if (opt_key == "solid_infill_below_area") {
const float &cur_value = config.opt<ConfigOptionFloat>(opt_key)->value;
const float &new_value = this->config.solid_infill_below_area.value;
if (new_value >= cur_value) {
steps.insert(posPrepareInfill);
} else {
// prepare_infill is not idempotent when solid_infill_below_area is reduced
steps.insert(posPerimeters);
}
} else if (opt_key == "infill_every_layers" } else if (opt_key == "infill_every_layers"
|| opt_key == "solid_infill_every_layers" || opt_key == "solid_infill_every_layers"
|| opt_key == "bottom_solid_layers" || opt_key == "bottom_solid_layers"
|| opt_key == "top_solid_layers" || opt_key == "top_solid_layers"
|| opt_key == "solid_infill_below_area"
|| opt_key == "infill_extruder" || opt_key == "infill_extruder"
|| opt_key == "solid_infill_extruder" || opt_key == "solid_infill_extruder"
|| opt_key == "infill_extrusion_width") { || opt_key == "infill_extrusion_width") {
@ -108,10 +116,10 @@ PrintRegion::invalidate_state_by_config(const PrintConfigBase &config)
} else if (opt_key == "fill_density") { } else if (opt_key == "fill_density") {
const float &cur_value = config.opt<ConfigOptionFloat>("fill_density")->value; const float &cur_value = config.opt<ConfigOptionFloat>("fill_density")->value;
const float &new_value = this->config.fill_density.value; const float &new_value = this->config.fill_density.value;
if ((cur_value == 0) != (new_value == 0)) if ((cur_value == 0) != (new_value == 0) || (cur_value == 100) != (new_value == 100))
steps.insert(posPerimeters); steps.insert(posPerimeters);
steps.insert(posPrepareInfill); steps.insert(posInfill);
} else if (opt_key == "external_perimeter_extrusion_width" } else if (opt_key == "external_perimeter_extrusion_width"
|| opt_key == "perimeter_extruder") { || opt_key == "perimeter_extruder") {
steps.insert(posPerimeters); steps.insert(posPerimeters);