mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-04 16:52:29 +00:00
## Problem On H2C (carousel) printers, the wipe tower purge volume calculation in `_make_wipe_tower()` tracks filament state **per-extruder** (2 slots). Since H2C has up to 7 carousel nozzle slots on a single extruder, all filaments sharing that extruder are collapsed into one tracking slot. This causes: Test: [5cubes.3mf.zip](https://github.com/user-attachments/files/30092551/5cubes.3mf.zip) - **Massive redundant AMS flushing** every filament change on the carousel triggers a full purge against the "previous" filament, even when the target nozzle slot already has the correct filament loaded - **60.9g total weight** instead of ~17g (**3.5× material waste**) - **3h09m print time** instead of ~1h57m (**60% longer**) ## Root Cause The code uses `nozzle_cur_filament_ids[extruder_id]` (a 2-element array) to track which filament was last used for each extruder. BambuStudio uses `NozzleStatusRecorder`, which tracks per `group_id` (physical carousel slot 0..6). ## Changes | File | Change | |---|---| | `Print.cpp` | Replace `nozzle_cur_filament_ids` with `NozzleStatusRecorder`. Use `get_nozzle_for_filament()` to resolve the physical carousel slot per layer. Select `filament_prime_volume_nc` for nozzle changes, `filament_prime_volume` for filament changes. | | `PrintConfig.hpp` | Add `ConfigOptionFloats filament_prime_volume` (per-filament EC prime volume, missing from upstream but present in BBS and H2C profiles) | | `PrintConfig.cpp` | Register `filament_prime_volume` with default 45mm³ (matching BBS) | | `Preset.cpp` | Add `filament_prime_volume` to preset keys | Also includes `tests/compare_analyzer/` - two standalone Python tools for G-code slice comparison and temperature timeline analysis (stdlib only, no dependencies). ## Test Results (5-color H2C Hybrid print, same 3mf project) | Metric | Upstream (broken) | **Fixed** | BBS (reference) | |---|---|---|---| | **Total weight** | 60.90g | **16.20g** ✅ | 17.47g | | **Print time** | 3h09m | **1h57m** ✅ | 1h51m | | **Filament changes** | 105 | 105 | 140 | | **Tool changes** | 35 | 35 | 35 | | **Critical discrepancies vs BBS** | ⚠️ YES | ✅ None | — | ## Analysis Tools (`tests/compare_analyzer/`) Two standalone Python tools (stdlib only, no dependencies) for deep G-code comparison: - **`compare_slices.py`** - comprehensive .3mf slice comparison: filament usage, nozzle mapping, tool change sequences, prime tower analysis, temperature timeline, retract parameters, and automatic critical discrepancy detection (weight/time anomalies) - **`show_temp_plot.py`** - interactive HTML temperature timeline plotter for visualising heater profiles during multi-nozzle prints (supports single-file and side-by-side comparison) Usage: ```bash python3 tests/compare_analyzer/compare_slices.py file1.3mf file2.3mf --labels "Upstream" "Fixed" python3 tests/compare_analyzer/show_temp_plot.py file1.3mf file2.3mf ``` ## Screenshots ### OrcaSlicer Upstream (unfixed) - 60.90g, 3h09m <img width="1512" height="982" alt="Screenshot 2026-07-16 at 15 22 58" src="https://github.com/user-attachments/assets/3efb2bff-ff1e-43db-9669-feafa5921b51" /> ### OrcaSlicer Fixed - 16.20g, 1h57m <img width="1512" height="982" alt="Screenshot 2026-07-16 at 15 23 08" src="https://github.com/user-attachments/assets/c1d36dc5-9b01-4691-80ef-7364540e1f4e" /> ### BambuStudio Reference - 17.47g, 1h51m <img width="1512" height="982" alt="Screenshot 2026-07-16 at 15 24 52" src="https://github.com/user-attachments/assets/5c0b11e2-64f4-40e9-8c7c-3f42519786c3" /> ### Temperature Timeline: Upstream vs Fixed <img width="1511" height="829" alt="Screenshot 2026-07-16 at 15 23 35" src="https://github.com/user-attachments/assets/926c2cb5-dfd4-4ce0-bb40-82e6165eb134" /> ### Temperature Timeline: Fixed vs BBS <img width="1512" height="825" alt="Screenshot 2026-07-16 at 15 23 51" src="https://github.com/user-attachments/assets/85c72dda-e779-4aa6-8118-fb17e5f8482d" /> ## Compatibility Safe for non-carousel printers: when each extruder has a single nozzle, `group_id == extruder_id`, so `NozzleStatusRecorder` behaves identically to the original per-extruder tracking. The `filament_prime_volume` default (45mm³) matches the existing global `prime_volume` default. ## Reference BambuStudio `Print.cpp` `_make_wipe_tower()` L3341-3392 - `NozzleStatusRecorder` pattern.