ENH: modify the error information of gcode check

jira: none
Change-Id: Icccd17e110408f2fdb9890307139de0f9821f008
This commit is contained in:
zhimin.zeng 2024-10-14 09:57:49 +08:00 committed by lane.wei
parent f53e00ec6d
commit 2ee87600cb
2 changed files with 13 additions and 2 deletions

View File

@ -9631,6 +9631,9 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
case EWarning::ToolpathOutside: text = _u8L("A G-code path goes beyond the boundary of plate."); error = ErrorType::SLICING_ERROR; break;
case EWarning::MultiExtruderPrintableError: {
text.clear();
int master_extruder_id = 0; // main extruder is left or right
if (m_config->has("master_extruder_id"))
master_extruder_id = m_config->opt_int("master_extruder_id") - 1;
for (auto error_iter = m_gcode_viewer.m_gcode_check_result.error_infos.begin(); error_iter != m_gcode_viewer.m_gcode_check_result.error_infos.end(); ++error_iter) {
if (error_iter != m_gcode_viewer.m_gcode_check_result.error_infos.begin()) {
text += "\n";
@ -9643,8 +9646,16 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
}
filaments += std::to_string(error_iter->second[i] + 1);
}
text += (boost::format(_u8L("Extruder %d conflicts with filaments: %s.")) %extruder_id %filaments).str();
std::string extruder_name = extruder_id == master_extruder_id ? "Left extruder" : "Right extruder";
if (error_iter->second.size() == 1) {
text += (boost::format(_u8L("Filament %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();
}
else {
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;
break;
}

View File

@ -3131,7 +3131,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
"brim_width", "wall_loops", "wall_filament", "sparse_infill_density", "sparse_infill_filament", "top_shell_layers",
"enable_support", "support_filament", "support_interface_filament",
"support_top_z_distance", "support_bottom_z_distance", "raft_layers",
"best_object_pos", "extruder_change_length"
"best_object_pos", "extruder_change_length", "master_extruder_id"
}))
, sidebar(new Sidebar(q))
, notification_manager(std::make_unique<NotificationManager>(q))