ENH: refresh FilamentUnPrintableOnFirstLayer error state

jira: none

Change-Id: Ifec994cdba2c9590d4c1f8b59e6052593fd05bc2
This commit is contained in:
liz.li 2024-10-31 16:22:04 +08:00 committed by Lane.Wei
parent 82c72b19bd
commit 04eeb40e1e
4 changed files with 39 additions and 6 deletions

View File

@ -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<ModelObject const*>{conflictObj} : std::vector<ModelObject const*>{});
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<ModelObject const*>{conflictObj} : std::vector<ModelObject const*>{});
else
notification_manager.close_slicing_error_notification(text);
}
break;
default:
break;

View File

@ -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;

View File

@ -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);

View File

@ -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;
}