Fixed conversion from/to imperial units for objects with parts/modifiers

This commit is contained in:
YuSanka 2020-10-22 15:44:58 +02:00
parent d8f45ff1d8
commit 0f9faeda98

View File

@ -1050,6 +1050,7 @@ void ModelObject::convert_units(ModelObjectPtrs& new_objects, bool from_imperial
ModelVolume* vol = new_object->add_volume(mesh); ModelVolume* vol = new_object->add_volume(mesh);
vol->name = volume->name; vol->name = volume->name;
vol->set_type(volume->type());
// Don't copy the config's ID. // Don't copy the config's ID.
vol->config.assign_config(volume->config); vol->config.assign_config(volume->config);
assert(vol->config.id().valid()); assert(vol->config.id().valid());
@ -1060,7 +1061,7 @@ void ModelObject::convert_units(ModelObjectPtrs& new_objects, bool from_imperial
if (volume_idxs.empty() || if (volume_idxs.empty() ||
std::find(volume_idxs.begin(), volume_idxs.end(), vol_idx) != volume_idxs.end()) { std::find(volume_idxs.begin(), volume_idxs.end(), vol_idx) != volume_idxs.end()) {
vol->scale_geometry_after_creation(versor); vol->scale_geometry_after_creation(versor);
vol->set_offset(versor.cwiseProduct(vol->get_offset())); vol->set_offset(versor.cwiseProduct(volume->get_offset()));
} }
else else
vol->set_offset(volume->get_offset()); vol->set_offset(volume->get_offset());