mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 19:35:57 +08:00
Fixed regression causing crash when using avoid_crossing_perimeters with multiple object, caused by recent refactorings. Added regression test
This commit is contained in:
parent
43cbad8867
commit
23848492ce
@ -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 '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
|
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 {
|
sub init_external_mp {
|
||||||
my ($self, $islands) = @_;
|
my ($self, $islands) = @_;
|
||||||
$self->_external_mp(Slic3r::MotionPlanner->new($islands));
|
$self->_external_mp(Slic3r::MotionPlanner->new($islands));
|
||||||
@ -612,7 +614,7 @@ sub _plan {
|
|||||||
# append the actual path and return
|
# append the actual path and return
|
||||||
# use G1 because we rely on paths being straight (G0 may make round paths)
|
# use G1 because we rely on paths being straight (G0 may make round paths)
|
||||||
$gcode .= join '',
|
$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};
|
@{$travel->lines};
|
||||||
|
|
||||||
return $gcode;
|
return $gcode;
|
||||||
|
21
t/avoid_crossing_perimeters.t
Normal file
21
t/avoid_crossing_perimeters.t
Normal 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__
|
Loading…
x
Reference in New Issue
Block a user