mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-09 10:16:50 +00:00
Translate filament ids at the printer boundary
Orca content-addresses every system filament, Bambu's included, but a printer, its AMS and its vendor's cloud know only that vendor's own catalog ids. The printer agent now translates between the two: outbound MQTT and FTP traffic, the AMS mapping sent with a print job, and the ids written into a 3mf bound for the printer all leave in the printer's own ids, while status messages, loaded projects and SD-card prints arrive in Orca's. An id with no mapping passes through unchanged, and an agent whose printers already speak Orca's ids translates nothing at all. Bambu's map is generated from BambuStudio's own shipped bundle; a missing or unreadable file leaves every lookup an identity rather than taking the app down. The profile check validates the map's shape, and profile CI now runs on the paths that can change it. docs/HLSD/filament_id.md records the places the map deliberately does not reach.
This commit is contained in:
@@ -729,6 +729,8 @@ def check_filament_ids(profiles_dir=PROFILES_DIR, snapshot_path=SNAPSHOT_PATH,
|
||||
# -- 8. Bambu catalog map --------------------------------------------------
|
||||
try:
|
||||
bambu_map = load_json(map_path)
|
||||
if not isinstance(bambu_map, dict):
|
||||
raise ValueError("top level is not a JSON object")
|
||||
except (OSError, ValueError) as e:
|
||||
print_error(f"Bambu catalog map {map_path} does not parse ({e}); {BAMBU_MAP_HINT}")
|
||||
errors += 1
|
||||
@@ -737,7 +739,15 @@ def check_filament_ids(profiles_dir=PROFILES_DIR, snapshot_path=SNAPSHOT_PATH,
|
||||
if not bambu_map.get(key):
|
||||
print_error(f'Bambu catalog map {map_path} is missing "{key}"; {BAMBU_MAP_HINT}')
|
||||
errors += 1
|
||||
rows = bambu_map.get("filaments", {})
|
||||
rows = bambu_map.get("filaments")
|
||||
# An empty or absent section is not a well-formed map: it makes every runtime
|
||||
# translation silently degrade to identity (BBLPrinterAgent logs nothing for it),
|
||||
# and it is what a regeneration against the wrong --bambustudio-dir writes.
|
||||
if not isinstance(rows, dict) or not rows:
|
||||
print_error(f'Bambu catalog map {map_path} declares no "filaments" rows; '
|
||||
f"{BAMBU_MAP_HINT}")
|
||||
errors += 1
|
||||
rows = {}
|
||||
bambu_id_owners = {}
|
||||
for fid, row in sorted(rows.items()):
|
||||
if not OF_ID_RE.match(fid):
|
||||
@@ -745,7 +755,12 @@ def check_filament_ids(profiles_dir=PROFILES_DIR, snapshot_path=SNAPSHOT_PATH,
|
||||
f"{BAMBU_MAP_HINT}")
|
||||
errors += 1
|
||||
bambu_id = row.get("bambu_id")
|
||||
if bambu_id in bambu_id_owners:
|
||||
if not bambu_id:
|
||||
# An empty id would map the empty string to a real filament at runtime.
|
||||
print_error(f'Bambu catalog map row "{fid}" declares no "bambu_id"; '
|
||||
f"{BAMBU_MAP_HINT}")
|
||||
errors += 1
|
||||
elif bambu_id in bambu_id_owners:
|
||||
print_error(
|
||||
f'Bambu catalog map: Bambu id "{bambu_id}" is mapped by both '
|
||||
f'"{bambu_id_owners[bambu_id]}" and "{fid}"; {BAMBU_MAP_HINT}')
|
||||
|
||||
Reference in New Issue
Block a user