Roadmap 0.13, Fixes

FX.759 PartCraft exact STEP export: the writer checks its own output, and more faces come out exact

  • Fix
  • Built · in the lab
  • PartCraft

Owner 2026-12-02: "yes to both" (the two decisions left open by FX.757).

1. Self-check. Before the exact STEP writer (step-exact.js) returns its text it compares, per written shell, the volume and surface area of the body with its points where the writer will put them against the mesh it was given. A body more than 0.1% off (CHECK_MAX = 1e-3) is demoted: first the exact regions at corners that moved, then every exact region of the body, so the worst case is a faceted body that matches the mesh. The result carries check: { bodies, demoted, worstVolume, worstArea, unresolved }.

2. Residual limit. The leftover distance allowed after a point is put on two surfaces goes from 1e-9 to 1e-8 of the part size (RES_MAX, used at the corner, edge-point and fitted-curve tests). A flat face tangent to a round one stalls near 2e-9, which kept those faces as facets.

Measured by the builder on the 156 production STEP files that write in time (before = before FX.757, after = now): volume off by more than 1%: 24 to 0; more than 0.1%: 43 to 3; area off by more than 1%: 4 to 0; more than 0.1%: 15 to 0; fully exact files 20 to 29. One file's volume slips from 7e-7 to 1e-5 (the known cost of 1e-8). At these settings the check demoted no body; run alone against the old 2% corner cap it demoted one body in each of the 44 files with a far-moved corner. Check time: 402 ms of 30,230 ms total write time (about 1.3%).

Tested (lead re-ran): node tools/partcraft-test/test-step-exact.mjs 202 passed, 0 failed (new: every part passes the check untouched; a slab with a forced bad corner is demoted and then matches the mesh to 5e-10, valid in the test reference kernel); test-step-roundtrip.mjs 85 passed; tools/shell-test/steel-files.mjs 255 passed.

Not covered: the check compares mesh against moved mesh, so it does not measure a round face's true surface against its facets, and it does not work out exact curved areas on its own; a part with voids was not tested through the check; the written production files were read back by our own STEP engine (all valid) but not by the reference kernel, which is not on that machine; the 268-solid assembly still takes more than 300 s to write; nothing in the app shows the check result yet. Backup tmp/step-exact.js.pre-selfcheck.

Update 2026-12-02 (owner: "can you fix these", the five limits above).

Built: (1) the check now measures what is written: area of each exact face and the body volume from the exact surfaces and their trim edges (cc-nurbs brep.measure), compared per face and per shell with the mesh, with an allowance worked out from the mesh's own chord error; a face that cannot be measured is counted in check.notMeasured (0 of 537,103 faces on the 156 files). (2) Voids: three new tests (ball void, box void, forced bad corner on a void shell: demoted, then matches the mesh to 1e-9). (3) PartCraft shows after export, only when it happened, "N bodies were written as flat facets: the exact versions did not match the part closely enough" (English only). (4) The 268-solid assembly: a key overflow above 2 million ids that mis-grouped shells is fixed, demotions are found per body; the file still cannot be written (about 1.4 million faces, more text than one string holds) and is now refused in 16 s with a plain "too many faces" message (MAX_FACES = 300000) instead of an error after 6 minutes. (5) The reference kernel is set up on the test machine in its own folder, so the written production files are checked there.

What the referee found: with the 1e-8 limit, 6 of the 147 files it was run on were not valid solids, against 2 at 1e-9. The lead set RES_MAX back to 1e-9 (step-exact.js, backup tmp/step-exact.js.pre-res-1e9); the 29 fully exact files go back to 20. Owner to confirm.

Tested at 1e-9 (lead re-ran, one at a time): test-step-exact.mjs 218 passed, 0 failed; test-step-roundtrip.mjs 85; browser-step-exact.mjs 19; steel-files.mjs 255.

Open: written files of five production parts (two of them at 1e-9 on the files checked; three more seen with the original writer) are not valid solids in the reference kernel and the cause is not found, the self-check does not catch them; the 268-solid assembly cannot be written; files over 20,000 faces were not run in the reference kernel at 1e-9; the "too many faces" message has no automated test; new strings English only.

Update 2026-12-02 late (owner: "keep 1e-9; find out why those files are invalid").

RES_MAX stays at 1e-9. The reference kernel was run on all 156 written production files at that setting: 150 valid, 5 not valid (two pairs of near-identical parts and one more), 1 not decided (a 91,085-face file, time limit reached).

Cause found (builder's diagnosis, not re-run by the lead): the mesh that comes out of the STEP engine has folded triangles (neighbouring triangles lying on top of each other, facing opposite ways) around features of 0.1 to 0.3 mm on large flat faces with holes. The mesh is still closed and its volume is right, so the earlier gates did not see it. The writer then builds a flat face whose outline touches itself, which the reference kernel rejects. Two repairs tried in the writer cost more exact faces than they saved and did not fix every file, so neither was kept. Kept: the writer reports the fold count (check.pleats); written files are unchanged.

Tested (lead re-ran): test-step-exact.mjs 218 passed, 0 failed; test-step-roundtrip.mjs 85; browser-step-exact.mjs 19.

Next: fix the folds in the STEP engine's mesher (started), rebuild the engine, re-package the add-on, re-run the reference kernel on all written files.

Update 2026-12-03: the folds are fixed in the STEP engine's mesher (engine commit 7614a0f; five causes, each with a made-from-scratch test part; lead re-ran the engine's mesh check: no folded and no flipped triangle on any of the 159 files at 1e-3 and at the add-on's tolerance, 22 engine tests pass, 0 lint warnings). Steel files add-on 0.2.2 carries the new engine (FX.752).

Result on the production files (builder's run; the lead counted the reference kernel's output: 157 of 157 valid): all 157 solid files now write, the 268-solid assembly included (12 s, 113,149 faces), and every written file is a valid solid in the reference kernel (before: 5 not valid, 1 not decided, 1 not writable). Written volume off by more than 1%: 0; more than 0.1%: 2; area more than 1%: 0; more than 0.1%: 1. The 268-solid file's build on the page went from about 28 s to about 3 s (measured outside the browser).

Left as is: the check now writes 21 bodies in 11 files as facets where corners between almost coincident planes move close to the cap (designed behaviour, a few exact faces lost); two identical parts that were fully exact are now partly facets (the 1e-9 limit at a flat face tangent to a round one); fully exact files 18 of 157.

Add a comment

Community comments

No comments yet

Add detail as we go: how you would use it, files or steps that show the problem, what other programs do. The team reads every comment.

Sign in or create a free account to add a comment.