Files
cdsl-cad/json_to_cdsl/README.md
T
2026-08-21 11:13:18 +08:00

44 lines
1.7 KiB
Markdown

# JSON to CDSL
This program converts SolidWorks export JSON into parameterized Learning IR
(`*.cdsl.json`).
Conversion responsibilities:
- normalize SolidWorks JSON into an intermediate representation;
- classify sketches into named parameterized profiles;
- reuse equivalent profiles through semantic references;
- derive deterministic geometry through the sketch solver;
- remove avoidable floating-point noise;
- report unsupported or non-self-sufficient shapes.
The converter must not hide missing geometry behind an external context file
when producing a training-ready CDSL artifact.
## Evidence v2 batch converter
`evidence_v2_to_cdsl.py` converts the newer
`solidworks.cad_evidence.v2` extraction format into semantic CDSL v1.1. It
does not modify the current rebuild engine: features without a runtime
implementation are emitted with `execution_status: "deferred"` instead.
```bash
PYTHONPATH=backend/engine python json_to_cdsl/evidence_v2_to_cdsl.py \
/path/to/evidence_v2 \
--truth-dir /path/to/evidence_v2/truth \
--out json_to_cdsl/output \
--workers 1
```
For every `*.solidworks_evidence_v2.json` input it writes:
- `<part_id>.cdsl.json`: self-contained semantic CDSL in millimetres;
- `<part_id>.diagnostic.json`: source blockers, deferred features, optional
`inferred_from_step` selectors, semantic validation, and STEP-versus-source
bounding-box/volume/area/topology metrics;
- `manifest.json`: batch-level counts and paths.
The optional STEP directory is used only to infer a host face when exactly one
candidate is compatible with a Hole Wizard's captured locations. Ambiguous
geometry stays in `unresolved`; the converter never invents a selector.