mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
FIX: crash of filament group in cli mode
1. Add protection for building machine filaments.Sometimes we don't know the info about maahcine filament jira:NONE Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I3198d3a1a8825aa50aa49734f60a32620fc4f890 (cherry picked from commit 0c60cefe5e188ba966f4c254f833ae81bc5da476)
This commit is contained in:
@@ -5147,6 +5147,10 @@ int CLI::run(int argc, char **argv)
|
||||
std::vector<std::string> extruder_ams_count(new_extruder_count, "");
|
||||
std::vector<std::vector<DynamicPrintConfig>> extruder_filament_info(new_extruder_count, std::vector<DynamicPrintConfig>());
|
||||
int color_count = 0;
|
||||
|
||||
const ConfigOptionStrings* filament_type = dynamic_cast<const ConfigOptionStrings *>(m_print_config.option("filament_type"));
|
||||
std::vector<std::string> types = filament_type ? filament_type->vserialize() : std::vector<std::string>{"PLA"};
|
||||
|
||||
for (int e_index = 0; e_index < new_extruder_count; e_index++)
|
||||
{
|
||||
extruder_ams_count[e_index] = "1#0|4#1";
|
||||
@@ -5154,10 +5158,15 @@ int CLI::run(int argc, char **argv)
|
||||
{
|
||||
DynamicPrintConfig temp_config;
|
||||
std::vector<std::string> temp_colors(1, "#FFFFFFFF");
|
||||
std::vector<std::string> temp_types(1, "PLA");
|
||||
//if (filament_color) {
|
||||
// temp_colors[0] = colors[color_count % colors.size()];
|
||||
//}
|
||||
if (filament_type)
|
||||
temp_types[0] = types[color_count % types.size()];
|
||||
|
||||
temp_config.option<ConfigOptionStrings>("filament_colour", true)->values = temp_colors;
|
||||
temp_config.option<ConfigOptionStrings>("filament_type", true)->values = temp_types;
|
||||
extruder_filament_info[e_index].push_back(std::move(temp_config));
|
||||
color_count++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user