Add Layer Time/Layer time(Log).

Main logic is ported from SuperSlicer

Signed-off-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
This commit is contained in:
SoftFever 2022-12-19 23:58:24 +08:00
parent 3d8eca022f
commit daf5384b5a
4 changed files with 62 additions and 7 deletions

View file

@ -1425,6 +1425,17 @@ void GCodeProcessor::finalize(bool post_process)
update_estimated_times_stats();
//update times for results
for (size_t i = 0; i < m_result.moves.size(); i++) {
//field layer_duration contains the layer id for the move in which the layer_duration has to be set.
size_t layer_id = size_t(m_result.moves[i].layer_duration);
std::vector<float>& layer_times = m_result.print_statistics.modes[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)].layers_times;
if (layer_times.size() > layer_id - 1 && layer_id > 0)
m_result.moves[i].layer_duration = layer_times[layer_id - 1];
else
m_result.moves[i].layer_duration = 0;
}
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
std::cout << "\n";
m_mm3_per_mm_compare.output();
@ -3891,6 +3902,7 @@ void GCodeProcessor::store_move_vertex(EMoveType type, EMovePathType path_type)
m_fan_speed,
m_extruder_temps[m_extruder_id],
static_cast<float>(m_result.moves.size()),
static_cast<float>(m_layer_id), //layer_duration: set later
//BBS: add arc move related data
path_type,
Vec3f(m_arc_center(0, 0) + m_x_offset, m_arc_center(1, 0) + m_y_offset, m_arc_center(2, 0)) + m_extruder_offsets[m_extruder_id],

View file

@ -117,6 +117,8 @@ namespace Slic3r {
float fan_speed{ 0.0f }; // percentage
float temperature{ 0.0f }; // Celsius degrees
float time{ 0.0f }; // s
float layer_duration{ 0.0f }; // s (layer id before finalize)
//BBS: arc move related data
EMovePathType move_path_type{ EMovePathType::Noop_move };