From 8413b63e49d2f43968cd88c5cc382cffb9e45e55 Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Mon, 1 Aug 2022 16:40:41 +0800 Subject: [PATCH] FIX: fix issue STUDIO-521 conversion to meters/inches out of bed Change-Id: Id0cf667512121671fd5ca959cadcc8b0dce55d3a --- src/slic3r/GUI/Plater.cpp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f7b7508b3..279353df6 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3195,27 +3195,36 @@ std::vector Plater::priv::load_model_objects(const ModelObjectPtrs& mode #endif /* AUTOPLACEMENT_ON_LOAD */ } - //BBS: remove the auto scaled_down logic when load models - /* + //BBS: when the object is too large, let the user choose whether to scale it down for (size_t i = 0; i < object->instances.size(); ++i) { ModelInstance* instance = object->instances[i]; const Vec3d size = object->instance_bounding_box(i).size(); const Vec3d ratio = size.cwiseQuotient(bed_size); const double max_ratio = std::max(ratio(0), ratio(1)); if (max_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 - object->scale_mesh_after_creation(1. / max_ratio); - object->origin_translation = Vec3d::Zero(); - object->center_around_origin(); - scaled_down = true; - break; + MessageDialog dlg(q, _L("Your object appears to be too large, Do you want to scale it down to fit the heat bed automatically?"), _L("Object too large"), + wxICON_QUESTION | wxYES_NO); + int answer = dlg.ShowModal(); + if (answer == wxID_YES) { + // the size of the object is too big -> this could lead to overflow when moving to clipper coordinates, + // so scale down the mesh + object->scale_mesh_after_creation(1. / max_ratio); + object->origin_translation = Vec3d::Zero(); + object->center_around_origin(); + scaled_down = true; + break; + } } - else if (max_ratio > 5) { - instance->set_scaling_factor(instance->get_scaling_factor() / max_ratio); - scaled_down = true; + else if (max_ratio > 10) { + MessageDialog dlg(q, _L("Your object appears to be too large, Do you want to scale it down to fit the heat bed automatically?"), _L("Object too large"), + wxICON_QUESTION | wxYES_NO); + int answer = dlg.ShowModal(); + if (answer == wxID_YES) { + instance->set_scaling_factor(instance->get_scaling_factor() / max_ratio); + scaled_down = true; + } } - }*/ + } object->ensure_on_bed(allow_negative_z); if (!split_object) {