Files
OneCAD/docs/step-import.md
T
bherbruckandClaude Opus 5.5 d224fde7d4 STEP: corpus check
solvecraft-cli step-corpus and cargo xtask step-corpus [DIR]: open every
Fusion oracle part.step and compare body count, volume and area (1e-3) and
face count with Fusion's measurements; docs/step-import.md (29/29 pass).
solvecraft-cli eval/run accept STEP files and --in FILE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AS5Tn3xieewUSg3uxrMVdL
2026-10-07 21:01:04 +00:00

48 lines
5.2 KiB
Markdown

# STEP import
SolveCraft reads STEP (ISO 10303-21; AP203, AP214 and AP242 geometry) with its own reader in `crates/kernel/src/step_in` (written from the public standards; no third-party STEP code). A STEP file becomes an **Import** base feature on the timeline: it holds the file's B-rep (the STEP text is kept in the design, so the design reopens without the file) and later features — fillets, holes, cuts sketched on its faces, shells — build on its bodies.
- **Open**: File → Open (`doc.open`) accepts `.step`/`.stp` in any case and starts a new design; `solvecraft part.step`; `solvecraft-cli eval part.step`, `solvecraft-cli run script.json --in part.step`; the MCP `open` tool.
- **Insert** into the current design: File → Insert STEP… or SOLID → INSERT (`FusionImportCommandFromToolbar {path}`).
- **Drag and drop** a STEP file on the window: inserted when the design has features, opened otherwise.
Read: manifold solid breps (with voids), faceted breps, shell-based surface models; planes, cylinders, cones, spheres, tori, B-spline and rational B-spline surfaces (with knots, Bézier, uniform, quasi-uniform), surfaces of revolution and linear extrusion, trimmed surfaces; lines, circles, ellipses, B-spline curves, polylines, trimmed/surface/seam curves; length and angle units (SI prefixes, conversion-based units such as inches); product names (body names come from the solid's name, else the product's); surface colours; assemblies (next-assembly-usage occurrences placed by item-defined transformations, and mapped items) — the product tree is kept in the feature for the components milestone. Files are untrusted: sizes, entity counts and nesting are capped and every kernel call is guarded. What cannot be read becomes a warning on the feature (a face left out gives an open body); not read yet: offset surfaces, pcurve-only edges.
## Fusion corpus
Generated by `cargo xtask step-corpus`. Each case is a part exported from Fusion as STEP (AP214; kept locally in `plan/fusion/oracle/`, never committed). SolveCraft opens `part.step` exactly as File → Open does (an Import base feature) and compares with Fusion's own measurements: body count, volume and area (relative tolerance 1e-3) and the number of faces read from the file.
**29 / 29 files pass.**
| Case | Result | Bodies | Volume mm³ (got / Fusion) | Area mm² (got / Fusion) | Faces (got / Fusion) | ms | Notes |
|---|---|---|---|---|---|---|---|
| 01-box | pass | Box | 24000.000 / 24000.000 | 5200.000 / 5200.000 | 6 / 6 | 2 | |
| 02-cylinder | pass | Cylinder | 35339.346 / 35342.917 | 6125.844 / 6126.106 | 3 / 3 | 7 | |
| 03-box-through-hole | pass | Box | 45738.489 / 45738.053 | 9327.795 / 9327.788 | 7 / 7 | 4 | |
| 04-revolve-vase | pass | Vase | 112487.028 / 112499.479 | 13156.053 / 13156.615 | 5 / 5 | 189 | |
| 05-taper-extrude | pass | Frustum | 61814.826 / 61814.826 | 9676.915 / 9676.915 | 6 / 6 | 1 | |
| 06-symmetric-extrude | pass | Block | 30000.000 / 30000.000 | 6200.000 / 6200.000 | 6 / 6 | 1 | |
| 07-fillet-all-edges | pass | Box | 23340.395 / 23340.849 | 4726.169 / 4726.265 | 26 / 26 | 18 | |
| 08-chamfer | pass | Box | 23730.667 / 23730.667 | 5029.352 / 5029.352 | 10 / 10 | 1 | |
| 09-shell | pass | Box | 13632.000 / 13632.000 | 13992.000 / 13992.000 | 11 / 11 | 1 | |
| 10-rect-pattern-holes | pass | Plate | 29803.869 / 29803.540 | 14652.467 / 14652.389 | 18 / 18 | 76 | |
| 11-circular-pattern-flange | pass | Flange | 66758.484 / 66758.844 | 19320.589 / 19320.795 | 10 / 10 | 50 | |
| 12-mirror-feature | pass | Base | 21392.261 / 21392.920 | 6530.917 / 6530.973 | 10 / 10 | 7 | |
| 13-combine-join | pass | A | 45547.074 / 45571.680 | 8633.463 / 8634.336 | 9 / 9 | 5 | |
| 14-combine-cut | pass | A | 42934.678 / 42931.417 | 9706.604 / 9706.858 | 7 / 7 | 61 | |
| 15-combine-intersect | pass | A | 54442.787 / 54454.273 | 7381.985 / 7382.743 | 7 / 7 | 134 | |
| 16-sweep | pass | Tube | 2584.167 / 2584.724 | 1779.580 / 1779.698 | 5 / 5 | 304 | |
| 17-loft | pass | Loft | 35124.785 / 35125.498 | 6496.433 / 6495.000 | 6 / 6 | 148 | |
| 18-hole-features | pass | Plate | 33890.986 / 33890.710 | 8568.685 / 8568.696 | 13 / 13 | 63 | |
| 19-l-bracket-constrained | pass | LBracket | 14720.000 / 14720.000 | 5472.000 / 5472.000 | 8 / 8 | 1 | |
| 20-slot-constrained | pass | Slot | 2965.374 / 2965.487 | 1774.635 / 1774.690 | 6 / 6 | 17 | |
| 21-draft | pass | Box | 54574.737 / 54574.737 | 8781.998 / 8781.998 | 6 / 6 | 1 | |
| 22-split-body | pass | Cyl, Cyl (1) | 75380.935 / 75398.224 | 12954.433 / 12955.175 | 6 / 6 | 31 | |
| 23-bracket-multifeature | pass | Bracket | 59331.560 / 59331.129 | 18290.761 / 18290.737 | 19 / 19 | 74 | |
| 24-user-parameters | pass | Block | 34822.124 / 34821.903 | 8114.167 / 8114.159 | 7 / 7 | 23 | |
| 25-sketch-triangle | pass | Triangle | 4032.155 / 4032.155 | 2274.099 / 2274.099 | 5 / 5 | 1 | |
| 26-sketch-belt | pass | Belt | 11326.051 / 11326.170 | 5637.346 / 5637.404 | 7 / 7 | 27 | |
| 27-sketch-trapezoid | pass | Trapezoid | 5342.311 / 5342.257 | 3066.959 / 3066.946 | 8 / 8 | 23 | |
| 28-blind-pocket-fillets | pass | Block | 84299.400 / 84299.249 | 16279.542 / 16279.572 | 23 / 23 | 72 | |
| 29-two-sided-and-partial-revolve | pass | Block | 25731.359 / 25731.307 | 6312.589 / 6312.602 | 12 / 12 | 14 | |