diff --git a/lib/Slic3r/GUI/3DScene.pm b/lib/Slic3r/GUI/3DScene.pm index ec1b639e0..eb35a2d31 100644 --- a/lib/Slic3r/GUI/3DScene.pm +++ b/lib/Slic3r/GUI/3DScene.pm @@ -364,25 +364,24 @@ sub set_bed_shape { } { - my @lines = (); + my @polylines = (); for (my $x = $bed_bb->x_min; $x <= $bed_bb->x_max; $x += scale 10) { - push @lines, Slic3r::Polyline->new([$x,$bed_bb->y_min], [$x,$bed_bb->y_max]); + push @polylines, Slic3r::Polyline->new([$x,$bed_bb->y_min], [$x,$bed_bb->y_max]); } for (my $y = $bed_bb->y_min; $y <= $bed_bb->y_max; $y += scale 10) { - push @lines, Slic3r::Polyline->new([$bed_bb->x_min,$y], [$bed_bb->x_max,$y]); + push @polylines, Slic3r::Polyline->new([$bed_bb->x_min,$y], [$bed_bb->x_max,$y]); } # clip with a slightly grown expolygon because our lines lay on the contours and # may get erroneously clipped - @lines = @{intersection_pl(\@lines, [ @{$expolygon->offset(+scaled_epsilon)} ])}; + my @lines = map Slic3r::Line->new(@$_[0,-1]), + @{intersection_pl(\@polylines, [ @{$expolygon->offset(+scaled_epsilon)} ])}; # append bed contours - foreach my $line (map @{$_->lines}, @$expolygon) { - push @lines, $line->as_polyline; - } + push @lines, map @{$_->lines}, @$expolygon; my @points = (); - foreach my $polyline (@lines) { - push @points, map {+ unscale($_->x), unscale($_->y), GROUND_Z } @$polyline; #)) + foreach my $line (@lines) { + push @points, map {+ unscale($_->x), unscale($_->y), GROUND_Z } @$line; #)) } $self->bed_grid_lines(OpenGL::Array->new_list(GL_FLOAT, @points)); } diff --git a/lib/Slic3r/GUI/BedShapeDialog.pm b/lib/Slic3r/GUI/BedShapeDialog.pm index 06b0aa414..7b5c3ca92 100644 --- a/lib/Slic3r/GUI/BedShapeDialog.pm +++ b/lib/Slic3r/GUI/BedShapeDialog.pm @@ -299,15 +299,15 @@ sub _repaint_canvas { my $step = 10; # 1cm grid my @polylines = (); for (my $x = $bb->x_min - ($bb->x_min % $step) + $step; $x < $bb->x_max; $x += $step) { - push @polylines, Slic3r::Polyline->new_scale([$x, $bb->y_min], [$x, $bb->y_max]);last; + push @polylines, Slic3r::Polyline->new_scale([$x, $bb->y_min], [$x, $bb->y_max]); } for (my $y = $bb->y_min - ($bb->y_min % $step) + $step; $y < $bb->y_max; $y += $step) { push @polylines, Slic3r::Polyline->new_scale([$bb->x_min, $y], [$bb->x_max, $y]); - }my @orig = @polylines; + } @polylines = @{intersection_pl(\@polylines, [$bed_polygon])}; $dc->SetPen(Wx::Pen->new(Wx::Colour->new(230,230,230), 1, wxSOLID)); - $dc->DrawLine(map @{$to_pixel->([map unscale($_), @$_])}, @$_) for @polylines; + $dc->DrawLine(map @{$to_pixel->([map unscale($_), @$_])}, @$_[0,-1]) for @polylines; } # draw bed contour diff --git a/lib/Slic3r/GUI/Plater/2D.pm b/lib/Slic3r/GUI/Plater/2D.pm index bf0dcbfba..788892050 100644 --- a/lib/Slic3r/GUI/Plater/2D.pm +++ b/lib/Slic3r/GUI/Plater/2D.pm @@ -276,7 +276,7 @@ sub update_bed_size { push @polylines, Slic3r::Polyline->new([$bb->x_min, $y], [$bb->x_max, $y]); } @polylines = @{intersection_pl(\@polylines, [$polygon])}; - $self->{grid} = [ map $self->scaled_points_to_pixel(\@$_, 1), @polylines ]; + $self->{grid} = [ map $self->scaled_points_to_pixel([ @$_[0,-1] ], 1), @polylines ]; } }