Bugfix: avoid-crossing-perimeters was failing on layers only containing single walls. #978

This commit is contained in:
Alessandro Ranellucci 2013-02-04 19:33:30 +01:00
parent 8efe46e58d
commit 11637d527a

View file

@ -727,11 +727,17 @@ sub write_gcode {
# compute the offsetted convex hull for each object and repeat it for each copy.
my @islands = ();
foreach my $obj_idx (0 .. $#{$self->objects}) {
my @island = Slic3r::ExPolygon->new(convex_hull([
my $convex_hull = convex_hull([
map @{$_->contour}, map @{$_->slices}, @{$self->objects->[$obj_idx]->layers},
]))->translate(scale $shift[X], scale $shift[Y])->offset_ex(scale $distance_from_objects, 1, JT_SQUARE);
foreach my $copy (@{ $self->objects->[$obj_idx]->copies }) {
push @islands, map $_->clone->translate(@$copy), @island;
]);
# discard layers only containing thin walls (offset would fail on an empty polygon)
if (@$convex_hull) {
my @island = Slic3r::ExPolygon->new($convex_hull)
->translate(scale $shift[X], scale $shift[Y])
->offset_ex(scale $distance_from_objects, 1, JT_SQUARE);
foreach my $copy (@{ $self->objects->[$obj_idx]->copies }) {
push @islands, map $_->clone->translate(@$copy), @island;
}
}
}
$gcodegen->external_mp(Slic3r::GCode::MotionPlanner->new(