Files
OneCAD/docs/step-import.md
T
bherbruckandClaude Opus 5.5 08cf223ced STEP export: unique ids, plain curves, right revolution senses; seams on split faces
Vendored truck-stepio (writer only): an intersection curve's second surface
was written at the first one's id (duplicate ids for every boolean edge),
and revolved surfaces lost their orientation (the modeling-surface sense was
always true; inverted or mirrored revolutions came out inside out). Export
now writes intersection edges as C1 cubic B-splines through exact points,
so files carry plain 3D curves and no redundant surfaces.

Vendored truck-meshalgo: hinted parameter searches that run off a B-spline's
domain are rejected or clamped (meshing their grid never finished).

STEP import: straight revolution profiles are bounded in the meridian plane
and stop at the axis; loops on revolutions start away from the axis; face
extents include edge end points. Edges between pieces of one split surface
draw as seams.

kernel::step_validate checks a STEP file (duplicate ids, dangling
references, dense numbering); the oracle replay now exports every rebuilt
part, validates it and re-imports it with no warnings and the same volume
(all 32 rebuildable cases pass).

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

9.1 KiB

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.

60 / 66 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 16
02-cylinder pass Cylinder 35339.346 / 35342.917 6125.844 / 6126.106 3 / 3 37
03-box-through-hole pass Box 45738.489 / 45738.053 9327.795 / 9327.788 7 / 7 28
04-revolve-vase pass Vase 112487.028 / 112499.479 13156.053 / 13156.615 5 / 5 371
05-taper-extrude pass Frustum 61814.826 / 61814.826 9676.915 / 9676.915 6 / 6 19
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.168 / 4726.265 26 / 26 63
08-chamfer pass Box 23730.667 / 23730.667 5029.352 / 5029.352 10 / 10 12
09-shell pass Box 13632.000 / 13632.000 13992.000 / 13992.000 11 / 11 8
10-rect-pattern-holes pass Plate 29803.869 / 29803.540 14652.467 / 14652.389 18 / 18 270
11-circular-pattern-flange pass Flange 66758.484 / 66758.844 19320.589 / 19320.795 10 / 10 90
12-mirror-feature pass Base 21392.261 / 21392.920 6530.917 / 6530.973 10 / 10 16
13-combine-join pass A 45547.074 / 45571.680 8633.463 / 8634.336 9 / 9 19
14-combine-cut pass A 42934.679 / 42931.417 9706.604 / 9706.858 7 / 7 95
15-combine-intersect pass A 54442.787 / 54454.273 7381.985 / 7382.743 7 / 7 223
16-sweep pass Tube 2584.167 / 2584.724 1779.580 / 1779.698 5 / 5 430
17-loft pass Loft 35124.785 / 35125.498 6496.433 / 6495.000 6 / 6 91
18-hole-features pass Plate 33890.986 / 33890.710 8568.685 / 8568.696 13 / 13 26
19-l-bracket-constrained pass LBracket 14720.000 / 14720.000 5472.000 / 5472.000 8 / 8 9
20-slot-constrained pass Slot 2965.374 / 2965.487 1774.635 / 1774.690 6 / 6 4
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 19
23-bracket-multifeature pass Bracket 59331.560 / 59331.129 18290.761 / 18290.737 19 / 19 37
24-user-parameters pass Block 34822.124 / 34821.903 8114.167 / 8114.159 7 / 7 4
25-sketch-triangle pass Triangle 4032.155 / 4032.155 2274.099 / 2274.099 5 / 5 18
26-sketch-belt pass Belt 11326.051 / 11326.170 5637.346 / 5637.404 7 / 7 24
27-sketch-trapezoid pass Trapezoid 5342.311 / 5342.257 3066.959 / 3066.946 8 / 8 9
28-blind-pocket-fillets pass Block 84299.400 / 84299.249 16279.542 / 16279.572 23 / 23 56
29-two-sided-and-partial-revolve pass Block 25731.359 / 25731.307 6312.589 / 6312.602 12 / 12 9
30-fillet-after-shell pass Box 21745.919 / 21745.876 14968.279 / 14968.332 27 / 27 82
31-fillet-l-all-edges pass L 14321.347 / 14321.626 5023.960 / 5024.045 38 / 38 68
32-boss-plate-fillets pass Part 33590.191 / 33590.350 9929.841 / 9929.864 10 / 10 620
33-fillet-tangent-chain pass Slot 8236.938 / 8237.122 2793.516 / 2793.569 14 / 14 202
34-chamfer-then-fillet pass Box 22892.369 / 22892.421 4753.674 / 4753.688 18 / 18 31
35-fillet-curved-curved FAIL Tee 63090.315 / 63171.443 10267.244 / 10269.348 6 / 6 1602
36-corner-blend-two-radii pass Box 57799.345 / 57800.240 8585.404 / 8585.524 18 / 18 88
37-pyramid-apex-blend FAIL Pyramid 15483.389 / 15465.575 3972.101 / 3914.581 18 / 18 786
38-coincident-cylinders pass A 15706.106 / 15707.963 3769.742 / 3769.911 3 / 3 27
39-tee-pipe FAIL Tee 24069.177 / 24096.237 16706.241 / 16710.048 7 / 7 64
40-box-sphere-torus pass A 36287.351 / 36287.433 10695.939 / 10696.165 10 / 10 764
41-tube-radial-holes FAIL Tube 20070.139 / 20243.981 14849.742 / 14873.773 22 / 22 428
42-overlapping-patterns pass Plate 38489.045 / 38487.064 21687.203 / 21686.603 43 / 43 469 solid 'Plate': imported as an open body (the shell is not closed)
43-cut-splits-body pass Bar, Bar (1) 28000.000 / 28000.000 7200.000 / 7200.000 12 / 12 19
44-shell-l-bracket pass L 8384.000 / 8384.000 8784.000 / 8784.000 15 / 15 17
45-shell-boss-plate pass Part 13676.925 / 13676.602 14156.500 / 14156.602 15 / 15 11
46-shell-two-open-faces pass Box 16044.000 / 16044.000 11398.000 / 11398.000 10 / 10 2
47-draft-curved-pocket pass Block 111388.144 / 111387.712 17700.329 / 17700.361 11 / 11 11
48-pulley pass Pulley 168507.117 / 168510.841 23718.181 / 23718.644 12 / 12 83
49-helical-sweep pass Spring 4736.230 / 4738.099 4766.821 / 4767.652 3 / 3 390482 solid 'Spring': face wrapping around a closed surface kept whole: split line does not reach the rings
50-sweep-tight-bend FAIL Bend 3822.321 / 3758.443 1708.995 / 2153.937 5 / 5 1797
51-loft-rect-circle-offset pass Loft 61143.729 / 61133.116 9415.804 / 9411.655 6 / 6 142
52-circular-pattern-fillet pass Hub 47206.223 / 47206.850 14142.022 / 14142.171 21 / 21 625
53-path-pattern pass Plate 35010.589 / 35010.398 16463.939 / 16463.894 13 / 13 87
54-mirror-body-fillets pass Bracket 22780.205 / 22780.089 6972.823 / 6972.832 12 / 12 38
55-tapped-hole-cosmetic pass Plate 17542.404 / 17542.314 4761.584 / 4761.596 8 / 8 13
56-holes-on-curved-face FAIL Cyl 77733.175 / 77942.388 10590.123 / 10593.139 7 / 7 93
57-hole-pattern-sketch-points pass Plate 36767.098 / 36766.712 11818.159 / 11818.153 24 / 24 165
58-phone-stand pass Stand 74559.445 / 74559.177 29148.741 / 29148.785 19 / 19 25
59-enclosure-base pass Enclosure 34309.026 / 34309.486 33795.404 / 33795.610 39 / 39 74
60-pipe-flange pass Flange 323660.116 / 323660.979 56984.492 / 56984.564 16 / 16 495
61-shaft-keyway pass Shaft 47493.351 / 47525.946 9675.779 / 9677.096 14 / 14 77
62-heat-sink pass HeatSink 43125.000 / 43125.000 45725.000 / 45725.000 66 / 66 41
63-hinge-knuckle pass Hinge 4781.312 / 4783.117 4109.841 / 4110.287 14 / 14 47
64-sketch-tangent-arc-chain pass Wave 4800.000 / 4800.000 3843.701 / 3843.712 9 / 9 47
65-sketch-gear-tooth pass Tooth 3987.829 / 3988.084 1945.416 / 1945.485 9 / 9 20
66-sketch-linkage pass Link 8045.431 / 8045.386 4308.168 / 4308.175 10 / 10 94