diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 863c793e3..baca007cb 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1602,14 +1602,17 @@ void GLCanvas3D::delete_selected() m_selection.erase(); } -void GLCanvas3D::ensure_on_bed(unsigned int object_idx) +void GLCanvas3D::ensure_on_bed(unsigned int object_idx, bool allow_negative_z) { + if (allow_negative_z) + return; + typedef std::map, double> InstancesToZMap; InstancesToZMap instances_min_z; for (GLVolume* volume : m_volumes.volumes) { if (volume->object_idx() == (int)object_idx && !volume->is_modifier) { - double min_z = volume->transformed_convex_hull_bounding_box().min(2); + double min_z = volume->transformed_convex_hull_bounding_box().min.z(); std::pair instance = std::make_pair(volume->object_idx(), volume->instance_idx()); InstancesToZMap::iterator it = instances_min_z.find(instance); if (it == instances_min_z.end()) diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 6e7c26959..d9cd55e35 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -702,7 +702,7 @@ public: void select_all(); void deselect_all(); void delete_selected(); - void ensure_on_bed(unsigned int object_idx); + void ensure_on_bed(unsigned int object_idx, bool allow_negative_z); bool is_gcode_legend_enabled() const { return m_gcode_viewer.is_legend_enabled(); } GCodeViewer::EViewType get_gcode_view_type() const { return m_gcode_viewer.get_view_type(); } diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index c06e90c91..df97cec5a 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -2708,7 +2708,7 @@ void ObjectList::delete_from_model_and_list(const std::vector& it if (obj->get_mesh_errors_count() == 0) m_objects_model->DeleteWarningIcon(parent); } - wxGetApp().plater()->canvas3D()->ensure_on_bed(item->obj_idx); + wxGetApp().plater()->canvas3D()->ensure_on_bed(item->obj_idx, printer_technology() != ptSLA); } else m_objects_model->Delete(m_objects_model->GetItemByInstanceId(item->obj_idx, item->sub_obj_idx)); @@ -4075,7 +4075,7 @@ void ObjectList::set_extruder_for_selected_items(const int extruder) const const int obj_idx = type & itObject ? m_objects_model->GetIdByItem(item) : m_objects_model->GetIdByItem(m_objects_model->GetTopParent(item)); - wxGetApp().plater()->canvas3D()->ensure_on_bed(obj_idx); + wxGetApp().plater()->canvas3D()->ensure_on_bed(obj_idx, printer_technology() != ptSLA); } // update scene