ENH: abnormal gap infill width gcodecheck
Jira: none Signed-off-by: qing.zhang <qing.zhang@bambulab.com> Change-Id: I96e269becf540a77fd10fb8c8b25a699e89eaf3f
This commit is contained in:
parent
c46e304b94
commit
b4faec8052
|
@ -24,6 +24,7 @@ const std::string nozzle_temperature_Tag = " nozzle_temperature =";
|
||||||
const std::string nozzle_temperature_initial_layer_Tag = " nozzle_temperature_initial_layer";
|
const std::string nozzle_temperature_initial_layer_Tag = " nozzle_temperature_initial_layer";
|
||||||
const std::string Z_HEIGHT_TAG = " Z_HEIGHT: ";
|
const std::string Z_HEIGHT_TAG = " Z_HEIGHT: ";
|
||||||
const std::string Initial_Layer_Ptint_Height_Tag = " initial_layer_print_height =";
|
const std::string Initial_Layer_Ptint_Height_Tag = " initial_layer_print_height =";
|
||||||
|
const std::string Line_Width_Tag = " line_width =";
|
||||||
|
|
||||||
GCodeCheckResult GCodeChecker::parse_file(const std::string& path)
|
GCodeCheckResult GCodeChecker::parse_file(const std::string& path)
|
||||||
{
|
{
|
||||||
|
@ -110,8 +111,8 @@ GCodeCheckResult GCodeChecker::parse_comment(GCodeLine& line)
|
||||||
// extrusion role tag
|
// extrusion role tag
|
||||||
if (starts_with(comment, Extrusion_Role_Tag)) {
|
if (starts_with(comment, Extrusion_Role_Tag)) {
|
||||||
m_role = string_to_role(comment.substr(Extrusion_Role_Tag.length()));
|
m_role = string_to_role(comment.substr(Extrusion_Role_Tag.length()));
|
||||||
|
check_gap_infill_width = false;
|
||||||
if (m_role == erExternalPerimeter) {
|
if (m_role == erExternalPerimeter) {
|
||||||
|
|
||||||
if (z_height == initial_layer_height && nozzle_temp != nozzle_temperature_initial_layer[filament_id]) {
|
if (z_height == initial_layer_height && nozzle_temp != nozzle_temperature_initial_layer[filament_id]) {
|
||||||
std::cout << "invalid filament nozzle initial layer temperature comment with invalid value!" << std::endl;
|
std::cout << "invalid filament nozzle initial layer temperature comment with invalid value!" << std::endl;
|
||||||
return GCodeCheckResult::ParseFailed;
|
return GCodeCheckResult::ParseFailed;
|
||||||
|
@ -121,6 +122,8 @@ GCodeCheckResult GCodeChecker::parse_comment(GCodeLine& line)
|
||||||
std::cout << "invalid filament nozzle temperature comment with invalid value!" << std::endl;
|
std::cout << "invalid filament nozzle temperature comment with invalid value!" << std::endl;
|
||||||
return GCodeCheckResult::ParseFailed;
|
return GCodeCheckResult::ParseFailed;
|
||||||
}
|
}
|
||||||
|
} else if (m_role == erGapFill) {
|
||||||
|
check_gap_infill_width = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if (starts_with(comment, Wipe_Start_Tag)) {
|
}else if (starts_with(comment, Wipe_Start_Tag)) {
|
||||||
|
@ -139,6 +142,15 @@ GCodeCheckResult GCodeChecker::parse_comment(GCodeLine& line)
|
||||||
std::cout << "invalid width comment with invalid value!" << std::endl;
|
std::cout << "invalid width comment with invalid value!" << std::endl;
|
||||||
return GCodeCheckResult::ParseFailed;
|
return GCodeCheckResult::ParseFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check gap infill line width
|
||||||
|
if( check_gap_infill_width ) {
|
||||||
|
if (m_width > max_gap_infill_width) {
|
||||||
|
std::cout << "gap infill width has invalid value!" << std::endl;
|
||||||
|
std::cout << "allowed max gap width: " << max_gap_infill_width << std::endl;
|
||||||
|
return GCodeCheckResult::ParseFailed;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (starts_with(comment, Layer_Change_Tag)) {
|
} else if (starts_with(comment, Layer_Change_Tag)) {
|
||||||
m_layer_num++;
|
m_layer_num++;
|
||||||
} else if (starts_with(comment, filament_flow_ratio_tag))
|
} else if (starts_with(comment, filament_flow_ratio_tag))
|
||||||
|
@ -175,8 +187,15 @@ GCodeCheckResult GCodeChecker::parse_comment(GCodeLine& line)
|
||||||
std::cout << "invalid initial layer height comment with invalid value!" << std::endl;
|
std::cout << "invalid initial layer height comment with invalid value!" << std::endl;
|
||||||
return GCodeCheckResult::ParseFailed;
|
return GCodeCheckResult::ParseFailed;
|
||||||
}
|
}
|
||||||
|
} else if (starts_with(comment, Line_Width_Tag)) {
|
||||||
|
std::string str = comment.substr(Line_Width_Tag.size());
|
||||||
|
double default_line_width = 0.0f;
|
||||||
|
if (!parse_double_from_str(str, default_line_width)) {
|
||||||
|
std::cout << "invalid initial layer height comment with invalid value!" << std::endl;
|
||||||
|
return GCodeCheckResult::ParseFailed;
|
||||||
|
}
|
||||||
|
max_gap_infill_width = 3 * default_line_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GCodeCheckResult::Success;
|
return GCodeCheckResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,6 +209,8 @@ private:
|
||||||
double m_width = 0.0;
|
double m_width = 0.0;
|
||||||
double z_height=0.0f;
|
double z_height=0.0f;
|
||||||
double initial_layer_height=0.0f;
|
double initial_layer_height=0.0f;
|
||||||
|
double max_gap_infill_width = 0.0f;
|
||||||
|
bool check_gap_infill_width = false;
|
||||||
int filament_id;
|
int filament_id;
|
||||||
double flow_ratio = 0;
|
double flow_ratio = 0;
|
||||||
double nozzle_temp = 0.0f;
|
double nozzle_temp = 0.0f;
|
||||||
|
|
Loading…
Reference in New Issue