diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index dde185fe5..49c336e62 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -1928,7 +1928,7 @@ namespace Slic3r { else if (metadata.key == SOURCE_OFFSET_Z_KEY) volume->source.mesh_offset(2) = ::atof(metadata.value.c_str()); else if (metadata.key == SOURCE_IN_INCHES) - volume->source.is_converted_from_inches = metadata.value.c_str() == "1"; + volume->source.is_converted_from_inches = metadata.value == "1"; else volume->config.set_deserialize(metadata.key, metadata.value); } diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index d7682d276..7a1cdf8d3 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -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); diff --git a/src/libslic3r/Model.hpp b/src/libslic3r/Model.hpp index c10e304c3..99db132f6 100644 --- a/src/libslic3r/Model.hpp +++ b/src/libslic3r/Model.hpp @@ -1018,7 +1018,7 @@ public: bool looks_like_multipart_object() const; void convert_multipart_object(unsigned int max_extruders); bool looks_like_imperial_units() const; - void convert_from_imperial_units(); + void convert_from_imperial_units(bool only_small_volumes); // Ensures that the min z of the model is not negative void adjust_min_z(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 9129900d1..d46ea3567 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2393,22 +2393,24 @@ std::vector Plater::priv::load_files(const std::vector& input_ { // The model should now be initialized - auto convert_from_imperial_units = [](Model& model) { - model.convert_from_imperial_units(); + auto convert_from_imperial_units = [](Model& model, bool only_small_volumes) { + model.convert_from_imperial_units(only_small_volumes); wxGetApp().app_config->set("use_inches", "1"); wxGetApp().sidebar().update_ui_from_settings(); }; if (!is_project_file) { if (imperial_units) - convert_from_imperial_units(model); + // Convert even if the object is big. + convert_from_imperial_units(model, false); else if (model.looks_like_imperial_units()) { wxMessageDialog msg_dlg(q, format_wxstr(_L( "Some object(s) in file %s looks like saved in inches.\n" "Should I consider them as a saved in inches and convert them?"), from_path(filename)) + "\n", _L("The object appears to be saved in inches"), wxICON_WARNING | wxYES | wxNO); if (msg_dlg.ShowModal() == wxID_YES) - convert_from_imperial_units(model); + //FIXME up-scale only the small parts? + convert_from_imperial_units(model, true); } if (model.looks_like_multipart_object()) {