Skip to content

fix(re): the body scorers score a large class's 300 bodies with the smallest CRC-32 of their Tag, not an even stride by Tag (#2114) - #2119

Merged
DrunkOnJava merged 2 commits into
mainfrom
fix/2114-body-selection
Nov 21, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
fix/2114-body-selection

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

The body scorers choose which bodies of a large class they score by the smallest CRC-32 of each body's Tag, in place of an even stride by Tag (#2114, its second part).

A class with more than 300 bodies drawn from saved meshes was scored on every stepth by Tag, where step = ceil(n / 300). A change that adds or removes one body shifts that stride, and every chosen body that sorts after it can move in or out. It also scored as few as about half a class: 170 of the timber office's 339 columns at permit. Now each such class scores the 300 whose Tag has the smallest CRC-32 (mesh_bodies_vs_ifc.class_sample). A body added or removed moves at most one other in or out, and the choice is the same in every process.

On the BIM4LCA office as built, the two saved-mesh mullions the #2085 candidate adds (10,001 to 10,003) make 145 of the stride's 295 chosen mullions leave and 145 others enter. The CRC-32 rule keeps all 300.

Motivation

#2114: rows that decide landings were exposed to the class stride as well as the vertex stride #2118 removed. On the #2085 candidate's Measure, mullion rows on the timber office moved (197 to 199, 49 to 48) only because one mullion more was drawn.

Changes

  • tools/re/mesh_bodies_vs_ifc.py:
    • class_sample chooses a class's scored bodies.
    • main uses it, and prints "N bodies, 300 scored by the smallest CRC-32 of their Tag" for a class it cuts.
    • The docstrings say so.
  • tools/re/saved_mesh_status_vs_ifc.py: uses the same class_sample in place of its own copy of the stride. Its docstring's "every tested vertex" becomes "every vertex", left over from fix(re): the mesh body scorer tests every distinct vertex of a scored body, not a stride of at most 400 (#2114) #2118.
  • tools/ci/scrub-holdout-results.sh: the held-out scrub keeps the new line in place of the stride's.

Not in this change: fitting_faces_vs_ifc.py's stride of 600 vertices per face, which #2114 still holds open.

A limit this keeps: a body newly drawn in a class over 300 is scored only if its Tag's CRC-32 is among the 300 smallest, about 3 per cent of the offices' mullions. So a class row still cannot judge newly drawn bodies in such a class; those are read on their own.

Testing

Unit tests are banned in this repository: do not add them.

  • Runs. Measure 44847401520 (scorers from this branch) and 44847404007 (scorers from main), both on code da889e7c, with nordic, r2025 and scorers=mesh_bodies_vs_ifc.

  • What changes. 31 of the 41 outputs are byte-identical: every file with no class over 300 bodies. The other 10 are the BIM4LCA building files:

    Class Files Scored with the stride Scored now
    IfcMember housing, concrete (as built, permit) 178 300
    IfcMember housing, terrain (concrete, timber) 207 300
    IfcMember housing, timber (as built, permit) 226 300
    IfcMember office, concrete (as built, permit) 295 300
    IfcMember office, timber (as built, permit) 292 300
    IfcColumn office, timber (as built; permit) 172; 170 300

    On both sides, every scored body of these rows and of the type rows under them is within each column (volume, 0.01 ft, 0.001 ft, ref on ours). The fifteen farthest bodies listed are unchanged, and the total scored moves with n.

  • Stability on real Tags. Read from the Family instances that stay boxes: expose symbol geometry and instance placement #2085 candidate's Measure (44842134746): the two exports of the BIM4LCA office as built, whose saved-mesh mullions go from 10,001 to 10,003. With the stride, 145 of its 295 chosen leave and 145 others enter; this rule keeps all 300. On the timber office at permit, one mullion more (7,871 to 7,872) makes 112 of the stride's 292 leave and 112 others enter, the moved rows of the Motivation; this rule keeps all 300.

  • Time. The office as built's step took 257 s against 186 s with the stride, and the timber office as built's 174 s against 179 s with 136 more bodies scored. One run each, scorer alone, not under full load.

  • Checks.

    • python3 -m py_compile on both scorers, and bash -n on the scrub script.
    • The new line, piped through the scrub's pattern, is kept.
    • No CLASS_CAP is left in saved_mesh_status_vs_ifc.py, and nothing else in the repository reads the stride's line.
    • All 41 outputs end in exit 0.
    • The per-type rows under each moved class (157 read) are full on both sides too.
  • Not run: saved_mesh_status_vs_ifc.py, which Measure and CI do not run.

