diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index a0bba00f..57761874 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -580,7 +580,7 @@ EOF my @current_layer_slices = (); # sort slices so that the outermost ones come first - my @slices = sort { $a->contour->encloses_point($b->contour->[0]) ? 0 : 1 } @{$layer->slices}; + my @slices = sort { $a->contour->contains_point($b->contour->[0]) ? 0 : 1 } @{$layer->slices}; foreach my $copy (@{$layer->object->copies}) { foreach my $slice (@slices) { my $expolygon = $slice->clone; diff --git a/t/svg.t b/t/svg.t index eb274d59..9299eeef 100644 --- a/t/svg.t +++ b/t/svg.t @@ -1,4 +1,4 @@ -use Test::More tests => 1; +use Test::More tests => 2; use strict; use warnings; @@ -17,7 +17,19 @@ use Slic3r::Test; $print->print->export_svg(output_fh => $fh, quiet => 1); $fh->close; }; + die $@ if $@; ok !$@, 'successful SVG export'; } +{ + my $print = Slic3r::Test::init_print('two_hollow_squares'); + eval { + my $fh = IO::Scalar->new(\my $gcode); + $print->print->export_svg(output_fh => $fh, quiet => 1); + $fh->close; + }; + die $@ if $@; + ok !$@, 'successful SVG export of object with two islands'; +} + __END__