From 04eeb40e1eba976e0921686bf6d66599a90e81cc Mon Sep 17 00:00:00 2001 From: "liz.li" Date: Thu, 31 Oct 2024 16:22:04 +0800 Subject: [PATCH] ENH: refresh FilamentUnPrintableOnFirstLayer error state jira: none Change-Id: Ifec994cdba2c9590d4c1f8b59e6052593fd05bc2 --- src/slic3r/GUI/GLCanvas3D.cpp | 21 ++++++++++++++++----- src/slic3r/GUI/NotificationManager.cpp | 15 +++++++++++++++ src/slic3r/GUI/NotificationManager.hpp | 5 +++++ src/slic3r/GUI/PartPlate.hpp | 4 +++- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 8bb72d7a4..f2b919f3f 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2809,6 +2809,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re //BBS:exclude the assmble view if (m_canvas_type != ECanvasType::CanvasAssembleView) { _set_warning_notification_if_needed(EWarning::GCodeConflict); + _set_warning_notification(EWarning::FilamentUnPrintableOnFirstLayer, false); // checks for geometry outside the print volume to render it accordingly if (!m_volumes.empty()) { ModelInstanceEPrintVolumeState state; @@ -9491,7 +9492,7 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) PLATER_WARNING, PLATER_ERROR, SLICING_SERIOUS_WARNING, - SLICING_ERROR + SLICING_ERROR, }; std::string text; ErrorType error = ErrorType::PLATER_WARNING; @@ -9564,10 +9565,20 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) notification_manager.close_slicing_serious_warning_notification(text); break; case SLICING_ERROR: - if (state) - notification_manager.push_slicing_error_notification(text, conflictObj ? std::vector{conflictObj} : std::vector{}); - else - notification_manager.close_slicing_error_notification(text); + if (warning == EWarning::FilamentUnPrintableOnFirstLayer) { + if (state) { + notification_manager.bbl_show_bed_filament_incompatible_notification(text); + } + else { + notification_manager.bbl_close_bed_filament_incompatible_notification(); + } + } + else { + if (state) + notification_manager.push_slicing_error_notification(text, conflictObj ? std::vector{conflictObj} : std::vector{}); + else + notification_manager.close_slicing_error_notification(text); + } break; default: break; diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 17bb6eb17..552e0d6e9 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -2684,6 +2684,21 @@ void NotificationManager::bbl_close_gcode_overlap_notification() if (notification->get_type() == NotificationType::BBLGcodeOverlap) { notification->close(); } } +void NotificationManager::bbl_show_bed_filament_incompatible_notification(const std::string& text) +{ + auto callback = [](wxEvtHandler*) { + const wxString bed_filament_compatibility_wiki = "https://wiki.bambulab.com/en/general/filament-guide-material-table"; + wxGetApp().open_browser_with_warning_dialog(bed_filament_compatibility_wiki); + return false; + }; + push_notification_data({ NotificationType::BBLBedFilamentIncompatible,NotificationLevel::ErrorNotificationLevel,0,_u8L("Error:") + "\n" + text,"Click for more.",callback }, 0); +} + +void NotificationManager::bbl_close_bed_filament_incompatible_notification() +{ + close_notification_of_type(NotificationType::BBLBedFilamentIncompatible); +} + void NotificationManager::bbl_show_sole_text_notification(NotificationType sType, const std::string &text, bool bOverride, int level, bool autohide) { NotificationLevel nlevel; diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 73b835453..beee3a4af 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -145,6 +145,7 @@ enum class NotificationType BBLPreviewOnlyMode, BBLPrinterConfigUpdateAvailable, BBLUserPresetExceedLimit, + BBLBedFilamentIncompatible }; class NotificationManager @@ -330,6 +331,10 @@ public: void bbl_show_gcode_overlap_notification(); void bbl_close_gcode_overlap_notification(); + //BBS--bed filament match + void bbl_show_bed_filament_incompatible_notification(const std::string& text); + void bbl_close_bed_filament_incompatible_notification(); + //BBS--sole notification void bbl_show_sole_text_notification(NotificationType sType,const std::string &text, bool bOverride, int level, bool autohide); void bbl_chose_sole_text_notification(NotificationType sType); diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index cc19330e5..675e438c3 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -417,7 +417,9 @@ public: { bool result = m_slice_result_valid; if (result) - result = m_gcode_result ? (!m_gcode_result->toolpath_outside) : false;// && !m_gcode_result->conflict_result.has_value() gcode conflict can also print + result = m_gcode_result ? + (!m_gcode_result->toolpath_outside && !m_gcode_result->filament_printable_reuslt.has_value()) : + false;// && !m_gcode_result->conflict_result.has_value() gcode conflict can also print return result; }