Bugfix: when processing with fill_density = 0, top/bottom solid shells were missing regions thinner than 3 * extrusion width. Includes regression test. #1602

Conflicts:

	lib/Slic3r/Print/Object.pm
	t/fill.t
This commit is contained in:
Alessandro Ranellucci 2014-02-07 01:48:47 +01:00
parent 42519174cd
commit ffc891d885
3 changed files with 78 additions and 25 deletions

View file

@ -2,7 +2,7 @@ use Test::More;
use strict;
use warnings;
plan tests => 40;
plan tests => 41;
BEGIN {
use FindBin;
@ -12,7 +12,7 @@ BEGIN {
use List::Util qw(first);
use Slic3r;
use Slic3r::Geometry qw(scale X Y convex_hull);
use Slic3r::Geometry::Clipper qw(diff_ex);
use Slic3r::Geometry::Clipper qw(union diff_ex);
use Slic3r::Surface qw(:types);
use Slic3r::Test;
@ -218,4 +218,41 @@ for my $pattern (qw(rectilinear honeycomb hilbertcurve concentric)) {
"solid_infill_below_area and solid_infill_every_layers are ignored when fill_density is 0";
}
{
my $config = Slic3r::Config->new_from_defaults;
$config->set('skirts', 0);
$config->set('perimeters', 3);
$config->set('fill_density', 0);
$config->set('layer_height', 0.2);
$config->set('first_layer_height', 0.2);
$config->set('nozzle_diameter', [0.35]);
$config->set('infill_extruder', 2);
$config->set('infill_extrusion_width', 0.52);
my $print = Slic3r::Test::init_print('A', config => $config);
my %infill = (); # Z => [ Line, Line ... ]
my $tool = undef;
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
my ($self, $cmd, $args, $info) = @_;
if ($cmd =~ /^T(\d+)/) {
$tool = $1;
} elsif ($cmd eq 'G1' && $info->{extruding} && $info->{dist_XY} > 0) {
if ($tool == $config->infill_extruder-1) {
my $z = 1 * $self->Z;
$infill{$z} ||= [];
push @{$infill{$z}}, Slic3r::Line->new_scale(
[ $self->X, $self->Y ],
[ $info->{new_X}, $info->{new_Y} ],
);
}
}
});
my $grow_d = scale($config->infill_extrusion_width)/2;
my $layer0_infill = union([ map @{$_->grow($grow_d)}, @{ $infill{0.2} } ]);
my $layer1_infill = union([ map @{$_->grow($grow_d)}, @{ $infill{0.4} } ]);
my $diff = [ grep $_->area >= 2*$grow_d**2, @{diff_ex($layer0_infill, $layer1_infill)} ];
is scalar(@$diff), 0, 'no missing parts in solid shell when fill_density is 0';
}
__END__