8.8 KiB
name, description
| name | description |
|---|---|
| cad-router | Route natural-language or image-guided CAD generation and modification, plus uploaded STEP/STP reconstruction and modification, across text-to-cad and SimpleCADAPI. Use unified executable DesignIR 3.0 in semantic-feature mode for authored models and SurfaceIR mode for uploaded STEP reconstruction, without teacher geometry dependencies, with independent validation and CAD Viewer review. |
CAD Router
Choose a backend before modeling, keep its source as the editable authority, and normalize every result into one handoff contract. text-to-cad is the backend-neutral orchestrator and DesignIR owner, not a backend that must win by default. build123d and SimpleCADAPI 2.0.2 are equal-priority authoring backends selected from evidence. Uploaded STEP reconstruction is executed by SurfaceIR and independently checked by both the existing geometry validator and SimpleCADAPI B-Rep comparison.
Required workflow
-
Convert the natural-language or image-guided request into a brief: part type, dimensions, units, assembly relationships, editability, and validation targets. Every model uses DesignIR 3.0 plus STEP geometry. New text/image models use
fully_semantic_parametric; uploaded STEP reconstruction usessurface_parametric. A generated semantic model may include a compiled SurfaceIR snapshot and then useshybrid_semantic_surface_parametric, while its semantic layer remains authoritative. Never treat a teacher STEP or a single-case DesignIR as experience. Batch case JSON belongs to the separate CAD Experience plugin. Generation may consume only its promoted schema2.0generalized library. Never readcad-experience-plugin/parser/input,parser/output, or private case JSON during creation, modification, or reconstruction. -
Run the deterministic router from this skill directory:
python3 scripts/route.py "<request>" --explainAdd explicit signals when known:
--edit-source path/to/source,--existing-model, or--assembly. The router auto-discovers the workspacecad-experience-library/library.json, infers an experience family and feature roles from the request, and emits a backend-neutraldesign_plan. When promotedreconstruction_grammarrecords match, instantiate their symbolic parameter roles, datum roles, canonical stages, and validation roles in the new part's DesignIR; fill values from explicit user dimensions first and dimensionless distributions second. Use--experience-library,--experience-family, or repeated--experience-featureonly to override those defaults. For one uploaded STEP, execute the route rather than stopping after the routing decision:../../.venv/bin/python scripts/route.py \ "重建上传的 STEP,并返回可修改参数" \ --edit-source /absolute/path/to/upload.step \ --task-dir /absolute/path/to/task \ --executeThis command must finish extraction, source-independent reconstruction, geometry acceptance, parameter perturbation acceptance, and artifact publication. A route decision alone is not a completed reconstruction.
-
Follow the selected route unless a hard environmental constraint makes it unavailable. If overriding it, record the reason in the task manifest.
-
Load only the selected backend reference from
references/capabilities.mdand the matching installed Skill:build123d: use$cad; prefer it for custom brackets, housings, shafts, flanges, fixtures, source-level assemblies, and freeform/custom surface work.simplecadapi: use an installed SimpleCADAPI 2.0.2 Skill/runtime; prefer it when a standard factory exists, or when replayable ModelResult graphs, semantic lineage, physical units, tolerance chains, scene packages, or CAD translators materially improve the result. Its standard library includes gears, racks, ring and bevel gears, bearings, bolts, nuts, roller-chain sprockets, cycloidal parts, and reducer families.
-
When the route reports
requirement_refinementorvisual_repair, refine the brief, generate, execute, inspect multiple views, and repair no more than three visual mismatch rounds before asking the user. -
Generate into a task-owned directory and start CAD Viewer with that task directory as
--dir; do not expose the repository-wide fixture library for a task review. Write one DesignIR 3.0*.designir.jsonper part and treat it as the editable geometry contract; keepcad-task.jsonas the execution record. Readreferences/designir-3.0.mdfor both semantic authoring and uploaded STEP reconstruction.references/designir-2.0.mdis migration-only. Never change backend during an edit unless conversion is explicitly requested; modify the recorded authoritative layer. For a supplied STEP/STP, usescripts/route.py --execute; do not manually approximate the model when the executable adapter is available. The deterministic ingestion service extracts private teacher evidence into DesignIR 3.0. The independent rebuild subprocess receives the DesignIR and output path, never the STEP path. The acceptance stage alone receives both teacher and reconstruction. The DesignIR and generator must not import STEP, embed B-Rep or meshes, retain face references, or use the source model as a base feature. The acceptance agent alone compares the teacher and reconstructed STEP. Dense SurfaceIR may be stored losslessly in the DesignIR 3.0gzip+base64+jsonenvelope. CAD runtimes verify and decode it; LLM prompts receive only the semantic layer, edit interface, and validated parameter catalog, never the encoded geometry payload. Only expose parameters listed byparameters.json; every listed parameter has passed an isolated perturbation test. Other inferred names remain evidence, not a promised edit interface. The acceptance zone also runs the installed SimpleCADAPI 2.0.2 strict B-Rep comparator.brep_exactrequires both the bidirectional geometric-set check and the geometry-labelled incidence graph check. A geometry-equal but topology-different result is returned asreview_required, not silently described as an exact reconstruction. Failure or absence of the supplemental comparator must be recorded separately and must not be confused with a pass. -
Validate against the brief. Run STEP geometry inspection and snapshot review. For experience-informed generation, record which generalized methods were applied, including the reconstruction grammar ID and instantiated symbolic roles. Validate against the user's brief and held-out targets, never against parameters exposed from the same source case.
-
Write a
cad-task.jsonmanifest using the contract inreferences/backend-contract.md. Hand the STEP artifact to$cad-viewerand return its live link. -
Export URDF or MJCF only on explicit request. Run the deterministic DesignIR robot-description exporter lazily and return its portable ZIP with XML, STL visual/collision geometry, and export manifest. When authoritative assembly/joint/material evidence is absent, export one fixed
base_link; never invent joints, limits, actuators, mass, or inertia.
Routing rules
- Prefer an explicit user backend when it can produce the editable STEP contract.
- Preserve the backend of an explicitly supplied DesignIR or Python generator unless conversion is requested.
- Do not assign a permanent default backend. Score native-source continuity, factory coverage, semantic/replay needs, geometry vocabulary, assembly needs, and validation needs.
- Prefer SimpleCADAPI when a supported standard mechanical factory or its model graph, semantic topology, unit/tolerance, scene, or translator capabilities materially improve editability and verification.
- Prefer build123d for custom machined parts, source-driven assemblies, and freeform or surface-heavy work not covered by a SimpleCADAPI factory or tested operation vocabulary.
- For uploaded STEP, report SurfaceIR as the effective reconstruction engine. The selected authoring backend describes future semantic repair/edit work; it is not allowed to read the teacher STEP during reconstruction.
- Prefer source quality and future modification over the shortest first generation.
V1 boundaries
- Do not promise lossless conversion of feature history between backends.
- Do not claim engineering certification, tolerance analysis, FEA, CAM toolpaths, or manufacturability without separate checks.
References
- Read
references/capabilities.mdwhen comparing or invoking backends. - Read
references/backend-contract.mdbefore writing a task manifest or adding another backend. - Read
references/designir-3.0.mdfor semantic authoring, uploaded STEP reconstruction, and edits. - Read
references/designir-2.0.mdonly when migrating legacy artifacts. scripts/capabilities.jsonis the machine-readable V1 registry used byscripts/route.py.