Repository navigation
fix(re): the fitting face scorer tests every vertex and every triangle of a face, not a stride of at most 600 (#2114) - #2122
Merged
Conversation
…e of a face, not a stride of at most 600 (#2114)
11 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Nov 21, 2026
… smallest CRC-32 of their Tag, through one shared function, not an even stride by Tag (#2114) (#2123) ## Summary The frame fit (`frames_vs_ifc.py`) and the `fine` rows of `saved_meshes_vs_ifc.py` now choose their elements by the smallest CRC-32 of their Tag, as the body scorers have since #2119. Before, they took an even stride over the sorted Tags, which could move every chosen element when one was added or removed (#2114). The choice now lives in one shared function, `ifc_common.tag_sample`. `mesh_bodies_vs_ifc.class_sample` calls it, with the same result as before. On identical exports of 42 models (`ifc.sha256` and `diagnostics.json` unchanged: only the scorers changed), scored by this branch and by `main`: - `mesh_bodies_vs_ifc`'s output is identical on every model; - `frames_vs_ifc` moves on the 9 models with more than 200 common elements. Each now compares 200 elements, where the stride took 139 to 192. The fit lines move. The residual after Revit's site placement alone stays at median 0.0000 on all 35 models that print it, and its maximum moves on 5: up on the two concrete housing files (4.09 to 4.16 m) and the office permit (0.228 to 0.246 m), down on both timber office files (0.9075 to 0.2175 m). The maximum is still over a sample of 200; - the `fine` rows move on the 10 BIM4LCA files where a class has more than 300 paired elements. Each such class now scores 300, where the stride took 170 to 296. Every element added is within 0.001 ft, like those before it. Nothing outside the `fine` rows moves. ## Motivation Closes #2114. #2118 tested every vertex of a scored body, #2119 chose a large class's bodies by CRC-32, and #2122 tested every point of a fitting's faces. A search of `tools/re` for `[::` slices, first-N cuts, `_CAP`, `SAMPLE`, `LIMIT` and `MAX_` constants and stepped `range(` loops found these two strides as the last ones that choose what is scored. What else it found: - display limits (`LISTED`, `SHOW`, `LIST_LIMIT`), which shorten printed listings, not counts; - triangle caps, under which a larger body is counted and not read; - `wall_top_cover_vs_ifc.py`'s stations, set by a wall's length; - stepped `range(` loops in `mesh_bodies_vs_ifc.py`, which cut the work into chunks and reach every item. ## Changes - **`tools/re/ifc_common.py`:** `tag_sample(tags, cap)`, moved from `mesh_bodies_vs_ifc.class_sample` with its docstring generalised. - **`tools/re/mesh_bodies_vs_ifc.py`:** `class_sample` calls `tag_sample`; `saved_mesh_status_vs_ifc.py`'s import of it is unchanged. - **`tools/re/frames_vs_ifc.py`:** the 200 centres come from `tag_sample`; the docstring says how they are chosen. - **`tools/re/saved_meshes_vs_ifc.py`:** the `fine` rows' 300 per class come from `tag_sample`; both docstrings say so. ## Testing Unit tests are banned in this repository: do not add them. - [x] **Runs.** Measure on `main`'s code (`339ee7fc`), `nordic`, `r2025`, `fine_mesh=true`, `scorers="frames_vs_ifc saved_meshes_vs_ifc mesh_bodies_vs_ifc"`: [44869977616](https://github.com/DrunkOnJava/rvt-rs/actions/runs/44869977616) with this branch's scorers (`e1bd4b09`), [44869990078](https://github.com/DrunkOnJava/rvt-rs/actions/runs/44869990078) with `main`'s. No step on either side came from the score cache, whose key covers each scorer and every module it imports. - [x] **Identical inputs.** All 42 models have the same `ifc.sha256` on both runs. - [x] **Rows, written before either run was read.** - `mesh_bodies_vs_ifc`: identical on all 41 models it scores, `fine` rows included. - `frames_vs_ifc`: header lines and "elements tagged in both" identical everywhere; the whole output identical on models with 200 or fewer. | Model | Common | Compared | Fitted residual, median / max (m) | | --- | ---: | --- | --- | | Core Interior | 696 | 174 → 200 | 0.0000 / 0.0000, unchanged | | Housing, concrete, as built | 444 | 148 → 200 | 0.0451 / 4.0467 → 0.0539 / 4.1050 | | Housing, concrete, permit | 416 | 139 → 200 | 0.0472 / 4.0476 → 0.0531 / 4.1054 | | Housing, timber, as built | 504 | 168 → 200 | 0.0392 / 4.1722 → 0.0557 / 4.1555 | | Housing, timber, permit | 492 | 164 → 200 | 0.0407 / 4.1709 → 0.0563 / 4.1549 | | Office, as built | 957 | 192 → 200 | 0.0017 / 0.2058 → 0.0043 / 0.2016 | | Office, permit | 1,005 | 168 → 200 | 0.0049 / 0.2235 → 0.0060 / 0.2418 | | Office, timber, as built | 1,085 | 181 → 200 | 0.0088 / 0.8946 → 0.0037 / 0.2141 | | Office, timber, permit | 1,056 | 176 → 200 | 0.0084 / 0.8969 → 0.0038 / 0.2144 | - `saved_meshes_vs_ifc`: everything before the `fine` rows identical everywhere. Only classes over 300 move, and each to 300, every element within 0.001 ft: `IfcMember` on all 10 files (178 to 296 before), and `IfcColumn` on the two timber office files (172 and 170). "Sampled elements meshed" rises with them (for example 686 → 808 on the concrete housing as built). - [x] **Time.** The two runs ran on different runners, and the step times moved both ways (the `saved_meshes_vs_ifc` step on the office as built 316 → 476 s, on the timber office as built 459 → 308 s), so no cost is measured. `fine` rows print only with `fine_mesh=true`. - [x] Python only: `python3 -m py_compile` on the five files. No Rust changes. ## Audit-honesty checklist - [x] Docs reflect the change: the docstrings. Figures quoted in older reports record what the scorers measured then, and are left as they were. - [x] No changelog fragment: a measurement tool, nothing a user of the crate sees. - [x] No emojis, private paths or internal jargon. ## Legal and contribution hygiene - [x] Apache-2.0. - [x] No Autodesk proprietary content. - [x] No fixtures. ## Breaking changes None. `class_sample` keeps its name and its result. Review: rvtReview, the maintainer session, wrote this change. As rvtDevelop is not running, it re-reads the diff and approves the change itself on a green head (Griffin, 2026-11-12).
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.
Summary
tools/re/fitting_faces_vs_ifc.py, the scorer ofprobe_re311_fitting_faces, now tests every vertex, every centroid and every triangle of a face against Revit's body. It used to test a stride of at most 600 of each (#2114).The stride moved a face's columns when the face only gained triangles, and could leave its farthest vertex untested. The distance routine (
nearest) is unchanged; it is given every point.On the four RE1 models,
ifc.sha256,diagnostics.jsonand the probe's output are identical on both sides: only the scorer changed. Then:Motivation
Part of #2114, after #2118 (every vertex of a scored body in
mesh_bodies_vs_ifc) and #2119 (which bodies a large class scores).A search of
tools/refor[::slices,_CAPandSAMPLEconstants and steppedrange(loops found two more strides. Both choose elements by an even stride over sorted Tags, as #2119's did before it was fixed:frames_vs_ifc.py's frame fit, at most 200 elements, in Measure's default set;saved_meshes_vs_ifc.py'sfinerows, at most 300 per class, which print only withfine_mesh=true.The stepped
range(loops inmesh_bodies_vs_ifc.pycut the work into chunks and reach every item. The two strides come next, in their own pull request, so #2114 stays open.Changes
tools/re/fitting_faces_vs_ifc.py:Testing
Unit tests are banned in this repository: do not add them.
Run. Measure 44868163621: this branch (
158d752b) againstmain(339ee7fc),models="re1-*",scorers=none,probe=probe_re311_fitting_faces,probe_scorer=fitting_faces_vs_ifc. Each side runs its own scorer: the base side's winding counts are all 600 or under.Identical inputs.
ifc.sha256,diagnostics.jsonand the probe's output are identical on both sides, on all four models.Rows, written before the run was read. Every volume line, every line about Revit's vertices, and every face line of 600 triangles or fewer is identical. Each face's triangle count and area are identical. On the faces over 600 triangles, the farthest vertex, the triangles compared and those wound alike may rise but not fall. None falls.
"Wound alike" counts the triangles whose centroid lies within 0.03 ft of Revit's body. Those wound against the nearest Revit triangle go from 0 to 2, 0 to 2 and 3 to 6 on three closet bend faces.
Coverage. The probe dumps 12 faces over 600 triangles: 4 on RE1 Architecture and 8 on RE1 Plumbing. The other 4 are on two elements for which the scorer finds no Revit body (369628 and 53325), so it writes no line for them. No face has more than 600 distinct vertices (the most on any face is 562, on 53325), so the vertex half of the change is not exercised by these models.
Time. The scorer step takes 8.9 s against 8.4 s on RE1 Architecture, and 1.3 s against 1.2 s on RE1 Plumbing (
timings.log). The two sides ran as separate jobs, so the difference is not a measured cost. Measure runs this scorer only when a dispatch names it.Python only:
python3 -m py_compile. No Rust changes.Audit-honesty checklist
Legal and contribution hygiene
Breaking changes
None. The scorer's output lines keep their form.
Review: rvtReview, the maintainer session, wrote this change. As rvtDevelop is not running, it re-reads the diff and approves the change itself on a green head (Griffin, 2026-11-12).