Revert a recent change made to shells generation, causing too much solid infill. Includes regression test. #1431

This commit is contained in:
Alessandro Ranellucci 2013-09-17 19:24:16 +02:00
parent 2c1274e2d9
commit 39449f9245
3 changed files with 39 additions and 6 deletions

View file

@ -539,8 +539,6 @@ sub discover_horizontal_shells {
Slic3r::debugf "==> DISCOVERING HORIZONTAL SHELLS\n";
my $margin = scale &Slic3r::EXTERNAL_INFILL_MARGIN;
for my $region_id (0 .. ($self->print->regions_count-1)) {
for (my $i = 0; $i < $self->layer_count; $i++) {
my $layerm = $self->layers->[$i]->regions->[$region_id];
@ -557,8 +555,13 @@ sub discover_horizontal_shells {
# fill_surfaces though. Using both ungrown slices and grown fill_surfaces will
# not work in some situations, as there won't be any grown region in the perimeter
# area (this was seen in a model where the top layer had one extra perimeter, thus
# its fill_surfaces was thinner than the lower layer's infill)
my $solid = offset([ map $_->p, @{$layerm->slices->filter_by_type($type)} ], $margin);
# its fill_surfaces were thinner than the lower layer's infill), however it's the best
# solution so far. Growing the external slices by EXTERNAL_INFILL_MARGIN will put
# too much solid infill inside nearly-vertical slopes.
my $solid = [
(map $_->p, @{$layerm->slices->filter_by_type($type)}),
(map $_->p, @{$layerm->fill_surfaces->filter_by_type($type)}),
];
next if !@$solid;
Slic3r::debugf "Layer %d has %s surfaces\n", $i, ($type == S_TYPE_TOP) ? 'top' : 'bottom';

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
use Test::More tests => 11;
use Test::More tests => 12;
use strict;
use warnings;
@ -115,6 +115,29 @@ use Slic3r::Test;
"shells are not propagated across perimeters of the neighbor layer";
}
{
my $config = Slic3r::Config->new_from_defaults;
$config->set('perimeters', 3);
$config->set('cooling', 0); # prevent speed alteration
$config->set('first_layer_speed', '100%'); # prevent speed alteration
$config->set('layer_height', 0.4);
$config->set('first_layer_height', '100%');
$config->set('bottom_solid_layers', 3);
$config->set('top_solid_layers', 3);
$config->set('solid_infill_speed', 99);
$config->set('top_solid_infill_speed', 99);
my $print = Slic3r::Test::init_print('sloping_hole', config => $config);
my %solid_layers = (); # Z => 1
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
my ($self, $cmd, $args, $info) = @_;
$solid_layers{$self->Z} = 1
if $info->{extruding} && ($args->{F} // $self->F) == $config->solid_infill_speed*60;
});
is scalar(keys %solid_layers), $config->bottom_solid_layers + $config->top_solid_layers,
"no superfluous shells are generated";
}
{
my $config = Slic3r::Config->new_from_defaults;
$config->set('spiral_vase', 1);