Audit-honesty checklist

  • The docstrings say how bodies are chosen. Older reports quoting stride-chosen counts record what was measured then.
  • No changelog fragment: a measurement tool, nothing a user of the crate sees.
  • No emojis, private paths or internal jargon.

Legal and contribution hygiene

  • Apache-2.0. No Autodesk proprietary content. No fixtures.

Breaking changes

None. The stride's line "N bodies, every Kth scored" is replaced, and its one reader, the held-out scrub, follows.

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).

…allest CRC-32 of their Tag, so a body added or removed moves at most one other, not nearly every one as the even stride did (#2114)
…, every chosen body after the one added, not nearly every one (#2114)
@DrunkOnJava
DrunkOnJava merged commit 0d0fc92 into main Nov 21, 2026
36 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/2114-body-selection branch November 21, 2026 01:30
DrunkOnJava added a commit that referenced this pull request Nov 21, 2026
…e of a face, not a stride of at most 600 (#2114) (#2122)

## Summary

`tools/re/fitting_faces_vs_ifc.py`, the scorer of
`probe_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.json` and the probe's
output are identical on both sides: only the scorer changed. Then:
- 8 face lines move, on RE1 Architecture and RE1 Plumbing: every face
over 600 triangles on an element Revit's export has, and no other line;
- on those faces every second triangle and centroid was tested, and now
all are: the winding counts only grow, and 3 faces show 2 or 3 more
triangles wound against Revit's;
- the farthest vertex is identical on every face, as it must be: no face
has more than 600 distinct vertices (the most on a scored face is 508),
so the vertex stride never applied here.

## 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/re` for `[::` slices, `_CAP` and `SAMPLE` constants
and stepped `range(` 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`'s `fine` rows, at most 300 per class, which
print only with `fine_mesh=true`.

The stepped `range(` loops in `mesh_bodies_vs_ifc.py` cut 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`:**
- each face's vertices, centroids and triangles are tested whole; the
three strides of at most 600 are gone;
  - the docstring says every vertex and triangle is tested, and why.

## Testing

Unit tests are banned in this repository: do not add them.

- [x] **Run.** Measure
[44868163621](https://github.com/DrunkOnJava/rvt-rs/actions/runs/44868163621):
this branch (`158d752b`) against `main` (`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.
- [x] **Identical inputs.** `ifc.sha256`, `diagnostics.json` and the
probe's output are identical on both sides, on all four models.
- [x] **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.

  | Element | Face (triangles) | Farthest vertex, ft | Wound alike |
  | --- | --- | --- | --- |
| Shower head 369643 | 7.40 (616) | 0.00446 | 308 of 308 → 616 of 616 |
| Shower head 369643 | 7.41 (924) | 0.00792 | 462 of 462 → 924 of 924 |
| Closet bend 444676 | 7.29 (960) | 0.03453 | 422 of 422 → 843 of 845 |
| Closet bend 444676 | 7.30 (960) | 0.03404 | 437 of 437 → 870 of 872 |
| Closet bend 447845 | 7.29 (640) | 0.01928 | 264 of 264 → 527 of 527 |
| Closet bend 447845 | 7.30 (640) | 0.01873 | 265 of 265 → 529 of 529 |
| Closet bend 447864 | 7.29 (640) | 0.01928 | 255 of 255 → 509 of 509 |
| Closet bend 447864 | 7.30 (640) | 0.01873 | 263 of 266 → 526 of 532 |

"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.
- [x] **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.
- [x] **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.
- [x] Python only: `python3 -m py_compile`. No Rust changes.

## Audit-honesty checklist

- [x] Docs reflect the change: the scorer's docstring. RE-311's figures
record what the scorer measured then: its transitions have 60 to 76
triangles, under the stride, 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. 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).
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant