Fixed regression causing crash when using avoid_crossing_perimeters with multiple object, caused by recent refactorings. Added regression test

This commit is contained in:
Alessandro Ranellucci 2014-11-26 22:46:51 +01:00
parent 43cbad8867
commit 23848492ce
2 changed files with 24 additions and 1 deletions

View file

@ -560,6 +560,8 @@ has '_layer_mp' => (is => 'rw');
has 'new_object' => (is => 'rw', default => sub {0}); # this flag triggers the use of the external configuration space for avoid_crossing_perimeters for the next travel move
has 'straight_once' => (is => 'rw', default => sub {1}); # this flag disables avoid_crossing_perimeters just for the next travel move
use Slic3r::Geometry qw(scale);
sub init_external_mp {
my ($self, $islands) = @_;
$self->_external_mp(Slic3r::MotionPlanner->new($islands));
@ -612,7 +614,7 @@ sub _plan {
# append the actual path and return
# use G1 because we rely on paths being straight (G0 may make round paths)
$gcode .= join '',
map $gcodegen->writer->travel_to_xy($self->point_to_gcode($_->b), $comment),
map $gcodegen->writer->travel_to_xy($gcodegen->point_to_gcode($_->b), $comment),
@{$travel->lines};
return $gcode;

View file

@ -0,0 +1,21 @@
use Test::More tests => 1;
use strict;
use warnings;
BEGIN {
use FindBin;
use lib "$FindBin::Bin/../lib";
}
use List::Util qw(first sum);
use Slic3r;
use Slic3r::Test;
{
my $config = Slic3r::Config->new_from_defaults;
$config->set('avoid_crossing_perimeters', 2);
my $print = Slic3r::Test::init_print('20mm_cube', config => $config, duplicate => 2);
ok my $gcode = Slic3r::Test::gcode($print), "no crash with avoid_crossing_perimeters and multiple objects";
}
__END__