FIX: The relative position is incorrect when loading part
Change-Id: Ie176d69631589e414048c61cfb3ca2128f8f9ead (cherry picked from commit de33e37829b62579218d4c5f307104604dabbbc0)
This commit is contained in:
parent
321785e82e
commit
a91d043d67
|
@ -1923,11 +1923,9 @@ void ObjectList::load_modifier(const wxArrayString& input_files, ModelObject& mo
|
|||
ModelVolume* new_volume = model_object.add_volume(std::move(mesh), type);
|
||||
new_volume->name = boost::filesystem::path(input_file).filename().string();
|
||||
|
||||
// adjust the position according to the bounding box
|
||||
const BoundingBoxf3 mesh_bb = new_volume->mesh().bounding_box();
|
||||
new_volume->set_transformation(Geometry::Transformation::volume_to_bed_transformation(v->get_instance_transformation(), mesh_bb));
|
||||
auto offset = Vec3d(instance_bb.max.x(), instance_bb.min.y(), instance_bb.min.z()) + 0.5 * mesh_bb.size() - v->get_instance_offset();
|
||||
new_volume->set_offset(v->get_instance_transformation().get_matrix(true).inverse() * offset);
|
||||
// BBS: object_mesh.get_init_shift() keep the relative position
|
||||
TriangleMesh object_mesh = model_object.volumes[0]->mesh();
|
||||
new_volume->set_offset(new_volume->mesh().get_init_shift() - object_mesh.get_init_shift());
|
||||
|
||||
// set a default extruder value, since user can't add it manually
|
||||
// BBS
|
||||
|
|
Loading…
Reference in New Issue