From 878d17605c0585dcfb895e9302a99e6611022bf4 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 14 Jun 2013 16:48:24 +0200 Subject: [PATCH] Ignore solid_infill_every_layers when fill_density is 0. Includes regression test. #1240 --- lib/Slic3r/Print/Object.pm | 3 ++- t/fill.t | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index bfc46ce62..88a445f03 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -597,7 +597,8 @@ sub discover_horizontal_shells { for (my $i = 0; $i < $self->layer_count; $i++) { 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) for grep $_->surface_type == S_TYPE_INTERNAL, @{$layerm->fill_surfaces}; } diff --git a/t/fill.t b/t/fill.t index e0fdd3cc0..4665a0c49 100644 --- a/t/fill.t +++ b/t/fill.t @@ -2,7 +2,7 @@ use Test::More; use strict; use warnings; -plan tests => 9; +plan tests => 10; BEGIN { use FindBin; @@ -109,14 +109,17 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ } $config->set('top_solid_layers', 0); $config->set('bottom_solid_layers', 0); $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 %layers_with_extrusion = (); Slic3r::GCode::Reader->new(gcode => Slic3r::Test::gcode($print))->parse(sub { my ($self, $cmd, $args, $info) = @_; - - fail "solid_infill_below_area should be ignored when fill_density is 0" - if $info->{extruding}; + $layers_with_extrusion{$self->Z} = 1 if $info->{extruding}; }); + + ok !%layers_with_extrusion, + "solid_infill_below_area and solid_infill_every_layers are ignored when fill_density is 0"; } __END__