FIX: fix issue STUDIO-521 conversion to meters/inches out of bed

Change-Id: Id0cf667512121671fd5ca959cadcc8b0dce55d3a
This commit is contained in:
zhimin.zeng 2022-08-01 16:40:41 +08:00 committed by Lane.Wei
parent 7d576f1c6a
commit 8413b63e49
1 changed files with 22 additions and 13 deletions

View File

@ -3195,27 +3195,36 @@ std::vector<size_t> 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) {