From 359e7e4d32225d485c36c4733ba9f3847d5c80b5 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Fri, 13 Apr 2018 13:59:36 +0200 Subject: [PATCH] Scale down meshes of too big objects after loading them --- lib/Slic3r/GUI/Plater.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index c74b2d32c..ce37a1651 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -738,7 +738,13 @@ sub load_model_objects { # if the object is too large (more than 5 times the bed), scale it down my $size = $o->bounding_box->size; my $ratio = max($size->x / unscale($bed_size->x), $size->y / unscale($bed_size->y)); - if ($ratio > 5) { + if ($ratio > 10000) { + # the size of the object is too big -> this could lead to overflow when moving to clipper coordinates, + # so scale down the mesh + $o->scale_xyz(Slic3r::Pointf3->new(1/$ratio, 1/$ratio, 1/$ratio)); + $scaled_down = 1; + } + elsif ($ratio > 5) { $_->set_scaling_factor(1/$ratio) for @{$o->instances}; $scaled_down = 1; }