Bugfix: wrong inwards moves were calculated for 2+ copies because ExtrusionLoop objects were modified in place. Includes regression test. #1842
This commit is contained in:
parent
b4ac63d749
commit
5ce4de0544
@ -188,6 +188,10 @@ sub extrude {
|
||||
sub extrude_loop {
|
||||
my ($self, $loop, $description) = @_;
|
||||
|
||||
# make a copy; don't modify the orientation of the original loop object otherwise
|
||||
# next copies (if any) would not detect the correct orientation
|
||||
$loop = $loop->clone;
|
||||
|
||||
# extrude all loops ccw
|
||||
my $was_clockwise = $loop->make_counter_clockwise;
|
||||
my $polygon = $loop->polygon;
|
||||
|
@ -43,7 +43,11 @@ use Slic3r::Test;
|
||||
|
||||
{
|
||||
$config->set('external_perimeter_speed', 68);
|
||||
my $print = Slic3r::Test::init_print('cube_with_hole', config => $config);
|
||||
my $print = Slic3r::Test::init_print(
|
||||
'cube_with_hole',
|
||||
config => $config,
|
||||
duplicate => 2, # we test two copies to make sure ExtrusionLoop objects are not modified in-place (the second object would not detect cw loops and thus would calculate wrong inwards moves)
|
||||
);
|
||||
my $has_cw_loops = my $has_outwards_move = 0;
|
||||
my $cur_loop;
|
||||
my %external_loops = (); # print_z => count of external loops
|
||||
@ -58,6 +62,11 @@ use Slic3r::Test;
|
||||
$has_cw_loops = 1 if Slic3r::Polygon->new_scale(@$cur_loop)->is_clockwise;
|
||||
if ($self->F == $config->external_perimeter_speed*60) {
|
||||
my $move_dest = Slic3r::Point->new_scale(@$info{qw(new_X new_Y)});
|
||||
|
||||
# reset counter for second object
|
||||
$external_loops{$self->Z} = 0
|
||||
if defined($external_loops{$self->Z}) && $external_loops{$self->Z} == 2;
|
||||
|
||||
$external_loops{$self->Z}++;
|
||||
my $loop_contains_point = Slic3r::Polygon->new_scale(@$cur_loop)->contains_point($move_dest);
|
||||
$has_outwards_move = 1
|
||||
|
Loading…
Reference in New Issue
Block a user