FIX: Old version of gcode cannot be opened normally

jira: STUDIO-10825
Change-Id: Ibf512cd4abc5315bb090d39974fb436e328214c7
This commit is contained in:
zhimin.zeng 2025-03-12 19:08:47 +08:00 committed by lane.wei
parent fa9da1215b
commit de449496b5
1 changed files with 8 additions and 1 deletions

View File

@ -1561,7 +1561,7 @@ void GCodeProcessor::register_commands()
if (auto lowercase_cmd = to_lowercase(uppercase_cmd); lowercase_cmd != uppercase_cmd)
m_command_processor.register_command(lowercase_cmd, handler,early_quit);
}
}
}
bool GCodeProcessor::check_multi_extruder_gcode_valid(const std::vector<Polygons> &unprintable_areas, const std::vector<double>& printable_heights, const std::vector<int> &filament_map)
{
@ -2230,6 +2230,13 @@ void GCodeProcessor::process_file(const std::string& filename, std::function<voi
// Showing substitution log or errors may make sense, but we are not really reading many values from the G-code config,
// thus a probability of incorrect substitution is low and the G-code viewer is a consumer-only anyways.
config.load_from_gcode_file(filename, ForwardCompatibilitySubstitutionRule::EnableSilent);
ConfigOptionStrings *filament_color = config.opt<ConfigOptionStrings>("filament_colour");
ConfigOptionInts *filament_map = config.opt<ConfigOptionInts>("filament_map", true);
if (filament_color && filament_color->size() != filament_map->size()) {
filament_map->values.resize(filament_color->size(), 1);
}
apply_config(config);
}
else if (m_producer == EProducer::Simplify3D)