Repository navigation
[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
Conversation
…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>
Contributor
Pre-merge checks:
|
… 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
SmBreptests #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_toleranceheld 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.stepnow 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
Co-written and tested with Claude Code (AI)