Fixed regression when using --infill-only-where-needed. Includes regression test. #1721

This commit is contained in:
Alessandro Ranellucci 2014-02-16 12:44:08 +01:00
parent 35095ff12e
commit 9ec7ae08ad
2 changed files with 12 additions and 5 deletions

View file

@ -416,8 +416,8 @@ sub clip_fill_surfaces {
my $overhangs = []; # arrayref of polygons my $overhangs = []; # arrayref of polygons
for my $layer_id (reverse 0..$#{$self->layers}) { for my $layer_id (reverse 0..$#{$self->layers}) {
my $layer = $self->layers->[$layer_id]; my $layer = $self->layers->[$layer_id];
my @layer_internal = (); my @layer_internal = (); # arrayref of Surface objects
my @new_internal = (); my @new_internal = (); # arrayref of Surface objects
# clip this layer's internal surfaces to @overhangs # clip this layer's internal surfaces to @overhangs
foreach my $layerm (@{$layer->regions}) { foreach my $layerm (@{$layer->regions}) {
@ -451,10 +451,10 @@ sub clip_fill_surfaces {
if ($layer_id > 0) { if ($layer_id > 0) {
my $solid = diff( my $solid = diff(
[ map @$_, @{$layer->slices} ], [ map @$_, @{$layer->slices} ],
\@layer_internal, [ map $_->p, @layer_internal ],
); );
$overhangs = offset($solid, +$additional_margin); $overhangs = offset($solid, +$additional_margin);
push @$overhangs, @new_internal; # propagate upper overhangs push @$overhangs, map $_->p, @new_internal; # propagate upper overhangs
} }
} }
} }

View file

@ -2,7 +2,7 @@ use Test::More;
use strict; use strict;
use warnings; use warnings;
plan tests => 41; plan tests => 42;
BEGIN { BEGIN {
use FindBin; use FindBin;
@ -187,6 +187,13 @@ for my $pattern (qw(rectilinear honeycomb hilbertcurve concentric)) {
ok !(defined first { !$convex_hull->encloses_point($_) } @infill_points), "infill does not exceed perimeters ($pattern)"; ok !(defined first { !$convex_hull->encloses_point($_) } @infill_points), "infill does not exceed perimeters ($pattern)";
} }
{
my $config = Slic3r::Config->new_from_defaults;
$config->set('infill_only_where_needed', 1);
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
ok my $gcode = Slic3r::Test::gcode($print), "successful G-code generation when infill_only_where_needed is set";
}
{ {
my $config = Slic3r::Config->new_from_defaults; my $config = Slic3r::Config->new_from_defaults;
$config->set('skirts', 0); $config->set('skirts', 0);