ENH: Add gcode check for multi_extruder

jira: none
Change-Id: Iebc43e608c4509eb62b280af2d401fa9e0e089ba
(cherry picked from commit c75c10e312b8d0bd5404d92db88c95a9e6186bc1)
This commit is contained in:
zhimin.zeng
2024-09-02 17:59:57 +08:00
committed by Noisyfox
parent 7bd16a3ca7
commit 135b39526e
12 changed files with 149 additions and 2 deletions

View File

@@ -2906,6 +2906,7 @@ void GLCanvas3D::load_gcode_preview(const GCodeProcessorResult& gcode_result, co
_set_warning_notification_if_needed(EWarning::ToolHeightOutside);
_set_warning_notification_if_needed(EWarning::ToolpathOutside);
_set_warning_notification_if_needed(EWarning::GCodeConflict);
_set_warning_notification_if_needed(EWarning::MultiExtruderPrintableError);
}
m_gcode_viewer.refresh(gcode_result, str_tool_colors);
@@ -9646,6 +9647,8 @@ void GLCanvas3D::_set_warning_notification_if_needed(EWarning warning)
}
else if (warning == EWarning::GCodeConflict)
show = m_gcode_viewer.has_data() && m_gcode_viewer.is_contained_in_bed() && m_gcode_viewer.m_conflict_result.has_value();
else if (warning == EWarning::MultiExtruderPrintableError)
show = m_gcode_viewer.has_data() && m_gcode_viewer.m_gcode_check_result.error_code != 0;
}
}
}
@@ -9690,6 +9693,25 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
case EWarning::ObjectOutside: text = _u8L("An object is laid over the plate boundaries."); break;
case EWarning::ToolHeightOutside: text = _u8L("A G-code path goes beyond the max print height."); error = ErrorType::SLICING_ERROR; break;
case EWarning::ToolpathOutside: text = _u8L("A G-code path goes beyond the plate boundaries."); error = ErrorType::SLICING_ERROR; break;
case EWarning::MultiExtruderPrintableError: {
text.clear();
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";
}
int extruder_id = error_iter->first + 1;
std::string filaments;
for (size_t i = 0; i < error_iter->second.size(); ++i) {
if (i > 0) {
filaments += ", ";
}
filaments += std::to_string(error_iter->second[i] + 1);
}
text += (boost::format(_u8L("Extruder %d conflicts with filaments: %s.")) %extruder_id %filaments).str();
}
error = ErrorType::SLICING_ERROR;
break;
}
// BBS: remove _u8L() for SLA
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;