Fixed retrieving of the "saved in inches" flag from 3MF.

Fixed "import STL from Inches" - it should always scale up even if the
object is bigger than 3x3x3mm.
This commit is contained in:
Vojtech Bubnik 2020-12-12 18:54:34 +01:00
parent 3795f6b779
commit 9fdf8c8b8d
4 changed files with 11 additions and 9 deletions

View file

@ -461,11 +461,11 @@ bool Model::looks_like_imperial_units() const
return false;
}
void Model::convert_from_imperial_units()
void Model::convert_from_imperial_units(bool only_small_volumes)
{
double in_to_mm = 25.4;
for (ModelObject* obj : this->objects)
if (obj->get_object_stl_stats().volume < 9.0) { // 9 = 3*3*3;
if (! only_small_volumes || obj->get_object_stl_stats().volume < 9.0) { // 9 = 3*3*3;
obj->scale_mesh_after_creation(Vec3d(in_to_mm, in_to_mm, in_to_mm));
for (ModelVolume* v : obj->volumes)
v->source.is_converted_from_inches = true;
@ -1062,7 +1062,7 @@ void ModelObject::convert_units(ModelObjectPtrs& new_objects, bool from_imperial
// Perform conversion only if the target "imperial" state is different from the current one.
// This check supports conversion of "mixed" set of volumes, each with different "imperial" state.
if (vol->source.is_converted_from_inches != from_imperial &&
if (//vol->source.is_converted_from_inches != from_imperial &&
(volume_idxs.empty() ||
std::find(volume_idxs.begin(), volume_idxs.end(), vol_idx) != volume_idxs.end())) {
vol->scale_geometry_after_creation(versor);