ENH: cli: add more information into result.json
jira: no-jira Change-Id: I59d5a249663f79bfd3fe830abd2587cc9e618593
This commit is contained in:
parent
8df768a447
commit
6e7eeb08b8
|
@ -1334,19 +1334,19 @@ int CLI::run(int argc, char **argv)
|
||||||
/*BOOST_LOG_TRIVIAL(info) << "begin to setup params, argc=" << argc << std::endl;
|
/*BOOST_LOG_TRIVIAL(info) << "begin to setup params, argc=" << argc << std::endl;
|
||||||
for (int index=0; index < argc; index++)
|
for (int index=0; index < argc; index++)
|
||||||
BOOST_LOG_TRIVIAL(info) << "index="<< index <<", arg is "<< argv[index] <<std::endl;
|
BOOST_LOG_TRIVIAL(info) << "index="<< index <<", arg is "<< argv[index] <<std::endl;
|
||||||
int debug_argc = 12;
|
int debug_argc = 5;
|
||||||
char* debug_argv[] = {
|
char* debug_argv[] = {
|
||||||
"F:\work\projects\bambu_debug\bamboo_slicer\build_debug\src\Debug\bambu-studio.exe",
|
"F:\work\projects\bambu_debug\bamboo_slicer\build_debug\src\Debug\bambu-studio.exe",
|
||||||
"--debug=2",
|
"--debug=2",
|
||||||
//"--uptodate",
|
//"--uptodate",
|
||||||
"--load-settings",
|
//"--load-settings",
|
||||||
"machine_A1.json",
|
//"machine_A1.json",
|
||||||
"--load-defaultfila",
|
//"--load-defaultfila",
|
||||||
"--load-filaments",
|
//"--load-filaments",
|
||||||
"filament_pla_basic_A1.json;filament_pla_basic_A1.json",
|
//"filament_pla_basic_A1.json;filament_pla_basic_A1.json",
|
||||||
"--export-3mf=output.3mf",
|
"--export-3mf=output.3mf",
|
||||||
"--filament-colour",
|
//"--filament-colour",
|
||||||
"#CD056D;#702829",
|
//"#CD056D;#702829",
|
||||||
//"--nozzle-volume-type",
|
//"--nozzle-volume-type",
|
||||||
//"Standard,High Flow",
|
//"Standard,High Flow",
|
||||||
//"--filament-map-mode",
|
//"--filament-map-mode",
|
||||||
|
@ -1354,7 +1354,7 @@ int CLI::run(int argc, char **argv)
|
||||||
//"--filament-map",
|
//"--filament-map",
|
||||||
//"1,2,1,2",
|
//"1,2,1,2",
|
||||||
"--slice=0",
|
"--slice=0",
|
||||||
"test.3mf"
|
"cube_a1.3mf"
|
||||||
};
|
};
|
||||||
if (! this->setup(debug_argc, debug_argv))*/
|
if (! this->setup(debug_argc, debug_argv))*/
|
||||||
if (!this->setup(argc, argv))
|
if (!this->setup(argc, argv))
|
||||||
|
@ -5997,21 +5997,17 @@ int CLI::run(int argc, char **argv)
|
||||||
//get predication and filament change
|
//get predication and filament change
|
||||||
PrintEstimatedStatistics& print_estimated_stat = gcode_result->print_statistics;
|
PrintEstimatedStatistics& print_estimated_stat = gcode_result->print_statistics;
|
||||||
const PrintEstimatedStatistics::Mode& time_mode = print_estimated_stat.modes[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)];
|
const PrintEstimatedStatistics::Mode& time_mode = print_estimated_stat.modes[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)];
|
||||||
auto it_wipe = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [](const std::pair<ExtrusionRole, float>& item) { return ExtrusionRole::erWipeTower == item.first; });
|
auto it = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [](const std::pair<ExtrusionRole, float>& item) { return ExtrusionRole::erWipeTower == item.first; });
|
||||||
sliced_plate_info.total_predication = time_mode.time;
|
sliced_plate_info.total_predication = time_mode.time;
|
||||||
sliced_plate_info.main_predication = time_mode.time - time_mode.prepare_time;
|
sliced_plate_info.main_predication = time_mode.time - time_mode.prepare_time;
|
||||||
sliced_plate_info.filament_change_times = print_estimated_stat.total_filamentchanges;
|
sliced_plate_info.filament_change_times = print_estimated_stat.total_filament_changes;
|
||||||
if (it_wipe != time_mode.roles_times.end()) {
|
if (it != time_mode.roles_times.end()) {
|
||||||
//filament changes time will be included in prime tower time later
|
//filament changes time will be included in prime tower time later
|
||||||
//ConfigOptionFloat* machine_load_filament_time_opt = m_print_config.option<ConfigOptionFloat>("machine_load_filament_time");
|
//ConfigOptionFloat* machine_load_filament_time_opt = m_print_config.option<ConfigOptionFloat>("machine_load_filament_time");
|
||||||
//ConfigOptionFloat* machine_unload_filament_time_opt = m_print_config.option<ConfigOptionFloat>("machine_unload_filament_time");
|
//ConfigOptionFloat* machine_unload_filament_time_opt = m_print_config.option<ConfigOptionFloat>("machine_unload_filament_time");
|
||||||
sliced_plate_info.main_predication -= it_wipe->second;
|
sliced_plate_info.main_predication -= it->second;
|
||||||
//sliced_plate_info.main_predication -= sliced_plate_info.filament_change_times * (machine_load_filament_time_opt->value + machine_unload_filament_time_opt->value);
|
//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<ExtrusionRole, float>& 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;
|
bool has_tool_change = false;
|
||||||
auto custom_gcodes_iter = model.plates_custom_gcodes.find(index);
|
auto custom_gcodes_iter = model.plates_custom_gcodes.find(index);
|
||||||
if (custom_gcodes_iter != model.plates_custom_gcodes.end())
|
if (custom_gcodes_iter != model.plates_custom_gcodes.end())
|
||||||
|
@ -6024,7 +6020,7 @@ int CLI::run(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (has_tool_change)
|
if (has_tool_change)
|
||||||
sliced_plate_info.layer_filament_change = print_estimated_stat.total_filamentchanges;
|
sliced_plate_info.layer_filament_change = print_estimated_stat.total_filament_changes;
|
||||||
|
|
||||||
//filaments
|
//filaments
|
||||||
auto* filament_ids = dynamic_cast<const ConfigOptionStrings*>(m_print_config.option("filament_ids"));
|
auto* filament_ids = dynamic_cast<const ConfigOptionStrings*>(m_print_config.option("filament_ids"));
|
||||||
|
@ -6038,10 +6034,7 @@ int CLI::run(int argc, char **argv)
|
||||||
filament_info.id = iter.first + 1;
|
filament_info.id = iter.first + 1;
|
||||||
filament_info.total_used_g = iter.second;
|
filament_info.total_used_g = iter.second;
|
||||||
|
|
||||||
if (filament_ids && (filament_info.id <= filament_ids->values.size()))
|
filament_info.filament_id = (filament_info.id <= filament_ids->values.size())? filament_ids->values[iter.first] : "unknown";
|
||||||
filament_info.filament_id = filament_ids->values[iter.first];
|
|
||||||
else
|
|
||||||
filament_info.filament_id = "unknown";
|
|
||||||
|
|
||||||
auto main_iter = print_estimated_stat.model_volumes_per_extruder.find(iter.first);
|
auto main_iter = print_estimated_stat.model_volumes_per_extruder.find(iter.first);
|
||||||
if (main_iter != print_estimated_stat.model_volumes_per_extruder.end())
|
if (main_iter != print_estimated_stat.model_volumes_per_extruder.end())
|
||||||
|
@ -7174,8 +7167,8 @@ std::string CLI::output_filepath(const ModelObject &object, unsigned int index,
|
||||||
// use --outputdir when available
|
// use --outputdir when available
|
||||||
file_name = object.name.empty()?object.input_file:object.name;
|
file_name = object.name.empty()?object.input_file:object.name;
|
||||||
file_name = "obj_"+std::to_string(index)+"_"+file_name;
|
file_name = "obj_"+std::to_string(index)+"_"+file_name;
|
||||||
size_t pos = file_name.rfind(ext), ext_pos = file_name.size() - ext.size();
|
size_t pos = file_name.find_last_of(ext), ext_pos = file_name.size() - 1;
|
||||||
if ((pos == std::string::npos) || (pos != ext_pos))
|
if (pos != ext_pos)
|
||||||
file_name += ext;
|
file_name += ext;
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": dir = "<< path_dir<<", file_name="<<file_name<< ", pos = "<<pos<<", ext_pos="<<ext_pos;
|
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": dir = "<< path_dir<<", file_name="<<file_name<< ", pos = "<<pos<<", ext_pos="<<ext_pos;
|
||||||
|
|
Loading…
Reference in New Issue