From 2675e697ef80b9deb249d96be65826f4d5837b13 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sat, 21 Oct 2017 17:11:16 +0100 Subject: [PATCH] Provide warning when object(s) are outside print bed. (#4163) --- lib/Slic3r/GUI/Plater.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 4e30ce045..451280629 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -1240,6 +1240,7 @@ sub load_model_objects { my $need_arrange = 0; my $scaled_down = 0; + my $outside_bounds = 0; my @obj_idx = (); foreach my $model_object (@model_objects) { my $o = $self->{model}->add_object($model_object); @@ -1281,10 +1282,30 @@ sub load_model_objects { $scaled_down = 1; } } + + { + # if after scaling the object does not fit on the bed provide a warning + my $bed_bounds = Slic3r::Geometry::BoundingBoxf->new_from_points($self->{config}->bed_shape); + my $o_bounds = $o->bounding_box; + my $min = Slic3r::Pointf->new($o_bounds->x_min, $o_bounds->y_min); + my $max = Slic3r::Pointf->new($o_bounds->x_max, $o_bounds->y_max); + if (!$bed_bounds->contains_point($min) || !$bed_bounds->contains_point($max)) + { + $outside_bounds = 1; + } + } $self->{print}->auto_assign_extruders($o); $self->{print}->add_model_object($o); } + + if ($outside_bounds) { + Slic3r::GUI::show_info( + $self, + 'Some of your object(s) appear to be outside the print bed. Use the arrange button to correct this.', + 'Outside print bed?', + ); + } if ($scaled_down) {