Ignore solid_infill_every_layers when fill_density is 0. Includes regression test. #1240

This commit is contained in:
Alessandro Ranellucci 2013-06-14 16:48:24 +02:00
parent 145fe08203
commit 878d17605c
2 changed files with 9 additions and 5 deletions

View File

@ -597,7 +597,8 @@ sub discover_horizontal_shells {
for (my $i = 0; $i < $self->layer_count; $i++) { for (my $i = 0; $i < $self->layer_count; $i++) {
my $layerm = $self->layers->[$i]->regions->[$region_id]; my $layerm = $self->layers->[$i]->regions->[$region_id];
if ($Slic3r::Config->solid_infill_every_layers && ($i % $Slic3r::Config->solid_infill_every_layers) == 0) { if ($Slic3r::Config->solid_infill_every_layers && $Slic3r::Config->fill_density > 0
&& ($i % $Slic3r::Config->solid_infill_every_layers) == 0) {
$_->surface_type(S_TYPE_INTERNALSOLID) $_->surface_type(S_TYPE_INTERNALSOLID)
for grep $_->surface_type == S_TYPE_INTERNAL, @{$layerm->fill_surfaces}; for grep $_->surface_type == S_TYPE_INTERNAL, @{$layerm->fill_surfaces};
} }

View File

@ -2,7 +2,7 @@ use Test::More;
use strict; use strict;
use warnings; use warnings;
plan tests => 9; plan tests => 10;
BEGIN { BEGIN {
use FindBin; use FindBin;
@ -109,14 +109,17 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
$config->set('top_solid_layers', 0); $config->set('top_solid_layers', 0);
$config->set('bottom_solid_layers', 0); $config->set('bottom_solid_layers', 0);
$config->set('solid_infill_below_area', 20000000); $config->set('solid_infill_below_area', 20000000);
$config->set('solid_infill_every_layers', 2);
my $print = Slic3r::Test::init_print('20mm_cube', config => $config); my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
my %layers_with_extrusion = ();
Slic3r::GCode::Reader->new(gcode => Slic3r::Test::gcode($print))->parse(sub { Slic3r::GCode::Reader->new(gcode => Slic3r::Test::gcode($print))->parse(sub {
my ($self, $cmd, $args, $info) = @_; my ($self, $cmd, $args, $info) = @_;
$layers_with_extrusion{$self->Z} = 1 if $info->{extruding};
fail "solid_infill_below_area should be ignored when fill_density is 0"
if $info->{extruding};
}); });
ok !%layers_with_extrusion,
"solid_infill_below_area and solid_infill_every_layers are ignored when fill_density is 0";
} }
__END__ __END__