feat: integrate SimpleCADAPI 2.0.2 CAD workflows

This commit is contained in:
Jerry
2026-08-03 11:17:05 +08:00
parent b5738e9109
commit c3a0f269b7
481 changed files with 110229 additions and 12826 deletions
@@ -23,6 +23,10 @@ Capture these fields when known:
Record:
- `selected_backend`: `build123d` or `simplecadapi`.
- `routing_policy.effective_execution_engine`: the actual engine. It is
`surfaceir` for an uploaded STEP even though `selected_backend` records the
preferred semantic authoring backend for later edits.
- `routing_policy.validation_engines`: validators required by the chosen mode.
- Origin project and optional executable adapter.
- `runner_skill`: installed Skill responsible for generation.
- Ranked backend scores and human-readable reasons.
@@ -81,6 +85,11 @@ distillation corpus. The task publishes the independent DesignIR, reconstructed
STEP, validated parameter catalog, geometry report, edit report, and
`cad-task.json`. The reconstruction subprocess receives no teacher STEP path;
only extraction and acceptance may read the explicit uploaded source.
The acceptance stage records both SurfaceIR geometry validation and the
SimpleCADAPI B-Rep comparator. A B-Rep report may be `passed`, `mismatch`, or
`unavailable`; only `passed` earns the `brep_exact` quality tier. Geometry
equality with a topology mismatch remains usable for review but is not an exact
reconstruction.
## Backend adapter requirements
@@ -1,8 +1,25 @@
# Backend capabilities
## build123d through CAD Skill
## Selection principle
Use as the default STEP-first backend.
There is no permanent default authoring backend. `text-to-cad` owns routing,
DesignIR, validation, repair, artifacts, and Viewer handoff. It does not receive
extra score simply for being the orchestrator.
The router scores:
1. continuity with an explicitly supplied editable source;
2. deterministic standard-factory coverage;
3. semantic graph, replay, units, tolerances, and translation requirements;
4. custom profile and surface vocabulary;
5. assembly and mechanism requirements;
6. validation requirements.
Uploaded STEP reconstruction is a separate mode: SurfaceIR is the effective
rebuild engine, while SimpleCADAPI B-Rep comparison supplements the independent
acceptance stage.
## build123d through CAD Skill
Best fit:
@@ -11,20 +28,36 @@ Best fit:
- Source-level assemblies, named datums, joints, imported components, measurements, alignment checks, and existing STEP inspection.
- STEP output compiled from executable semantic DesignIR 3.0.
Weak signals: a specialized mechanical family already implemented by SimpleCADAPI or a browser-only execution requirement.
Weak signals: a standard mechanical family already implemented by
SimpleCADAPI, or a primary requirement for replayable operation graphs, typed
semantic topology, unit checking, tolerance chains, or CAD translation.
## SimpleCADAPI
Use for its standard mechanical factories and replayable modeling graph.
Best fit:
Best fit in version 2.0.2:
- Spur, helical, and herringbone gears; internal ring gears; racks; cycloidal discs; ball bearings.
- Spur, helical, herringbone, ring, and straight bevel gears; racks; cycloidal
discs; ball bearings; bolts; nuts; and roller-chain sprockets.
- Planetary and cycloidal reducers, joint actuators, and mechanism-heavy assemblies.
- Parameter expressions, operation-graph JSON, replay, semantic tags, and topology queries.
- `@model` / `ModelResult`, parameter expressions, operation-graph JSON, replay,
scene packages, semantic tags, topology lineage, source mapping, and QL.
- Physical units, dimension checking, and manufacturing tolerance chains.
- FreeCAD, Fusion 360, and SolidWorks translation.
- STEP B-Rep inspection, strict target/candidate comparison, multi-view
diagnostics, and slice XOR diagnostics.
- Reusable mechanical product families whose formulas should become deterministic library functions.
Before invocation, inspect the installed package and Skill versions together. Do not mix the current single-`Solid` boolean API with older `*rsolidlist` documentation. If the installed runtime and docs disagree, stop that route and use build123d or repair the installation.
Weak signals: freeform or multi-rail surface construction outside the tested SDK
vocabulary, or an existing build123d source whose feature history must remain
authoritative.
Before invocation, inspect the installed package and Skill versions together.
Require version `2.0.2` or newer for the capabilities listed above. Do not mix
the current single-`Solid` boolean API with older `*rsolidlist` documentation.
If the installed runtime and docs disagree, stop that route and use build123d
or repair the installation.
## Router refinement and repair
@@ -113,6 +113,49 @@ The adapter loads only formally promoted experiences whose scope is
applied conditionally by the runtime; `cad-task.json` records both the available
method count and the exact method IDs used for the task.
## Compact single-file storage
A DesignIR remains one source-independent JSON file. For surface-parametric and
hybrid documents, the dense `surface_layer` may use the lossless
`gzip+base64+json` storage envelope:
```json
{
"surface_layer": {
"format": "surfaceir-3.0",
"encoding": "gzip+base64+json",
"uncompressed_bytes": 10286354,
"compressed_bytes": 2358852,
"sha256": "<digest>",
"data": "<base64>"
}
}
```
The runtime verifies the byte counts and SHA-256 digest before rebuilding.
Decoding restores the same SurfaceIR object; no coordinate, topology, pcurve,
tolerance, parameter binding, or edit information is discarded. Legacy
documents containing an expanded `surface_layer` remain supported.
Agents must read the ordinary top-level `semantic_layer`, `edit_interface`, and
validated `parameters.json`. They must not place the encoded `surface_layer.data`
string in an LLM prompt. Deterministic CAD runtimes alone decode that field.
## Lazy URDF and MJCF export
URDF and MJCF are derived artifacts, not additional DesignIR authorities.
Generate them only after an explicit download/export request. The deterministic
exporter rebuilds from DesignIR alone and packages:
- the `.urdf` or `.mjcf.xml` description;
- an STL mesh used for visual and collision geometry;
- `robot-export.json` with source hash, scale, reconstruction strategy,
structural assumptions, and dynamics status.
STEP-derived geometry without authoritative assembly, joint, or material
evidence exports as one fixed `base_link`. Do not infer articulated joints,
limits, actuators, density, mass, or inertia merely from disconnected solids.
## Parameter boundary
STEP does not contain authoritative feature names or modeling history. The