From 134154a0c935e58a4d85072422ac7e38fd00935c Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Tue, 21 Jan 2025 14:36:17 +0800 Subject: [PATCH] ENH: CLI: exclude the time of erFlush from main_predication jira: no-jira Change-Id: Ie069fd957227c50619613a50ed5425b00efa4133 --- src/BambuStudio.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/BambuStudio.cpp b/src/BambuStudio.cpp index d85653fcf..2e5a5abe7 100644 --- a/src/BambuStudio.cpp +++ b/src/BambuStudio.cpp @@ -5687,17 +5687,21 @@ int CLI::run(int argc, char **argv) //get predication and filament change PrintEstimatedStatistics& print_estimated_stat = gcode_result->print_statistics; const PrintEstimatedStatistics::Mode& time_mode = print_estimated_stat.modes[static_cast(PrintEstimatedStatistics::ETimeMode::Normal)]; - auto it = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [](const std::pair& item) { return ExtrusionRole::erWipeTower == item.first; }); + auto it_wipe = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [](const std::pair& item) { return ExtrusionRole::erWipeTower == item.first; }); sliced_plate_info.total_predication = time_mode.time; sliced_plate_info.main_predication = time_mode.time - time_mode.prepare_time; sliced_plate_info.filament_change_times = print_estimated_stat.total_filamentchanges; - if (it != time_mode.roles_times.end()) { + if (it_wipe != time_mode.roles_times.end()) { //filament changes time will be included in prime tower time later //ConfigOptionFloat* machine_load_filament_time_opt = m_print_config.option("machine_load_filament_time"); //ConfigOptionFloat* machine_unload_filament_time_opt = m_print_config.option("machine_unload_filament_time"); - sliced_plate_info.main_predication -= it->second; + sliced_plate_info.main_predication -= it_wipe->second; //sliced_plate_info.main_predication -= sliced_plate_info.filament_change_times * (machine_load_filament_time_opt->value + machine_unload_filament_time_opt->value); } + auto it_flush = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [](const std::pair& item) { return ExtrusionRole::erFlush == item.first; }); + if (it_flush != time_mode.roles_times.end()) { + sliced_plate_info.main_predication -= it_flush->second; + } bool has_tool_change = false; auto custom_gcodes_iter = model.plates_custom_gcodes.find(index); if (custom_gcodes_iter != model.plates_custom_gcodes.end())