From e83718332737181e0b1930f9e65c87fa54566826 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 16 Feb 2014 12:44:08 +0100 Subject: [PATCH] Fixed regression when using --infill-only-where-needed. Includes regression test. #1721 --- lib/Slic3r/Print/Object.pm | 8 ++++---- t/fill.t | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 91b9da7005..68c31969fe 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -556,8 +556,8 @@ sub clip_fill_surfaces { my $overhangs = []; # arrayref of polygons for my $layer_id (reverse 0..$#{$self->layers}) { my $layer = $self->layers->[$layer_id]; - my @layer_internal = (); - my @new_internal = (); + my @layer_internal = (); # arrayref of Surface objects + my @new_internal = (); # arrayref of Surface objects # clip this layer's internal surfaces to @overhangs foreach my $layerm (@{$layer->regions}) { @@ -591,10 +591,10 @@ sub clip_fill_surfaces { if ($layer_id > 0) { my $solid = diff( [ map @$_, @{$layer->slices} ], - \@layer_internal, + [ map $_->p, @layer_internal ], ); $overhangs = offset($solid, +$additional_margin); - push @$overhangs, @new_internal; # propagate upper overhangs + push @$overhangs, map $_->p, @new_internal; # propagate upper overhangs } } } diff --git a/t/fill.t b/t/fill.t index 5b9c4f796c..5511601659 100644 --- a/t/fill.t +++ b/t/fill.t @@ -2,7 +2,7 @@ use Test::More; use strict; use warnings; -plan tests => 41; +plan tests => 42; BEGIN { use FindBin; @@ -197,6 +197,13 @@ for my $pattern (qw(rectilinear honeycomb hilbertcurve concentric)) { ok !(defined first { !$convex_hull->contains_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; $config->set('skirts', 0);