mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-05 09:07:39 +00:00
feat(gcode): resolve per-filament variant slots per layer
- the g-code writer tracks the current layer id and resolves FILAMENT_CONFIG/NOZZLE_CONFIG (plus every non-macro variant lookup, toolchange placeholder scalars, and the change-filament flush overrides) through Print's per-filament, per-layer config-index resolvers instead of the filament->extruder collapse - update_layer_related_config refreshes the per-layer extruder/volume/nozzle maps in the writer config; update_placeholder_parser_with_variant_params remaps the filament-variant arrays into filament-id space for custom g-code (Orca's flush placeholder computation moves inside it) - the engine's concrete per-filament volume assignment now merges into the config write-back (the temporary hold from the producer commit is lifted together with these consumers), and the background process reads the computed volume map back to the plate - append_full_config dumps the resolved filament_map_2 slots - update_used_filament_values gains a bounds guard - tests: per-filament Hybrid slot resolution + null-result fallback Result: on a Hybrid extruder, each filament's features slice with its assigned sub-nozzle's variant values (speeds, volumetric limits, retraction). Verified on a 4-filament H2C Hybrid project: outer walls split into three feedrate populations (30/50/200 mm/s), toolpath geometry byte-identical, deterministic across repeated slices. All 18 non-Hybrid reference fixtures stay byte-identical except the filament_map_2 header value now showing the real slot. Auto grouping ties (multiple zero-flush perfect matchings) may pick a different filament-to-nozzle isolation than other slicers; verified co-optimal.
This commit is contained in:
@@ -331,6 +331,10 @@ namespace FilamentGroupUtils
|
||||
{
|
||||
std::vector<int> res = old_values;
|
||||
for (size_t i = 0; i < used_filaments.size(); ++i) {
|
||||
// Orca: guard against filament ids beyond the map sizes (possible with
|
||||
// mis-normalized per-filament arrays from CLI inputs); skip instead of UB.
|
||||
if (used_filaments[i] >= res.size() || used_filaments[i] >= new_values.size())
|
||||
continue;
|
||||
res[used_filaments[i]] = new_values[used_filaments[i]];
|
||||
}
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user