ENH: add more info in header block

Add filament density and filament diameter in header block
Add max z height in header block

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I128f9bde4188882baed76340e3f9d752d8a9b645
This commit is contained in:
xun.zhang 2023-07-28 10:46:17 +08:00 committed by Lane.Wei
parent e2f94b478f
commit a02f700c5d
1 changed files with 18 additions and 0 deletions

View File

@ -1549,6 +1549,24 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
m_label_objects_ids.clear();
}
{
std::string filament_density_list = "; filament_density: ";
(filament_density_list+=m_config.filament_density.serialize()) +='\n';
file.writeln(filament_density_list);
std::string filament_diameter_list = "; filament_diameter: ";
(filament_diameter_list += m_config.filament_diameter.serialize()) += '\n';
file.writeln(filament_diameter_list);
coordf_t max_height_z = -1;
for (const auto& object : print.objects())
max_height_z = std::max(object->layers().back()->print_z, max_height_z);
std::ostringstream max_height_z_tip;
max_height_z_tip<<"; max_z_height: " << std::fixed << std::setprecision(2) << max_height_z << '\n';
file.writeln(max_height_z_tip.str());
}
file.write_format("; HEADER_BLOCK_END\n\n");
//BBS: write global config at the beginning of gcode file because printer need these config information