diff --git a/lib/Slic3r/GCode.pm b/lib/Slic3r/GCode.pm index 0561e4cd8b..c8b72a8ad4 100644 --- a/lib/Slic3r/GCode.pm +++ b/lib/Slic3r/GCode.pm @@ -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; diff --git a/t/avoid_crossing_perimeters.t b/t/avoid_crossing_perimeters.t new file mode 100644 index 0000000000..dd6c3e7b69 --- /dev/null +++ b/t/avoid_crossing_perimeters.t @@ -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__