mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-10 01:09:09 +08:00
Apply a true double-ended nearest-neightbor search to thin fills in order to minimize travel moves between them. #2213
This commit is contained in:
parent
79ac29b435
commit
795c85d30e
@ -179,7 +179,6 @@ sub make_fill {
|
||||
}
|
||||
|
||||
my @fills = ();
|
||||
my @fills_ordering_points = ();
|
||||
SURFACE: foreach my $surface (@surfaces) {
|
||||
next if $surface->surface_type == S_TYPE_INTERNALVOID;
|
||||
my $filler = $layerm->config->fill_pattern;
|
||||
@ -244,19 +243,13 @@ sub make_fill {
|
||||
), @polylines,
|
||||
);
|
||||
}
|
||||
|
||||
push @fills_ordering_points, $polylines[0]->first_point;
|
||||
}
|
||||
|
||||
# add thin fill regions
|
||||
foreach my $thin_fill (@{$layerm->thin_fills}) {
|
||||
push @fills, Slic3r::ExtrusionPath::Collection->new($thin_fill);
|
||||
push @fills_ordering_points, $thin_fill->first_point;
|
||||
}
|
||||
|
||||
# organize infill paths using a nearest-neighbor search
|
||||
@fills = @fills[ @{chained_path(\@fills_ordering_points)} ];
|
||||
|
||||
return @fills;
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,10 @@ sub process_layer {
|
||||
}
|
||||
|
||||
# process infill
|
||||
{
|
||||
# $layerm->fills is a collection of ExtrusionPath::Collection objects, each one containing
|
||||
# the ExtrusionPath objects of a certain infill "group" (also called "surface"
|
||||
# throughout the code). We can redefine the order of such Collections but we have to
|
||||
# do each one completely at once.
|
||||
foreach my $fill (@{$layerm->fills}) {
|
||||
# init by_extruder item only if we actually use the extruder
|
||||
my $extruder_id = $fill->[0]->is_solid_infill
|
||||
@ -438,7 +441,6 @@ sub process_layer {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# tweak extruder ordering to save toolchanges
|
||||
my @extruders = sort keys %by_extruder;
|
||||
@ -479,7 +481,7 @@ sub process_layer {
|
||||
$layer->object->ptr . ref($layer), # differentiate $obj_id between normal layers and support layers
|
||||
$layer->id,
|
||||
$layer->print_z,
|
||||
) if defined $self->_cooling_buffer && defined $layer;
|
||||
) if defined $self->_cooling_buffer;
|
||||
|
||||
print {$self->fh} $self->filter($gcode);
|
||||
}
|
||||
@ -502,7 +504,9 @@ sub _extrude_infill {
|
||||
my $gcode = "";
|
||||
foreach my $region_id (sort keys %$entities_by_region) {
|
||||
$self->_gcodegen->config->apply_region_config($self->print->get_region($region_id)->config);
|
||||
for my $fill (@{ $entities_by_region->{$region_id} }) {
|
||||
|
||||
my $collection = Slic3r::ExtrusionPath::Collection->new(@{ $entities_by_region->{$region_id} });
|
||||
for my $fill (@{$collection->chained_path_from($self->_gcodegen->last_pos, 0)}) {
|
||||
if ($fill->isa('Slic3r::ExtrusionPath::Collection')) {
|
||||
$gcode .= $self->_gcodegen->extrude($_, 'infill')
|
||||
for @{$fill->chained_path_from($self->_gcodegen->last_pos, 0)};
|
||||
|
Loading…
x
Reference in New Issue
Block a user