mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 14:13:57 -06:00
Fill the gaps while doing normal infill to avoid extra travel
This commit is contained in:
parent
5eb1982081
commit
b9008a99f9
1 changed files with 15 additions and 15 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue