Only put ExtrusionPath objects in ExtrusionPath::Collection (no ExtrusionLoop objects)

This commit is contained in:
Alessandro Ranellucci 2012-10-31 19:08:29 +01:00
parent d4ccd39ad3
commit 554d10c854
3 changed files with 14 additions and 22 deletions

View File

@ -60,14 +60,6 @@ sub split_at_first_point {
return $self->split_at_index(0); return $self->split_at_index(0);
} }
# although a loop doesn't have endpoints, this method is provided to allow
# ExtrusionLoop objects to be added to an ExtrusionPath::Collection and
# sorted by the ->shortest_path() method
sub endpoints {
my $self = shift;
return ($self->polygon->[0], $self->polygon->[-1]);
}
package Slic3r::ExtrusionLoop::Packed; package Slic3r::ExtrusionLoop::Packed;
sub unpack { sub unpack {
my $self = shift; my $self = shift;

View File

@ -359,20 +359,15 @@ sub make_perimeters {
} }
# add thin walls as perimeters # add thin walls as perimeters
{ push @{ $self->perimeters }, Slic3r::ExtrusionPath::Collection->new(paths => [
my @thin_paths = (); map {
my %properties = ( Slic3r::ExtrusionPath->pack(
role => EXTR_ROLE_EXTERNAL_PERIMETER, polyline => ($_->isa('Slic3r::Polygon') ? $_->split_at_first_point : $_),
flow_spacing => $self->perimeter_flow->spacing, role => EXTR_ROLE_EXTERNAL_PERIMETER,
); flow_spacing => $self->perimeter_flow->spacing,
for (@{ $self->thin_walls }) { );
push @thin_paths, $_->isa('Slic3r::Polygon') } @{ $self->thin_walls }
? Slic3r::ExtrusionLoop->pack(polygon => $_, %properties) ])->shortest_path;
: Slic3r::ExtrusionPath->pack(polyline => $_, %properties);
}
my $collection = Slic3r::ExtrusionPath::Collection->new(paths => \@thin_paths);
push @{ $self->perimeters }, $collection->shortest_path;
}
} }
sub _add_perimeter { sub _add_perimeter {

View File

@ -146,4 +146,9 @@ sub split_at {
return $self->split_at_index($i); return $self->split_at_index($i);
} }
sub split_at_first_point {
my $self = shift;
return $self->split_at_index(0);
}
1; 1;