feat(silo): assembly link extraction and BOM sync hook in Silo_Commit #73

Closed
opened 2026-02-09 00:15:20 +00:00 by forbes · 1 comment
Owner

Ref: docs/BOM_MERGE.md Phase 1, issue #68

Summary

Add a bom_sync module to the silo workbench that walks an Assembly container, extracts cross-document App::Link objects, counts quantities (individual links + ElementCount arrays), and resolves each linked document's SiloItemId to a part number via the Silo API.

Hook this into Silo_Commit.Activated() (silo_commands.py) as a post-commit step — after the _client._upload_file() call succeeds.

Requirements

  • New module: mods/silo/freecad/bom_sync.py

    • extract_bom_links(assembly_obj, level=1) — recursively walk assembly_obj.Group, collect cross-doc App::Link objects, skip in-document links (linked.Document == assembly_obj.Document)
    • _link_count(link_obj) — return ElementCount if > 0, else 1
    • BomEntry dataclass: doc_path, silo_uuid, part_number, name, quantity, level, children, consolidation_warning
    • resolve_part_numbers(entries, client) — resolve SiloItemId to part number via API, return (resolved, unresolved) tuple
    • Emit console warning for consolidation cases (multiple individual links to same source)
  • Hook in Silo_Commit.Activated():

    • After successful _client._upload_file(), check if doc contains an Assembly object
    • If yes, call extract_bom_links() and resolve_part_numbers()
    • Pass resolved entries to diff/merge (Phase 2)
    • Surface unresolved entries for registration (Phase 3)
  • UUID property name: SiloItemId (not SiloUUID — see set_silo_properties() in silo_commands.py)

  • API client: Use the existing global _client (SiloClient instance)

API Dependency

Requires GET /api/items/by-uuid/{uuid} or equivalent on the server (separate server-side issue).

Out of Scope

  • Diff/merge logic (Phase 2)
  • Part registration dialog (Phase 3)
  • Web UI (Phase 4)
## Phase 1a — Assembly Link Extraction + Silo_Commit Hook Ref: `docs/BOM_MERGE.md` Phase 1, issue #68 ### Summary Add a `bom_sync` module to the silo workbench that walks an Assembly container, extracts cross-document `App::Link` objects, counts quantities (individual links + `ElementCount` arrays), and resolves each linked document's `SiloItemId` to a part number via the Silo API. Hook this into `Silo_Commit.Activated()` (`silo_commands.py`) as a post-commit step — after the `_client._upload_file()` call succeeds. ### Requirements - **New module:** `mods/silo/freecad/bom_sync.py` - `extract_bom_links(assembly_obj, level=1)` — recursively walk `assembly_obj.Group`, collect cross-doc `App::Link` objects, skip in-document links (`linked.Document == assembly_obj.Document`) - `_link_count(link_obj)` — return `ElementCount` if > 0, else 1 - `BomEntry` dataclass: `doc_path`, `silo_uuid`, `part_number`, `name`, `quantity`, `level`, `children`, `consolidation_warning` - `resolve_part_numbers(entries, client)` — resolve `SiloItemId` to part number via API, return `(resolved, unresolved)` tuple - Emit console warning for consolidation cases (multiple individual links to same source) - **Hook in `Silo_Commit.Activated()`:** - After successful `_client._upload_file()`, check if `doc` contains an Assembly object - If yes, call `extract_bom_links()` and `resolve_part_numbers()` - Pass resolved entries to diff/merge (Phase 2) - Surface unresolved entries for registration (Phase 3) - **UUID property name:** `SiloItemId` (not `SiloUUID` — see `set_silo_properties()` in `silo_commands.py`) - **API client:** Use the existing global `_client` (`SiloClient` instance) ### API Dependency Requires `GET /api/items/by-uuid/{uuid}` or equivalent on the server (separate server-side issue). ### Out of Scope - Diff/merge logic (Phase 2) - Part registration dialog (Phase 3) - Web UI (Phase 4)
forbes added the enhancement label 2026-02-09 00:15:20 +00:00
Author
Owner

Implemented in mods/silo/freecad/bom_sync.py as part of #276. extract_bom_entries() handles assembly link extraction and BOM sync is hooked into the upload flow.

Implemented in `mods/silo/freecad/bom_sync.py` as part of #276. `extract_bom_entries()` handles assembly link extraction and BOM sync is hooked into the upload flow.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#73