Appearance
Daedalus Product Structure Workflow
Scope
This note documents the minimal product-structure flow added on top of the existing drafting editor:
- Body merge command with selection continuity.
- Part editor support for attaching multiple bodies.
- Assembly editor support for adding multiple part instances.
- v3/v4 layout load coverage via fixture-based E2E tests.
Data Model (v4 cadDocument extras)
cadDocument in layout v4 carries the core drafting entities plus product-structure extras:
profiles: source profile references.bodies: generated bodies (CadBody).parts: body groups (CadPart).assemblies: part-instance groups (CadAssembly).- selection extras:
selectedBodyIdanalysisTargetBodyIdselectedPartIdselectedAssemblyId
These fields are normalized in normalizeLayoutData, persisted via snapshot payloads, and restored by restoreSnapshot/loadFromServer.
Body Merge Command
Command aliases:
BODYMERGEBMERGE
Supported input styles:
- explicit IDs:
BODYMERGE body-a,body-b - fallback to checkbox selection in the Body panel
- final fallback to currently selected body (must still resolve to 2+ valid IDs to execute)
Execution path:
- Parse/resolve target body IDs.
- Build merged body (
CadBody) with:- unioned
sourceProfileIds - inherited source drawing ID
- generated new body ID
- unioned
- Replace source bodies with merged body.
- Rewrite every part's
bodyIdsto replace removed body IDs with new merged ID. - Route post-merge selection through
resolveSelectionByCadRuleby intentionally setting a removed anchor ID before replacement.
The key point is selection continuity: after merge, the new body is selected by the same rule used for other CAD entity list mutations.
Part / Assembly Minimal Editing UI
Part: multi-body attach
- UI: body checkbox list under selected part editor.
- Action:
Add Selected Bodies to Part. - Behavior:
- collect checked IDs
- ignore missing IDs
- append uniquely to
part.bodyIds
Assembly: multi-part instance attach
- UI: part checkbox list under selected assembly editor.
- Action:
Add Selected Parts to Assembly. - Behavior:
- collect checked part IDs
- create one new
CadPartInstanceper selected part - append instances to target assembly
Selection Rules
resolveSelectionByCadRule is the single selection continuity rule for list-based CAD targets. It is now used for:
- profiles
- bodies (including merge)
- parts
- assemblies
Transient UI selections (bodyMergeSelectionIds, partBodySelectionIds, assemblyPartSelectionIds) are auto-pruned by watchers when underlying lists change.
E2E Coverage
Added fixtures:
frontend/e2e/fixtures/daedalus-layout-v3.jsonfrontend/e2e/fixtures/daedalus-layout-v4.json
Added test:
frontend/e2e/daedalus-load-layout-fixtures.spec.js
Cases:
- v3 fixture loads from mocked API and keeps product-structure counts empty.
- v4 fixture loads from mocked API and restores body/part/assembly counts and selected IDs.
Bridge additions used by test:
loadServerLayoutById(id)runWorkspace3DCommand(command)- richer
getSnapshot()payload for body/part/assembly counts and selected IDs.
Simplification Notes
- Removed duplicated
declare globalblock forwindow.__DAEDALUS_E2E__type declaration. - Kept behavior changes minimal and localized to the drafting integration hub (
D_Daedalus.vue). - Avoided introducing new stores/modules for this incremental step to reduce migration risk.
