How jiangzmj/dia-cad works
DIA-CAD turns a STEP model and edit description into an edited CAD model: it prepares model views, predicts visual targets, structures the design intent, then iterates on CadQuery code and verifies the output. The README documents this stage order; sampled handlers show helper-model calls and the edit-harness handoff, while the execution skill exports STEP/STL. Other subsystem links reflect documented capabilities, but their internal call wiring is not fully sampled.
Main entry points: runtime.py Stage runtime · loop.py State-driven edit loop · artifacts.py Run artifacts · helper.py Multimodal helper
Components 23
Edit pipeline
- Pipeline entry
src/harness/pipeline/__main__.py - Stage runtime
src/harness/pipeline/runtime.py - Input preparation
src/harness/pipeline/inputs.py - Orientation and views
src/harness/pipeline/orient.py - Visual hypotheses
src/harness/pipeline/handlers.py - Structured intent
src/harness/pipeline/handlers.py - Feature probing
src/harness/pipeline/feature_probe.py - Harness stage handler
src/harness/pipeline/edit_harness/handler.py - Result verification
src/harness/pipeline/target_qc.py
CAD edit harness
- State-driven edit loop
src/harness/pipeline/edit_harness/loop.py - Edit proposals
src/harness/pipeline/edit_harness/propose.py - CadQuery execution
src/harness/pipeline/skills/cadquery_exec.py - Geometric validation
src/harness/pipeline/edit_harness/validate.py
Model runtime
- Multimodal helper
src/harness/agents/helper.py - Provider router
src/harness/providers/router.py - OAuth provider
src/harness/providers/chatgpt_oauth.py - Compatible provider
src/harness/providers/openai_compat.py
Artifacts and state
- Run artifacts
src/harness/pipeline/artifacts.py - Run manifest
src/harness/pipeline/manifest.py
Other components
- CAD user
- STEP and description
- Model API
- Verified STEP and STL
Connections 30
- CAD user → Pipeline entry: starts run
- STEP and description → Pipeline entry: supplies case
- Pipeline entry → Stage runtime: starts stages
- Stage runtime → Input preparation: prepares input
- Stage runtime → Orientation and views: runs stage
- Stage runtime → Visual hypotheses: runs stage
- Stage runtime → Structured intent: runs stage
- Stage runtime → Feature probing: runs probe
- Stage runtime → Harness stage handler: runs stage
- Stage runtime → Result verification: runs verification
- Input preparation → Run artifacts: copies inputs
- Orientation and views → Run artifacts: writes views
- Visual hypotheses → Run artifacts: writes target renders
- Structured intent → Run artifacts: writes edit data
- Stage runtime → Run manifest: updates run state
- Harness stage handler → State-driven edit loop: invokes loop
- State-driven edit loop → Edit proposals: requests edits
- State-driven edit loop → CadQuery execution: runs generated code
- State-driven edit loop → Geometric validation: checks iteration
- State-driven edit loop → Run artifacts: records history
- CadQuery execution → Verified STEP and STL: exports STEP and STL
- Result verification → Verified STEP and STL: verifies output
- Visual hypotheses → Multimodal helper: requests visual analysis
- Structured intent → Multimodal helper: requests structuring
- Result verification → Multimodal helper: requests result review
- Multimodal helper → Provider router: sends chat
- Provider router → OAuth provider: selects provider
- Provider router → Compatible provider: selects provider
- OAuth provider → Model API: calls model
- Compatible provider → Model API: calls model