Fixed Fit to print volume command when applied to an object sliced using SLA printer
This commit is contained in:
parent
98346824e8
commit
7f1df7b110
2 changed files with 25 additions and 4 deletions
|
@ -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<int, int> 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<int, int>(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<int, int>(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());
|
||||
|
|
|
@ -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<unsigned int> 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));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue