feat(gui): per-filament nozzle volume selection and persistence

- FilamentMapDialog's manual page understands volume types: a mixed
  (Hybrid) extruder shows separate Standard / High Flow drop zones
  with live sub-nozzle counts, a validation timer with an inline
  error + "set nozzle count" suggestion, and composes a per-filament
  volume map on OK (persisted to the plate or globally)
- switching an extruder's Flow type rewrites the affected plate map
  entries; plate maps stay sized across filament add/delete/count
  changes (values keep their filament, no index shift)
- CLI: manual mapping on multi-nozzle printers synthesizes the volume
  map from extruder flow types when absent; nozzle-manual mode
  requires explicit maps; computed maps land on the plate so exported
  projects carry filament_volume_maps
- filament_nozzle_map joins the project options (selection seeding +
  filament-count resizing)
- pot entries for the new dialog strings

All 19 reference fixtures byte-identical; slicing an exported Hybrid
project reproduces its g-code byte-for-byte with the volume map
round-tripped through model_settings.config.
This commit is contained in:
SoftFever
2026-07-11 16:37:50 +08:00
parent 21b46044d0
commit 75c8d0775a
14 changed files with 1131 additions and 83 deletions

View File

@@ -3894,6 +3894,16 @@ void PartPlate::set_filament_count(int filament_count)
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map")->values;
filament_maps.resize(filament_count, 1);
}
if (m_config.has("filament_nozzle_map")) {
std::vector<int>& filament_nozzle_map = m_config.option<ConfigOptionInts>("filament_nozzle_map")->values;
filament_nozzle_map.resize(filament_count, 0);
}
if (m_config.has("filament_volume_map")) {
std::vector<int>& filament_volume_map = m_config.option<ConfigOptionInts>("filament_volume_map")->values;
filament_volume_map.resize(filament_count, static_cast<int>(NozzleVolumeType::nvtStandard));
}
}
void PartPlate::on_filament_added()
@@ -3902,6 +3912,27 @@ void PartPlate::on_filament_added()
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map")->values;
filament_maps.push_back(1);
}
if (m_config.has("filament_nozzle_map")) {
std::vector<int>& filament_nozzle_map = m_config.option<ConfigOptionInts>("filament_nozzle_map")->values;
filament_nozzle_map.push_back(0);
}
if (m_config.has("filament_volume_map")) {
std::vector<int>& filament_volume_map = m_config.option<ConfigOptionInts>("filament_volume_map")->values;
// A new filament defaults onto the first extruder, so seed its volume value from
// that extruder's flow type.
int volume_type = static_cast<int>(NozzleVolumeType::nvtStandard);
auto nozzle_volumes = wxGetApp().preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
if (nozzle_volumes && !nozzle_volumes->values.empty())
volume_type = nozzle_volumes->values[0];
// Orca: never store the Hybrid marker as a per-filament value; on a Hybrid extruder
// each filament still prints with a concrete flow, defaulting to Standard.
if (volume_type == static_cast<int>(NozzleVolumeType::nvtHybrid))
volume_type = static_cast<int>(NozzleVolumeType::nvtStandard);
filament_volume_map.push_back(volume_type);
}
}
void PartPlate::on_filament_deleted(int filament_count, int filament_id)
@@ -3914,6 +3945,19 @@ void PartPlate::on_filament_deleted(int filament_count, int filament_id)
if (filament_id >= 0 && filament_id < (int) filament_maps.size())
filament_maps.erase(filament_maps.begin() + filament_id);
}
if (m_config.has("filament_nozzle_map")) {
std::vector<int>& filament_nozzle_map = m_config.option<ConfigOptionInts>("filament_nozzle_map")->values;
if (filament_id >= 0 && filament_id < (int) filament_nozzle_map.size())
filament_nozzle_map.erase(filament_nozzle_map.begin() + filament_id);
}
if (m_config.has("filament_volume_map")) {
std::vector<int>& filament_volume_map = m_config.option<ConfigOptionInts>("filament_volume_map")->values;
if (filament_id >= 0 && filament_id < (int) filament_volume_map.size())
filament_volume_map.erase(filament_volume_map.begin() + filament_id);
}
update_first_layer_print_sequence_when_delete_filament(filament_id);
}