From 43353a6036fe3ec2cb753204bfb5679f1d381832 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Mon, 17 Feb 2025 19:17:22 +0800 Subject: [PATCH 1/2] Fix a regression that total layer number is missign for BBL printers --- src/libslic3r/GCode/GCodeProcessor.cpp | 34 +++++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index b2ab4d294..063785ce9 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -4415,33 +4415,43 @@ void GCodeProcessor::run_post_process() } } } - } - else if (line == reserved_tag(ETags::Estimated_Printing_Time_Placeholder)) { + } else if (line == reserved_tag(ETags::Estimated_Printing_Time_Placeholder)) { for (size_t i = 0; i < static_cast(PrintEstimatedStatistics::ETimeMode::Count); ++i) { - const TimeMachine& machine = m_time_processor.machines[i]; - PrintEstimatedStatistics::ETimeMode mode = static_cast(i); + const TimeMachine& machine = m_time_processor.machines[i]; + PrintEstimatedStatistics::ETimeMode mode = static_cast(i); if (mode == PrintEstimatedStatistics::ETimeMode::Normal || machine.enabled) { char buf[128]; - sprintf(buf, "; estimated printing time (%s mode) = %s\n", - (mode == PrintEstimatedStatistics::ETimeMode::Normal) ? "normal" : "silent", - get_time_dhms(machine.time).c_str()); + if (!s_IsBBLPrinter) + // Orca: compatibility with klipper_estimator + sprintf(buf, "; estimated printing time (%s mode) = %s\n", + (mode == PrintEstimatedStatistics::ETimeMode::Normal) ? "normal" : "silent", + get_time_dhms(machine.time).c_str()); + else { + sprintf(buf, "; model printing time: %s; total estimated time: %s\n", + get_time_dhms(machine.time - machine.prepare_time).c_str(), get_time_dhms(machine.time).c_str()); + } export_lines.append_line(buf); - processed = true; } } for (size_t i = 0; i < static_cast(PrintEstimatedStatistics::ETimeMode::Count); ++i) { - const TimeMachine& machine = m_time_processor.machines[i]; - PrintEstimatedStatistics::ETimeMode mode = static_cast(i); + const TimeMachine& machine = m_time_processor.machines[i]; + PrintEstimatedStatistics::ETimeMode mode = static_cast(i); if (mode == PrintEstimatedStatistics::ETimeMode::Normal || machine.enabled) { char buf[128]; sprintf(buf, "; estimated first layer printing time (%s mode) = %s\n", - (mode == PrintEstimatedStatistics::ETimeMode::Normal) ? "normal" : "silent", - get_time_dhms(machine.prepare_time).c_str()); + (mode == PrintEstimatedStatistics::ETimeMode::Normal) ? "normal" : "silent", + get_time_dhms(machine.prepare_time).c_str()); export_lines.append_line(buf); processed = true; } } } + // Orca: write total layer number, this is used by Bambu printers only as of now + else if (line == reserved_tag(ETags::Total_Layer_Number_Placeholder)) { + char buf[128]; + sprintf(buf, "; total layer number: %u\n", m_layer_id); + export_lines.append_line(buf); + } } return processed; From ab7ef4f55efeabd92b5b303fd4be07b522af3cc5 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Tue, 18 Feb 2025 20:13:42 +0800 Subject: [PATCH 2/2] Fixed an issue that raimaining time is wrong when arc fitting is enabled. --- src/libslic3r/GCode/GCodeProcessor.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index ce8d0e6f0..661dd8a98 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -380,7 +380,7 @@ class Print; EMoveType move_type{ EMoveType::Noop }; ExtrusionRole role{ erNone }; unsigned int g1_line_id{ 0 }; - unsigned int remaining_internal_g1_lines; + unsigned int remaining_internal_g1_lines{ 0 }; unsigned int layer_id{ 0 }; float distance{ 0.0f }; // mm float acceleration{ 0.0f }; // mm/s^2 @@ -429,7 +429,7 @@ class Print; struct G1LinesCacheItem { unsigned int id; - unsigned int remaining_internal_g1_lines; + unsigned int remaining_internal_g1_lines{ 0 }; float elapsed_time; };