enh: Remap filament (#12016)

# Description

This Pr improve the Remap filament feature.
It now recognizes the filaments used in the object and makes them available only for remapping.
You can also see a small preview, showing which color will be changed to which.

Before PR:
![before](https://github.com/user-attachments/assets/e13f3622-2420-478e-a22c-9d7cdc12b24c)


After PR:
![after](https://github.com/user-attachments/assets/38d94230-f5bd-45f2-b9cd-c5bdff5ee801)
This commit is contained in:
tome9111991
2026-01-26 08:21:18 +01:00
committed by GitHub
parent e81e7b9a23
commit 8abf0f761d
4 changed files with 197 additions and 46 deletions

22
task.md
View File

@@ -1,12 +1,12 @@
Analyze the bug that it failed to load project(3mf) from old version.
It failed pass below check in PresetBundle::load_config_file_config function, hence throw error.
if (config.option("extruder_variant_list")) {
//3mf support multiple extruder logic
size_t extruder_count = config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
extruder_variant_count = config.option<ConfigOptionStrings>("filament_extruder_variant", true)->size();
if ((extruder_variant_count != filament_self_indice.size())
|| (extruder_variant_count < num_filaments)) {
assert(false);
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": invalid config file %1%, can not find suitable filament_extruder_variant or filament_self_index") % name_or_path;
throw Slic3r::RuntimeError(std::string("Invalid configuration file: ") + name_or_path);
Analyze the bug that it failed to load project(3mf) from old version.
It failed pass below check in PresetBundle::load_config_file_config function, hence throw error.
if (config.option("extruder_variant_list")) {
//3mf support multiple extruder logic
size_t extruder_count = config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
extruder_variant_count = config.option<ConfigOptionStrings>("filament_extruder_variant", true)->size();
if ((extruder_variant_count != filament_self_indice.size())
|| (extruder_variant_count < num_filaments)) {
assert(false);
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": invalid config file %1%, can not find suitable filament_extruder_variant or filament_self_index") % name_or_path;
throw Slic3r::RuntimeError(std::string("Invalid configuration file: ") + name_or_path);
}