CLI: multi-color plate with prime tower crashes (0xC0000005) on 2.4.1-alpha and loses extruder assignment on 2.4.1
Is there an existing issue for this problem?
- [x] I have searched the existing issues (closest ones: #689, #1019, #1117; none covers this)
Snapmaker_Orca Version
2.4.1 (release, portable) and 2.4.1-alpha (portable). Both CLI.
Operating System (OS)
Windows
OS Version
Windows 11 Pro (10.0.22631)
Additional system information
Command-line slicing only (no GUI involved).
Printer
Snapmaker U1 (0.4 nozzle)
How to reproduce
Minimal project: two 20 x 20 x 5 mm cubes on plate 1, cube A on filament 2 and cube B on filament 3, prime tower enabled (enable_prime_tower = 1), Snapmaker U1 (0.4 nozzle) machine settings. The 3MF is attached in the first comment (10 KB).
snapmaker-orca.exe --allow-newer-file --slice 1 --outputdir out two_cubes_two_colors_prime_tower.3mf
Actual results
-
2.4.1-alpha: the process exits with
0xC0000005(access violation) and writes no G-code. The last log lines arePartPlate::calc_exclude_triangles: Unable to create exclude triangles. -
2.4.1: exit code 0, but the whole plate is printed with a single filament:
; filament used [g] = 0.00, 4.15, 0.00, 0.00;- only 3
T<n>lines, all from the start sequence; - cube B, assigned to filament 3, comes out in filament 2.
The extruder assignment is silently lost, which is worse than the crash because the G-code looks valid.
-
Control, same project with
enable_prime_tower = 0on 2.4.1: correct.; filament used [g] = 0.00, 1.48, 1.43, 0.00and 28T<n>lines.
We also see both behaviors on real multi-color plates (3 colors, per-part extruders): 2.4.1-alpha crashes, and 2.4.1 slices everything on one filament as soon as the prime tower is enabled.
Expected results
With the prime tower enabled, the CLI should slice each part with its assigned filament and generate the tool changes and the prime tower, as it does when the tower is disabled (and as the GUI does).
Project file & Debug log uploads
The project file (two_cubes_two_colors_prime_tower.3mf) is attached in the first comment. The CLI log shows nothing beyond the calc_exclude_triangles lines quoted above.
Checklist of files to include
- [ ] Log file
- [x] Project file
Anything else?
The project's Metadata/model_settings.config sets extruder 2 on cube A and extruder 3 on cube B, both at object and part level. As a workaround we slice with the prime tower disabled and report the result as an estimate.
Minimal project file for the repro (zipped because GitHub does not accept .3mf): two 20 mm cubes, filament 2 and 3, prime tower enabled.
I reproduced the 2.4.1 part on macOS (Apple silicon, official Snapmaker Orca 2.4.1 dmg, command line) with your attached project, unchanged, and it looks like the same bug as #1124. One key in the project file decides it.
| project | exit | ; filament used [g] |
T<n> lines |
|---|---|---|---|
| yours, as attached | 0 | 0.00, 4.15, 0.00, 0.00 |
3 |
yours + filament_adhesiveness_category |
0 | 0.00, 2.62, 2.86, 0.00 |
28 |
yours with enable_prime_tower = 0 |
0 | 0.00, 1.48, 1.43, 0.00 |
28 |
Rows 1 and 3 are your numbers on Windows, so it is not platform specific.
What differs: Metadata/project_settings.config in the attached .3mf has no filament_adhesiveness_category. The only change in row 2 is this line added to that file:
"filament_adhesiveness_category": ["100", "100", "100", "100"],
What the log shows: with --debug 4, the broken run prints this 25 times, once per layer, and the fixed run never does:
WipeTower2::tool_change_new: no wipe tower block for adhesiveness category 100, emitting an empty tool change result
Where, from reading main (e88f84a99), not from a debugger:
Print.cpparound line 3467 builds the tower's category list with one entry per value present infilament_adhesiveness_category. With the key missing that list is shorter than the filament count, andWipeTower2::get_filament_category()returns 0 for any filament beyond it.generate_wipe_tower_blocks()therefore creates the block under category 0.WipeTower2.cppline 1546 fillsm_filpar[idx].categorywithget_at(idx), which falls back to the default, 100.tool_change_new()looks the block up bym_filpar[new_tool].category(100), finds none and returns the empty result, so the tool change never reaches the G-code and the plate prints with the head that was already selected.
So the two places read the same option in two ways and disagree when it is shorter than the filament count. #1124 reaches it through flattened presets, this report through a project file.
Workaround until it is fixed: add the line above to Metadata/project_settings.config of each project (one value per filament) before calling the CLI.
Not tested: the 0xC0000005 crash on 2.4.1-alpha (I only have 2.4.1 here), your real 3-colour plates, and nothing was printed. I did not check whether projects saved by the 2.4.1 window always carry the key.
If you want a guard in the pipeline for files that are already sliced, this reads the G-code as text and exits 1 on row 1 and 0 on row 2: python3 tools/dropped_toolchanges.py plate_1.gcode (https://github.com/DesignMaster-Solutions/u1-dryrun/blob/main/tools/dropped_toolchanges.py).
Same root cause as #1124 — the wipe-tower category list is built with one entry per stored filament_adhesiveness_category value, so when the key is missing/short the list is shorter than the filament count and tool changes are dropped (get_filament_category returns 0 vs the expected 100). Already fixed by open PR #1139 (fixes #1124). I verified the fix independently against v2.4.1 and was about to submit a duplicate PR — not submitting one, linking #1139 here instead.
Thanks @alandebortolo and @creat3dworld, the diagnosis holds on Windows too. Adding filament_adhesiveness_category with one value per filament to Metadata/project_settings.config fixes both builds here.
Same two-cube repro, prime tower on, Windows 11, CLI:
| build | without the key | with the key |
|---|---|---|
| 2.4.1 final | exit 0, 0.00, 3.49, 0.00, 0.00 g, 3 T<n> lines |
0.00, 2.00, 2.02, 0.00 g, 28 T<n> lines |
| 2.4.1-alpha | 0xC0000005 crash |
0.00, 2.00, 2.02, 0.00 g, 28 T<n> lines, no crash |
So the alpha crash looks like the same root cause, just failing harder before the empty tool change was guarded.
I now write the key in our pipeline before calling the CLI (padding a short list with its first value, or "100"). Multi-colour thermoform plates (3 and 4 filaments) also slice with the tower and keep their colours on 2.4.1 final. Nothing printed yet. I'll leave the issue open until #1139 lands in a release.