Warn when a profile id clashes with a stock filament - #28
Conversation
The notes template asks for a unique 5 digit id but never says unique against what, so it is easy to pick one the built in filaments already use. Doing that hands your filament that slot and the built in one stops showing on the printer, which is easy to mistake for a sync failure. Nothing warned about it. Two profiles sharing an id went unnoticed as well. Check the ids after initData and before anything is written or uploaded, listing each clash and the stock filament it replaces, plus any id used twice. Ask before continuing when there is a terminal attached, and carry on with a warning when there is not, since the tool usually runs headless as a slicer post processing script and a prompt there would hang the slice. The check has to run before addProfiles because convertToPrinterFormat rewrites the presets in place. README lists the ids the built in filaments use, suggests 90000 and up, and notes that an RFID tag keeps pointing at the old id if you change it later. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Could you add a check to skip the warning if the id matches a stock profile id while also containing the same vendor and/or type as it's most likely to be intended an update to the stock profile, rather than a new profile accidentally sharing the id. So if it reads a profile with the block The name field could maybe be used in the check, but it would depend on the slicer profile being saved as the same name listed in the notes block. From previous issues reported some people leave in the "@creality k2 0.4..." when they save their changes. |
The notes template asks for a unique 5-digit id but doesn't say unique against what, so it's easy to pick one the built in filaments already use. When that happens your filament takes that slot and the built in one stops showing on the printer, which reads like a sync failure. Nothing warned about it. Two profiles sharing an id went unnoticed too.
Adds
tools/id-check.js, called frommain.jsafterinitData():It only prompts when there's a terminal attached. Run headless as a slicer post processing script there's no TTY, so it prints the warning and carries on rather than hanging the slice. Declining stops before anything is written or uploaded.
It runs before
addProfilesbecauseconvertToPrinterFormatrewrites the presets in place, so afterwards the original shape is gone.README now lists the ids the built in filaments use, suggests 90000 and up, and notes the RFID tag caveat.
Sits on top of #27 — without that fix, choosing to override still empties the database, so the warning would be describing behaviour that doesn't work yet.
Tested against a real OrcaSlicer install: clean ids pass silently, a simulated collision warns and prompts correctly, and declining aborts the sync.