Proposal
Add a lightweight design tree for parametric OpenSCAD artifacts so users can inspect model structure and filter parameter controls by part, operation, or parameter group.
This is related to #62, but deliberately scopes the first pass to a source/metadata-driven design tree rather than mesh face or viewport selection.
Motivation
CADAM already exposes parametric controls, but generated models can become hard to understand once they include multiple modules, assemblies, operations, or groups of related dimensions. A design tree would make generated models easier to inspect and would create a foundation for more source-aware editing later.
First-pass behavior
-
Parse structured OpenSCAD comments such as:
// @cadam-node {"id":"base","kind":"part","name":"Base","params":["width","height"]}
module base() { ... }
-
Store parsed nodes on the parametric artifact when available.
-
Show a collapsible design-tree drawer inside the model viewer.
-
Reuse the same tree in the parameter panel.
-
Selecting a node filters linked parameter controls on desktop and mobile.
-
Show an empty state for artifacts without annotations.
-
Fall back to parsing annotated code when older artifacts have designTree: [] or no stored tree.
Proposed node shape
type DesignNodeKind =
| 'assembly'
| 'part'
| 'operation'
| 'sketch'
| 'parameter-group'
| 'import';
type DesignNode = {
id: string;
kind: DesignNodeKind;
name: string;
parentId?: string;
children?: string[];
parameterNames?: string[];
codeRange?: { start: number; end: number };
visible?: boolean;
locked?: boolean;
color?: string;
};
Out of scope for this first pass
- Clicking viewport geometry to select a node.
- Mapping compiled mesh triangles/faces back to source nodes.
- Editing, reordering, suppressing, or regenerating individual operations.
- Reconstructing a full CAD feature history from arbitrary OpenSCAD.
Follow-up possibilities
- Prompt/model updates so generated code emits
@cadam-node annotations consistently.
- Node-aware editing/regeneration.
- Visibility toggles once node-to-geometry mapping exists.
- Geometry picking for models compiled with source-node metadata.
Validation plan for an implementation PR
npm run typecheck
npm run lint
npm run build
Manual checks:
- Annotated artifact shows a tree button with a node count in the viewer.
- Opening the drawer shows nested tree rows.
- Selecting a node filters the parameter panel.
- Clearing selection restores all parameters.
- Unannotated artifact shows an empty state.
- Mobile preview drawer opens and node selection filters mobile controls.
- Existing rendering, orbit controls, download controls, and compile loading overlay continue to work.
Proposal
Add a lightweight design tree for parametric OpenSCAD artifacts so users can inspect model structure and filter parameter controls by part, operation, or parameter group.
This is related to #62, but deliberately scopes the first pass to a source/metadata-driven design tree rather than mesh face or viewport selection.
Motivation
CADAM already exposes parametric controls, but generated models can become hard to understand once they include multiple modules, assemblies, operations, or groups of related dimensions. A design tree would make generated models easier to inspect and would create a foundation for more source-aware editing later.
First-pass behavior
Parse structured OpenSCAD comments such as:
Store parsed nodes on the parametric artifact when available.
Show a collapsible design-tree drawer inside the model viewer.
Reuse the same tree in the parameter panel.
Selecting a node filters linked parameter controls on desktop and mobile.
Show an empty state for artifacts without annotations.
Fall back to parsing annotated code when older artifacts have
designTree: []or no stored tree.Proposed node shape
Out of scope for this first pass
Follow-up possibilities
@cadam-nodeannotations consistently.Validation plan for an implementation PR
npm run typechecknpm run lintnpm run buildManual checks: