From 11637d527a8dc35562e85933cedab3fe1100e14a Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 4 Feb 2013 19:33:30 +0100 Subject: [PATCH] Bugfix: avoid-crossing-perimeters was failing on layers only containing single walls. #978 --- lib/Slic3r/Print.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 5cb6b4233..3c2ca71bb 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -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(