diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index dc4acebbc6..b5b4a9ca0d 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3605,6 +3605,9 @@ void GLCanvas3D::do_move(const std::string& snapshot_type) int instance_idx = v->instance_idx(); int volume_idx = v->volume_idx(); + if (volume_idx < 0) + continue; + std::pair done_id(object_idx, instance_idx); if (0 <= object_idx && object_idx < (int)m_model->objects.size()) { @@ -3619,7 +3622,7 @@ void GLCanvas3D::do_move(const std::string& snapshot_type) #else model_object->instances[instance_idx]->set_offset(v->get_instance_offset()); #endif // ENABLE_WORLD_COORDINATE - else if (volume_idx >= 0 && selection_mode == Selection::Volume) + else if (selection_mode == Selection::Volume) #if ENABLE_WORLD_COORDINATE model_object->volumes[volume_idx]->set_transformation(v->get_volume_transformation()); #else @@ -3710,6 +3713,9 @@ void GLCanvas3D::do_rotate(const std::string& snapshot_type) const int instance_idx = v->instance_idx(); const int volume_idx = v->volume_idx(); + if (volume_idx < 0) + continue; + done.insert(std::pair(object_idx, instance_idx)); // Rotate instances/volumes. @@ -3723,7 +3729,7 @@ void GLCanvas3D::do_rotate(const std::string& snapshot_type) model_object->instances[instance_idx]->set_offset(v->get_instance_offset()); #endif // ENABLE_WORLD_COORDINATE } - else if (selection_mode == Selection::Volume && volume_idx >= 0) { + else if (selection_mode == Selection::Volume) { #if ENABLE_WORLD_COORDINATE model_object->volumes[volume_idx]->set_transformation(v->get_volume_transformation()); #else @@ -3786,6 +3792,9 @@ void GLCanvas3D::do_scale(const std::string& snapshot_type) const int instance_idx = v->instance_idx(); const int volume_idx = v->volume_idx(); + if (volume_idx < 0) + continue; + done.insert(std::pair(object_idx, instance_idx)); // Rotate instances/volumes @@ -3799,7 +3808,7 @@ void GLCanvas3D::do_scale(const std::string& snapshot_type) model_object->instances[instance_idx]->set_offset(v->get_instance_offset()); #endif // ENABLE_WORLD_COORDINATE } - else if (selection_mode == Selection::Volume && volume_idx >= 0) { + else if (selection_mode == Selection::Volume) { #if ENABLE_WORLD_COORDINATE model_object->instances[instance_idx]->set_transformation(v->get_instance_transformation()); model_object->volumes[volume_idx]->set_transformation(v->get_volume_transformation()); diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 2b77fe7ff4..28cf367fdf 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -1396,6 +1396,18 @@ void Selection::scale_to_fit_print_volume(const BuildVolume& volume) // used to keep track whether the undo/redo snapshot has already been taken bool undoredo_snapshot = false; + if (wxGetApp().plater()->printer_technology() == ptSLA) { + // remove SLA auxiliary volumes from the selection to ensure that the proper bounding box is calculated + std::vector to_remove; + for (unsigned int i : m_list) { + if ((*m_volumes)[i]->volume_idx() < 0) + to_remove.push_back(i); + } + + if (!to_remove.empty()) + remove_volumes(m_mode, to_remove); + } + switch (volume.type()) { case BuildVolume::Type::Rectangle: { undoredo_snapshot = fit_rectangle(volume, !undoredo_snapshot); break; } @@ -3006,7 +3018,7 @@ static void verify_instances_rotation_synchronized(const Model &model, const GLV continue; const Transform3d::ConstLinearPart& rotation0 = volumes[idx_volume_first]->get_instance_transformation().get_matrix().linear(); for (int i = idx_volume_first + 1; i < (int)volumes.size(); ++i) - if (volumes[i]->object_idx() == idx_object) { + if (volumes[i]->object_idx() == idx_object && volumes[i]->volume_idx() >= 0) { const Transform3d::ConstLinearPart& rotation = volumes[i]->get_instance_transformation().get_matrix().linear(); assert(is_rotation_xy_synchronized(rotation, rotation0)); }