mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 19:28:14 -06:00
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
2a52a318fe
commit
630004d156
2 changed files with 10 additions and 0 deletions
|
@ -175,6 +175,10 @@ sub extrude {
|
||||||
sub extrude_loop {
|
sub extrude_loop {
|
||||||
my ($self, $loop, $description) = @_;
|
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
|
# extrude all loops ccw
|
||||||
my $was_clockwise = $loop->make_counter_clockwise;
|
my $was_clockwise = $loop->make_counter_clockwise;
|
||||||
my $polygon = $loop->polygon;
|
my $polygon = $loop->polygon;
|
||||||
|
|
|
@ -43,6 +43,7 @@ use Slic3r::Test;
|
||||||
|
|
||||||
{
|
{
|
||||||
$config->set('external_perimeter_speed', 68);
|
$config->set('external_perimeter_speed', 68);
|
||||||
|
$config->set('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 $print = Slic3r::Test::init_print('cube_with_hole', config => $config);
|
my $print = Slic3r::Test::init_print('cube_with_hole', config => $config);
|
||||||
my $has_cw_loops = my $has_outwards_move = 0;
|
my $has_cw_loops = my $has_outwards_move = 0;
|
||||||
my $cur_loop;
|
my $cur_loop;
|
||||||
|
@ -58,6 +59,11 @@ use Slic3r::Test;
|
||||||
$has_cw_loops = 1 if Slic3r::Polygon->new_scale(@$cur_loop)->is_clockwise;
|
$has_cw_loops = 1 if Slic3r::Polygon->new_scale(@$cur_loop)->is_clockwise;
|
||||||
if ($self->F == $config->external_perimeter_speed*60) {
|
if ($self->F == $config->external_perimeter_speed*60) {
|
||||||
my $move_dest = Slic3r::Point->new_scale(@$info{qw(new_X new_Y)});
|
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}++;
|
$external_loops{$self->Z}++;
|
||||||
$has_outwards_move = 1
|
$has_outwards_move = 1
|
||||||
if !Slic3r::Polygon->new_scale(@$cur_loop)->encloses_point($move_dest)
|
if !Slic3r::Polygon->new_scale(@$cur_loop)->encloses_point($move_dest)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue