diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index a6f5b6722..d6dac0bec 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -830,10 +830,12 @@ public: bool can_export_toolpaths() const; std::vector get_plater_extruder(); + const float get_max_print_height() const { return m_max_print_height; } const BoundingBoxf3& get_paths_bounding_box() const { return m_paths_bounding_box; } const BoundingBoxf3& get_max_bounding_box() const { return m_max_bounding_box; } const BoundingBoxf3& get_shell_bounding_box() const { return m_shell_bounding_box; } const std::vector& get_layers_zs() const { return m_layers.get_zs(); } + const std::array &get_layers_z_range() const { return m_layers_z_range; } const SequentialView& get_sequential_view() const { return m_sequential_view; } void update_sequential_view_current(unsigned int first, unsigned int last); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index fa1d97cf4..d5efd5e14 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2758,6 +2758,7 @@ void GLCanvas3D::load_gcode_preview(const GCodeProcessorResult& gcode_result, co if (wxGetApp().is_editor()) { //BBS: always load shell at preview, do this in load_shells //m_gcode_viewer.update_shells_color_by_extruder(m_config); + _set_warning_notification_if_needed(EWarning::ToolHeightOutside); _set_warning_notification_if_needed(EWarning::ToolpathOutside); _set_warning_notification_if_needed(EWarning::GCodeConflict); } @@ -8870,14 +8871,19 @@ void GLCanvas3D::_set_warning_notification_if_needed(EWarning warning) if (!m_volumes.empty()) { show = _is_any_volume_outside(); show &= m_gcode_viewer.has_data() && m_gcode_viewer.is_contained_in_bed() && m_gcode_viewer.m_conflict_result.has_value(); - } - else { + } else { if (wxGetApp().is_editor()) { - if (current_printer_technology() != ptSLA) - if (warning == EWarning::ToolpathOutside) - show = m_gcode_viewer.has_data() && !m_gcode_viewer.is_contained_in_bed(); - else if (warning==EWarning::GCodeConflict) + if (current_printer_technology() != ptSLA) { + unsigned int max_z_layer = m_gcode_viewer.get_layers_z_range().back(); + if (warning == EWarning::ToolHeightOutside) // check if max z_layer height exceed max print height + show = m_gcode_viewer.has_data() && (m_gcode_viewer.get_layers_zs()[max_z_layer] - m_gcode_viewer.get_max_print_height() >= 1e-6); + else if (warning == EWarning::ToolpathOutside) { // check if max x,y coords exceed bed area + show = m_gcode_viewer.has_data() && !m_gcode_viewer.is_contained_in_bed() && + (m_gcode_viewer.get_max_print_height() -m_gcode_viewer.get_layers_zs()[max_z_layer] >= 1e-6); + } + else if (warning == EWarning::GCodeConflict) show = m_gcode_viewer.has_data() && m_gcode_viewer.is_contained_in_bed() && m_gcode_viewer.m_conflict_result.has_value(); + } } } @@ -8936,6 +8942,7 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) break; } case EWarning::ObjectOutside: text = _u8L("An object is layed over the boundary of plate."); break; + case EWarning::ToolHeightOutside: text = _u8L("A G-code path goes beyond the max print height."); error = ErrorType::SLICING_ERROR; break; case EWarning::ToolpathOutside: text = _u8L("A G-code path goes beyond the boundary of plate."); error = ErrorType::SLICING_ERROR; break; // BBS: remove _u8L() for SLA case EWarning::SlaSupportsOutside: text = ("SLA supports outside the print area were detected."); error = ErrorType::PLATER_ERROR; break; diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 99af1dc97..c3331deee 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -374,7 +374,8 @@ class GLCanvas3D SlaSupportsOutside, SomethingNotShown, ObjectClashed, - GCodeConflict + GCodeConflict, + ToolHeightOutside }; class RenderStats