FIX: add object id for gcode check

and display plater limit error individually
jira: none

Change-Id: Ie6105642667530901be494b344ce853e728ae5fa
(cherry picked from commit acd6016fc834c749307205448e05bffee954c71e)
This commit is contained in:
zhimin.zeng
2024-10-16 10:38:52 +08:00
committed by Noisyfox
parent eec174ccf0
commit 56af264273
5 changed files with 101 additions and 40 deletions

View File

@@ -9680,7 +9680,8 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
PLATER_WARNING,
PLATER_ERROR,
SLICING_SERIOUS_WARNING,
SLICING_ERROR
SLICING_ERROR,
SLICING_LIMIT_ERROR
};
std::string text;
ErrorType error = ErrorType::PLATER_WARNING;
@@ -9721,7 +9722,11 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
if (i > 0) {
filaments += ", ";
}
filaments += std::to_string(error_iter->second[i] + 1);
int filament_id = error_iter->second[i].first;
int object_label_id = error_iter->second[i].second;
// todo: display the conflict objects
//ModelObject* object->instances[0]->get_labeled_id();
filaments += std::to_string(filament_id);
}
std::string extruder_name = extruder_id == master_extruder_id ? "Left extruder" : "Right extruder";
if (error_iter->second.size() == 1) {
@@ -9731,9 +9736,11 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
text += (boost::format(_u8L("Filaments %d is placed in the %s, but the generated G-code path exceeds the printable range of the %s.")) %filaments %extruder_name %extruder_name).str();
}
}
text += "\n";
text += _u8L("Open wiki for more information.");
error = ErrorType::SLICING_ERROR;
if (!text.empty()) {
text += "\n";
text += _u8L("Open wiki for more information.");
}
error = ErrorType::SLICING_LIMIT_ERROR;
break;
}
// BBS: remove _u8L() for SLA
@@ -9790,6 +9797,12 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
else
notification_manager.close_slicing_error_notification(text);
break;
case SLICING_LIMIT_ERROR:
if (state)
notification_manager.push_slicing_limit_error_notification(text);
else
notification_manager.close_slicing_limit_error_notification(text);
break;
default:
break;
}

View File

@@ -1918,6 +1918,22 @@ void NotificationManager::close_plater_error_notification(const std::string& tex
}
}
void NotificationManager::push_slicing_limit_error_notification(const std::string &text)
{
set_all_slicing_errors_gray(false);
push_notification_data({NotificationType::BBLSliceLimitError, NotificationLevel::ErrorNotificationLevel, 0, _u8L("Error:") + "\n" + text}, 0);
set_slicing_progress_hidden();
}
void NotificationManager::close_slicing_limit_error_notification(const std::string &text)
{
for (std::unique_ptr<PopNotification> &notification : m_pop_notifications) {
if (notification->get_type() == NotificationType::BBLSliceLimitError) {
notification->close();
}
}
}
void NotificationManager::push_plater_warning_notification(const std::string& text)
{
// Find if was not hidden

View File

@@ -228,6 +228,11 @@ public:
// Closes error or warning of the same text
void close_plater_error_notification(const std::string& text);
void close_plater_warning_notification(const std::string& text);
// GCode exceeds the printing range of the extruder
void push_slicing_limit_error_notification(const std::string &text);
void close_slicing_limit_error_notification(const std::string &text);
// Object warning with ObjectID, closes when object is deleted. ID used is of object not print like in slicing warning.
void push_simplify_suggestion_notification(const std::string& text, ObjectID object_id, const std::string& hypertext = "",
std::function<bool(wxEvtHandler*)> callback = std::function<bool(wxEvtHandler*)>());