mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-28 08:09:55 -05:00
# Description This PR redesigns `filament_id` across OrcaSlicer's profile library, so that one filament product now carries one consistent id everywhere it ships, instead of a hand-written value that unrelated materials routinely shared. Minting scripts and CI checks come with it so future profiles comply by construction: a new filament takes its id from the tool, and the checks reject a hand-written, duplicated or drifted one before it can merge. Unique, non-duplicated ids are a precondition for AMS-style spool syncing to be dependable — the id is what a printer matches a physical spool against, and while two products share one, the match is a coin toss. This PR lays that groundwork. A follow-up PR will publish an OrcaSlicer materials reference on the wiki, giving every system profile one place to point at. `filament_id` names one filament product, and it is what a device matches a physical spool against: Bambu AMS, Creality CFS, the Qidi box, Klipper and Snapmaker all resolve a tray to a preset by id alone, first hit wins. Those ids were written by hand, and on `main` 99 of them stand for 674 different products — `GFL99` alone covers 132, from Anycubic PLA to Bambu PLA Matte. Every consequence is silent: a spool resolves to whichever preset happens to load first, tray names and support-material flags are read off the wrong material, and the second preset holding a duplicated id disappears from the tray-edit dialog entirely. The id is now a hash of `(filament_vendor, filament_type, filament name)`, so one spool product carries one id in every bundle that ships it, two vendors shipping the same product converge on it without coordinating, and a collision cannot be authored by hand. Every ambiguity across 48 vendors is fixed rather than excused — no grandfather list and no per-vendor carve-out, Bambu's bundle included — and the resulting landscape is frozen in `scripts/filament_id_snapshot.json`, so a change to any filament's identity lands as a reviewable diff to one file. CI now runs the duplicate-subtype validation tree-wide instead of over Bambu only. Letting the id follow the product meant correcting the identities themselves. Generics that shipped under a vendor prefix now have one name and one id everywhere (`Blocks Generic PETG` is `Generic PETG @Blocks`), presets whose `filament_vendor` or `filament_type` contradicted the spool are fixed, and duplicate pairs are collapsed onto the better-configured survivor. Renames carry `renamed_from`, so existing projects and user presets keep resolving. Bambu's printers, its AMS and its cloud know only Bambu's own catalog ids, so those ids leave the profiles entirely. The Bambu bundle mints like every other vendor, and the printer agent swaps in the catalog value only where an id crosses to or from a Bambu printer — outbound MQTT and FTP, the AMS mapping sent with a job, the ids written into a 3mf the printer will read — mapping back on the way in, so status messages, SD-card prints and projects saved by an older Orca or by BambuStudio all still resolve. The correspondence is generated from BambuStudio's own shipped bundle by `scripts/update_bambu_filament_ids.py`; an id with no row is forwarded untouched, a missing or malformed map degrades to no translation rather than taking the app down, and an agent whose printers already speak Orca's ids translates nothing. Two device-side bugs this work surfaced are fixed here as well. The Orca Filament Library was missing from the AMS material and calibration dialogs, which treated a filament with no `compatible_printers` as compatible with nothing while the rest of the app treats it as compatible with everything; and Creality CFS sync on a K2-family stock 0.4 nozzle picked the wrong preset, an imprecise matcher that duplicate ids had been masking. `docs/HLSD/filament_id.md` is the authoring rule for all of this. `scripts/orca_id_tool.py` mints both `filament_id` and `setting_id`, replacing `assign_vendor_setting_ids.py`, and the local `check_profile` scripts gained per-vendor scoping so one vendor can be checked without a tree-wide run. `scripts/tests/` covers the tooling; `tests/slic3rutils/` covers the boundary translation and the CFS matcher. Ids change for most products and nothing forwards the old value, so a tray or a calibration record still holding one falls back to matching by filament type until the filament is selected once. Beyond the profile fixes above no print settings change, except that a few presets stop claiming printers a dedicated variant already covers. # Screenshots/Recordings/Graphs <!-- > Please attach relevant screenshots to showcase the UI changes. > Please attach images that can help explain the changes. --> ## Tests <!-- > Please describe the tests that you have conducted to verify the changes made in this PR. --> `scripts/check_profile.sh`, the local twin of the "Check profiles" CI job, with `scripts/check_profile.bat` as its Windows entry point, passes on this branch: the extra JSON check reports no errors and no warnings, system validation and the now tree-wide filament-subtype check load all 66 vendors cleanly, all 1013 printer presets slice, and custom-preset validation passes against every fixture archive from v1.9.0 to v2.4.2. The id tooling has 176 unit tests (`python -m unittest discover -s scripts/tests`). The C++ suites pass too — 332 in `tests/libslic3r` and 126 in `tests/slic3rutils`, the latter including the boundary-translation and Creality CFS matching cases added here. <!-- > A guide for users on how to download the artifacts from this PR. --> [How to Download Pull Requests Artifacts for Testing](https://www.orcaslicer.com/wiki/how_to_download_pr_artifacts)