FIX: always empty popup in unprintable case

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I90fcb90ef01e8cc398683bf00eb8d87eefe95069
This commit is contained in:
xun.zhang 2025-01-17 15:43:10 +08:00 committed by lane.wei
parent d09e023368
commit f79ba9e315
3 changed files with 21 additions and 10 deletions

View File

@ -1417,7 +1417,7 @@ BoundingBoxf3 GLCanvas3D::_get_current_partplate_print_volume()
return test_volume; return test_volume;
} }
void GLCanvas3D::construct_error_string(ObjectFilamentResults& object_result, std::string& error_string) static bool construct_error_string(ObjectFilamentResults& object_result, std::string& error_string)
{ {
error_string.clear(); error_string.clear();
if (!object_result.partly_outside_objects.empty()) { if (!object_result.partly_outside_objects.empty()) {
@ -1428,8 +1428,9 @@ void GLCanvas3D::construct_error_string(ObjectFilamentResults& object_result, st
error_string += "\n"; error_string += "\n";
} }
error_string += _u8L("Please solve the problem by moving it totally on or off the plate, and confirming that the height is within the build volume.\n"); error_string += _u8L("Please solve the problem by moving it totally on or off the plate, and confirming that the height is within the build volume.\n");
return true;
} }
return false;
} }
static std::pair<bool, bool> construct_extruder_unprintable_error(ObjectFilamentResults& object_result, std::string& left_extruder_unprintable_text, std::string& right_extruder_unprintable_text) static std::pair<bool, bool> construct_extruder_unprintable_error(ObjectFilamentResults& object_result, std::string& left_extruder_unprintable_text, std::string& right_extruder_unprintable_text)
@ -1476,8 +1477,8 @@ static std::pair<bool, bool> construct_extruder_unprintable_error(ObjectFilament
auto& output_text = idx == 0 ? left_extruder_unprintable_text : right_extruder_unprintable_text; auto& output_text = idx == 0 ? left_extruder_unprintable_text : right_extruder_unprintable_text;
if (unprintable_objs.empty()) if (unprintable_objs.empty())
continue; continue;
std::string nozzle_name = nozzle_name_list[0]; std::string nozzle_name = nozzle_name_list[idx];
std::string opposite_nozzle_name = idx == 0 ? nozzle_name_list[1] : nozzle_name_list[0]; std::string opposite_nozzle_name = nozzle_name_list[1-idx];
std::string model_prefix; std::string model_prefix;
if (object_result.object_filaments.size() > 1) if (object_result.object_filaments.size() > 1)
model_prefix = _u8L("Some models are"); model_prefix = _u8L("Some models are");
@ -3000,10 +3001,10 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
const bool fullyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Fully_Outside); const bool fullyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Fully_Outside);
const bool objectLimited = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Limited); const bool objectLimited = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Limited);
construct_error_string(object_results, get_object_clashed_text()); auto clash_flag = construct_error_string(object_results, get_object_clashed_text());
auto unprintable_flag= construct_extruder_unprintable_error(object_results, get_left_extruder_unprintable_text(), get_right_extruder_unprintable_text()); auto unprintable_flag= construct_extruder_unprintable_error(object_results, get_left_extruder_unprintable_text(), get_right_extruder_unprintable_text());
_set_warning_notification(EWarning::ObjectClashed, partlyOut); _set_warning_notification(EWarning::ObjectClashed, clash_flag);
_set_warning_notification(EWarning::LeftExtruderPrintableError, unprintable_flag.first); _set_warning_notification(EWarning::LeftExtruderPrintableError, unprintable_flag.first);
_set_warning_notification(EWarning::RightExtruderPrintableError, unprintable_flag.second); _set_warning_notification(EWarning::RightExtruderPrintableError, unprintable_flag.second);
_set_warning_notification(EWarning::ObjectLimited, objectLimited); _set_warning_notification(EWarning::ObjectLimited, objectLimited);
@ -10168,7 +10169,6 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
case EWarning::SlaSupportsOutside: text = ("SLA supports outside the print area were detected."); error = ErrorType::PLATER_ERROR; break; case EWarning::SlaSupportsOutside: text = ("SLA supports outside the print area were detected."); error = ErrorType::PLATER_ERROR; break;
case EWarning::SomethingNotShown: text = _u8L("Only the object being edited is visible."); break; case EWarning::SomethingNotShown: text = _u8L("Only the object being edited is visible."); break;
case EWarning::ObjectClashed: case EWarning::ObjectClashed:
text = get_object_clashed_text();
error = ErrorType::PLATER_ERROR; error = ErrorType::PLATER_ERROR;
break; break;
case EWarning::ObjectLimited: case EWarning::ObjectLimited:
@ -10222,6 +10222,16 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
notification_manager.close_slicing_customize_error_notification(NotificationType::RightExtruderUnprintableError, NotificationLevel::ErrorNotificationLevel); notification_manager.close_slicing_customize_error_notification(NotificationType::RightExtruderUnprintableError, NotificationLevel::ErrorNotificationLevel);
} }
} }
else if (warning == EWarning::ObjectClashed) {
auto str = get_object_clashed_text();
if(state){
if (!str.empty())
notification_manager.push_plater_error_notification(str);
}
else{
notification_manager.close_plater_error_notification(str);
}
}
else { else {
if (state) if (state)
notification_manager.push_plater_error_notification(text); notification_manager.push_plater_error_notification(text);

View File

@ -759,7 +759,6 @@ public:
unsigned int get_volumes_count() const; unsigned int get_volumes_count() const;
const GLVolumeCollection& get_volumes() const { return m_volumes; } const GLVolumeCollection& get_volumes() const { return m_volumes; }
void reset_volumes(); void reset_volumes();
static void construct_error_string(ObjectFilamentResults& object_result, std::string& error_string);
ModelInstanceEPrintVolumeState check_volumes_outside_state(ObjectFilamentResults* object_results = nullptr) const; ModelInstanceEPrintVolumeState check_volumes_outside_state(ObjectFilamentResults* object_results = nullptr) const;
bool is_all_plates_selected() { return m_sel_plate_toolbar.m_all_plates_stats_item && m_sel_plate_toolbar.m_all_plates_stats_item->selected; } bool is_all_plates_selected() { return m_sel_plate_toolbar.m_all_plates_stats_item && m_sel_plate_toolbar.m_all_plates_stats_item->selected; }
const float get_scale() const; const float get_scale() const;

View File

@ -15643,11 +15643,13 @@ void Plater::validate_current_plate(bool& model_fits, bool& validate_error)
p->view3D->get_canvas3d()->set_sequential_print_clearance_polygons(polygons, height_polygons); p->view3D->get_canvas3d()->set_sequential_print_clearance_polygons(polygons, height_polygons);
} }
auto clashed_text = get_object_clashed_text();
if (!model_fits) { if (!model_fits) {
p->notification_manager->push_plater_error_notification(get_object_clashed_text()); if(!clashed_text.empty())
p->notification_manager->push_plater_error_notification(clashed_text);
} }
else { else {
p->notification_manager->close_plater_error_notification(get_object_clashed_text()); p->notification_manager->close_plater_error_notification(clashed_text);
} }
if (state == ModelInstancePVS_Limited) { if (state == ModelInstancePVS_Limited) {