Fill the gaps while doing normal infill to avoid extra travel

This commit is contained in:
Alessandro Ranellucci 2012-06-30 16:33:01 +02:00
parent 5eb1982081
commit b9008a99f9

View file

@ -128,12 +128,8 @@ sub make_fill {
@surfaces = @new_surfaces; @surfaces = @new_surfaces;
} }
# organize infill surfaces using a shortest path search
@surfaces = @{shortest_path([
map [ $_->contour->[0], $_ ], @surfaces,
])};
my @fills = (); my @fills = ();
my @fills_ordering_points = ();
SURFACE: foreach my $surface (@surfaces) { SURFACE: foreach my $surface (@surfaces) {
my $filler = $Slic3r::fill_pattern; my $filler = $Slic3r::fill_pattern;
my $density = $Slic3r::fill_density; my $density = $Slic3r::fill_density;
@ -163,6 +159,7 @@ sub make_fill {
my $params = shift @paths; my $params = shift @paths;
# save into layer # save into layer
next unless @paths;
push @fills, Slic3r::ExtrusionPath::Collection->new( push @fills, Slic3r::ExtrusionPath::Collection->new(
paths => [ paths => [
map Slic3r::ExtrusionPath->new( map Slic3r::ExtrusionPath->new(
@ -176,19 +173,22 @@ sub make_fill {
flow_spacing => $params->{flow_spacing}, flow_spacing => $params->{flow_spacing},
), @paths, ), @paths,
], ],
) if @paths; );
push @fills_ordering_points, $paths[0][0];
} }
# add thin fill regions # add thin fill regions
push @fills, Slic3r::ExtrusionPath::Collection->new( push @fills, map {
paths => [ $_->isa('Slic3r::Polygon')
map { ? Slic3r::ExtrusionLoop->new(polygon => $_, role => EXTR_ROLE_SOLIDFILL)->split_at_first_point
$_->isa('Slic3r::Polygon') : Slic3r::ExtrusionPath->new(polyline => $_, role => EXTR_ROLE_SOLIDFILL),
? Slic3r::ExtrusionLoop->new(polygon => $_, role => EXTR_ROLE_SOLIDFILL)->split_at_first_point } @{$layer->thin_fills};
: Slic3r::ExtrusionPath->new(polyline => $_, role => EXTR_ROLE_SOLIDFILL) push @fills_ordering_points, map $_->[0], @{$layer->thin_fills};
} @{$layer->thin_fills},
], # organize infill paths using a shortest path search
) if @{$layer->thin_fills}; @fills = @{shortest_path([
map [ $fills_ordering_points[$_], $fills[$_] ], 0..$#fills,
])};
return @fills; return @fills;
} }