ENH: use gcode processer to get precise layer number

Using layer z to calculate total layer number is not
precision, because for some models with sharp top
layer, the top layer may be empty.

Check the final layer change in final gcode file.
This must be same with total layer number.

Jira: Studio-2123

Signed-off-by: salt.wei <salt.wei@bambulab.com>
Change-Id: I5d001a8bb9548c3fb5f67fda966051ac3bb16502
This commit is contained in:
salt.wei 2023-01-29 11:47:57 +08:00 committed by Lane.Wei
parent a36b7c3a9c
commit 431eabd464
3 changed files with 14 additions and 6 deletions

View file

@ -1482,7 +1482,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
//BBS: total estimated printing time
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str());
//BBS: total layer number
file.write_format("; total layer number: %d\n", m_layer_count);
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Total_Layer_Number_Placeholder).c_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