Skip to content

[WIP] STEP import: a vertex at the end of an edge off its face covers its gap from the face (tangency-labs/solidcore#3508) - #25648

Draft
MarkusReichart wants to merge 9 commits into
tangency-labs:mainfrom
MarkusReichart:fix/sc3508-vertex-tolerances
Draft

MarkusReichart wants to merge 9 commits into
tangency-labs:mainfrom
MarkusReichart:fix/sc3508-vertex-tolerances

Conversation

@MarkusReichart

@MarkusReichart MarkusReichart commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Part of tangency-labs/solidcore#3508.
Fixes #17705.

Change

SolidCraft's STEP reader gives a vertex at the end of an edge that lies off a face's surface the edge's tolerance (three times the edge's gap, enough for the edge's own check). SMLib's record check holds a vertex's gap from each face to a quarter of the vertex's record tolerance, so those vertices fail SmBrep tests #1 and #3 (Vertex/Face Bad Gap) on four of the NIST CTC files in the issue. This PR makes each vertex cover its gaps at the ends of the edge uses it bounds, as the check measures them, on the finished record.

Draft: the failing test is the first commit; the fix follows. The same cause failed the 100 x 3 rounded cup of #17705 as it read back from STEP (tests #1 and #3); it now passes.

Changes a default: no

Test change: vertices_shared_by_raised_boundary_edges_hold_the_larger_tolerance held each patch corner to at most 1.01 times three times its edges' larger gap; the corner at (10, 10, 6) lies 7.5e-5 mm off the patch itself and the record check holds a vertex's gap from a face to a quarter of its record tolerance, so 2.25e-4 mm left it failing (5.6e-5 < 7.5e-5); the test now asks each corner for at least its edges' cover, at most 1.01 times the larger of that and 6 times its own gap, and more than 4 times its own gap.
Test change: step_export_keeps_its_bytes_and_reads_back (crates/kernel) pins three digests that move: in each export only line #8, the uncertainty, changes (the widest tolerance, now a covered vertex), diffed against the same import with main's reader; cylinder_rim_off_its_wall.step now imports without the Bad Gap warning it had.
Test change: rounded_shell_planar_roles_are_exact_distinct_and_transformable (crates/kernel) expected the 100 x 3 cup to fail SMLib's check as it reads back (#17705); that failure was these vertex tolerances, so it now expects both cups to pass, as each passes when exported.

Scope

Units: none (solidcore-step is not a goldens unit)
In scope: the STEP reader's vertex tolerances at the ends of edge uses (`cover_use_ends` in solidcore-step `assembly.rs`, called from `Assembly::finish_as_given`); a vertex's gap from a face that its edge's own gap from the surface explains is covered at the vertex's check factor
Expected edits: solidcore/crates/solidcore-step/src/assembly.rs, solidcore/crates/solidcore-step/src/topology_tests.rs
Evidence: new test a_vertex_on_an_edge_off_its_face_covers_its_gap_from_the_face (fails on main); the issue's five NIST files read and checked at CheckLevel::All before and after
Related PRs / dependencies: none open change vertex_cover or raise_vertex; #24817 (edge tolerance against the proved pcurve gap) is a neighbour in raise_edges and is not touched here
Available follow-ups: nist_ftc_11's Edge/Vertex gaps (vertices 0.0025 to 0.00375 mm off their curves, the file states 0.005 mm) are the vertex's own gap past a quarter of the stated tolerance, which #22579's rule keeps as a gap; not changed here
Status / blockers / next step: test committed; fix, small gate, review, full gate

Co-written and tested with Claude Code (AI)

…cy-labs/solidcore#3508)

A 10 mm cube whose top PLANE is written 1e-3 (1e-2) mm above its four top
edges, in a file stating 1e-5 (1e-4) mm. The reader covers each top edge's
gap from the plane with three times it and gives the edge's vertices that
tolerance; the record check holds a vertex's gap from each face to a quarter
of its record tolerance, so the four top corners fail SmBrep tests tangency-labs#1 and tangency-labs#3
(Vertex/Face), as the NIST CTC files do. Fails on main.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor
Pre-merge checks: Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Existing Defaults Unchanged Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or task execution failures.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added the area:kernel B-rep kernel, booleans, blends, STEP/IGES label Dec 2, 2026
MarkusReichart and others added 8 commits December 2, 2026 23:09
… the check measures them (tangency-labs/solidcore#3508)

What was wrong: the STEP reader covers an edge's gap from a face's surface
with three times it (`Assembly::cover_edge`, `SURFACE_GAP_MARGIN`), since the
record check holds an edge's gap to its zone, half the record tolerance. The
edge's end vertices took that tolerance ("a vertex's tolerance covers every
edge that meets it"), or kept the file's tolerance where the edge needed no
raise. A vertex on the end of such an edge lies off the face by the edge's gap
there, and the check holds a vertex's gap from each face to half its zone, a
quarter of its record tolerance (`CHECKED_GAP_FACTOR`, SmBrep tests tangency-labs#1 and tangency-labs#3
in `validate_and_update`). So the vertex failed by up to a third: on the NIST
CTC files every failing vertex lies within 3e-13 mm of its curve's end, its
gap from the face is its edge's (0.0347, 0.0460 and 0.1151 mm), and its record
tolerance is 2.7 to 3.4 times that gap.

Fix: on the finished record (`cover_use_ends`, called from
`Assembly::finish_as_given` before the record is validated), each vertex's
tolerance covers its gaps at the ends of the edge uses it bounds: from its
edge's curve end, as `vertex_cover` covers it up to the stated tolerance, and
from the face's surface at the end of the use's pcurve (where the check's solve
for the vertex's point on the face starts, and the point it measures to on the
CTC files; a projection onto the surface found a nearer point on
nist_ctc_02_asme1_ap203 and left its vertex failing), covered up to the stated
tolerance or up to what the edge's own gap from the surface at that end asks
of a vertex (`CHECKED_GAP_FACTOR` x `VERTEX_GAP_MARGIN` x it), where that is
more: the edge's tolerance covers that gap whatever the file states. A vertex
off its curve by its own gap is covered as before (tangency-labs#22579's rule), so the
hair-step file's corner past a quarter of the stated tolerance still fails the
check. Run on the finished record, so the reader's own decisions keep the
reach they were made with.

Confirmed by the new test and by reading the issue's NIST files with the app's
import trims and every UpstreamFixes flag on: the four CTC files' Bad Gap
tests go, nist_ftc_11's remain (its vertices are 0.0025 to 0.00375 mm off
their own curves, the file states 0.005 mm).

Co-Authored-By: Claude Code <noreply@anthropic.com>
…ver leaves alone (tangency-labs/solidcore#3508)

The cube's test now also checks its counts, the bottom corners (on all
their faces) keeping the file's tolerance, the top corners' cover at most
6 times the edge's end gap, and the body's note. A new case reads a
cylinder whose top PLANE lies 1e-3 mm above its top circle: a closed edge on
the cylinder's NURBS form, its vertex on the seam the side uses twice.

Co-Authored-By: Claude Code <noreply@anthropic.com>
… clear of its neighbours (tangency-labs/solidcore#3508)

Review of the cover at the ends of edge uses:
- A vertex is raised only below MAX_TOLERANCE and VERTEX_GROWTH_RATIO
  (2000) times the body's tolerance, the ratio the kernel's own growth stays
  under (GROWTH_PAST_RATIO x LARGE_SMALL_SIZE_RATIO in validate_and_update)
  and past which Test tangency-labs#82 refuses a vertex whatever its clearance; past it
  the vertex keeps its tolerance and the check names the gap, as before.
- A vertex is raised only where its zone (half the cover) stays short of
  every vertex it shares an edge with, so its ball reaches none of them
  (validity rule 7).
- The pass runs after the record is validated and adds no refusal: a curve,
  pcurve or surface that does not evaluate is the check's to name. Each
  edge's curve is made ready once.
- The body notes how many vertices it raised.

Co-Authored-By: Claude Code <noreply@anthropic.com>
…check (tangency-labs#17705)

Its read-back failed SmBrep tests tangency-labs#1 and tangency-labs#3 (Vertex/Face Bad Gap): the STEP
reader gave the vertices at the ends of its edges that lie off their faces
the edges' tolerance, a quarter of which is less than the gap the check
measures. The reader now covers those gaps (tangency-labs/solidcore#3508),
so the test asks both cups to read back passing the check, as each passes it
when exported.

Co-Authored-By: Claude Code <noreply@anthropic.com>
…rtex's check factor (tangency-labs/solidcore#3508)

vertices_shared_by_raised_boundary_edges_hold_the_larger_tolerance held each
corner of the raised patch to at most 1.01 times three times its edges' larger
gap. The corner at (10, 10, 6) lies 7.5e-5 mm off the patch itself (its corner
control point stands that far above it), and the record check holds a
vertex's gap from a face to a quarter of its record tolerance: 2.25e-4 mm
leaves it 5.6e-5 mm, under the gap. The reader now covers it with 6 times the
gap, 4.5e-4 mm (CHECKED_GAP_FACTOR x VERTEX_GAP_MARGIN); the test asks each
corner for the larger of its edges' cover and its own.

Co-Authored-By: Claude Code <noreply@anthropic.com>
…olidcore#3508)

The body's notes become the app's import warnings: with the note, two of the
app's import tests that expect no warning got one (the nearly round
spindle-torus pin, and the rounded cup of tangency-labs#17705). The edges whose gaps the
vertices cover are named in the note of raised edges already.

Co-Authored-By: Claude Code <noreply@anthropic.com>
… exact value (tangency-labs/solidcore#3508)

The 75 micrometre corner's gap from the patch, measured where its uses'
pcurves end, is 7.43e-5 mm, so its cover is 4.456e-4 mm, not exactly 6 x 7.5e-5.
The test now asks each corner for at least its edges' cover, at most 1.01
times the larger of that and 6 times its own gap, and more than 4 times its
own gap, as the record check holds it.

Co-Authored-By: Claude Code <noreply@anthropic.com>
…gency-labs/solidcore#3508)

A vertex at the end of an edge off a face now covers its gap from that face,
so the widest such vertex sets the file's uncertainty (line tangency-labs#8), and nothing
else in the export moves (diffed against the same import with main's reader):
rounded-cube-conic-corners 1.0311e-4 -> 1.2789e-4, cylinder_rim_off_its_wall
6.0e-4 -> 1.2e-3, tube_patch_shorter_than_its_face 0.015 -> 0.030.
cylinder_rim_off_its_wall now imports without the warning that SMLib's
check failed it (Vertex/Face Bad Gap, tests tangency-labs#1 and tangency-labs#3, three times each).
On Windows its fixed input record still exports the old bytes, which the
test checks, and gives the live digest.

Co-Authored-By: Claude Code <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:kernel B-rep kernel, booleans, blends, STEP/IGES

Projects

None yet

Development

Successfully merging this pull request may close these issues.

solidcore: a rounded shell exported to STEP and imported again fails SMLib's check (vertex/face gaps)

1 participant