Skip to content

feat(ifc): a beam's six base quantities are the sums of the prism its saved mesh is, and its body does not change (#1693) (RE-423) - #1699

Merged
DrunkOnJava merged 22 commits into
mainfrom
feat/1693-beam-quantities
Nov 11, 2026
Merged

DrunkOnJava merged 22 commits into
mainfrom
feat/1693-beam-quantities

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Revit writes six quantities on every beam in Qto_BeamBaseQuantities (CrossSectionArea, OuterSurfaceArea, GrossSurfaceArea, NetSurfaceArea, GrossVolume, NetVolume) as the sums of the faces of the prism its solid is: the area of one end, the lateral area, the lateral area and both ends, the volume. rvt-rs wrote none of them. A beam now gets them from the mesh Revit saved for it, where that is one closed solid of flat faces with no hole through it, a prism along its longest axis with two flat, square ends of one area, and its volume is the end area times its extent. The beam's body does not change.

On the BIM4LCA files all six read equal to Revit's on 21 of the concrete housing's 22 beams, 41 of the timber housing's 41 and 71 of the timber office's 71 (266 of the 284 beams of the eight large files), none different. The concrete office's 8 hollow tubes, whose Revit values are no sum of their faces, get none. Autodesk's rac_advanced, rst_basic and Snowdon Towers Structural gain them on 938 beams, which no Revit export scores.

Cost. Reading the beams' saved graphics costs time and memory on 11 of the 68 files Measure times (run 42972934548, base 47aa70be, head e10641ce, both timed in turn on one runner per file, three rounds): Autodesk's rst_basic of 2023 to 2027 take 21 to 29% longer and peak at 2.1 to 2.3 times the memory (143 to 147 MiB become 314 to 327 MiB), rac_advanced of 2023 to 2027 take 14 to 16% longer and peak at 1.8 to 1.9 times (557 to 579 MiB become 1,010 to 1,090 MiB), and Snowdon Towers Structural of 2024 takes 69% longer and peaks at 2.5 times (494 MiB becomes 1,224 MiB). The other 57 files read 0.99 to 1.01 in time and 0.96 to 1.00 in peak memory. The saved-mesh pass already ran on all 11 before this change (their bodies are drawn from saved meshes at the base), so what is added is the reading of the beams' graphics; why that costs this much is not established (#1694 tracks the pass's peak memory). The BIM4LCA housing and timber office are not in Measure's timing table. --no-saved-meshes leaves out the quantities and the cost. The report's section 5, the changelog fragment and the release criteria entry state it.

Closes #1693. The residuals are filed: #1697 (Length, Roll, Slope and Span of beams drawn from a saved mesh) and #1698 (beam bodies that are not Revit's solid).

Motivation

#1693 (the six quantities), #1636 (second-project measurement); follows RE-353 (revit-ifc's beam and column quantities), RE-387, RE-388 (a wall's quantities from its mesh, the pattern this follows), RE-404 and RE-418. The rows were registered on #1636 before the first version's run was read: #1636 (comment) and #1636 (comment), and the results are read against them at #1636 (comment).

Changes

  • src/ifc/mesh_volume.rs: beam_quantities (the mesh read as a prism along each distinct edge direction, at most 48, taking the longest with two flat, square ends of one area, refusing a tie, a mesh of more than one piece or with a hole through it, and a volume that is not the end area times the extent), and the helpers it needs (closed_mesh's piece count by union-find, edge_directions). Eight pure-helper tests: two for what it accepts (a box whichever way it lies, a beam with slanted ends, read across them) and six for how it fails (a mesh not closed, two solids, a ring and a ring beside a box, whose Euler characteristic is a single solid's, which a DeepSeek review of the first version found, a cube, a section of many planes, no triangles).
  • src/ifc/saved_meshes.rs: beam_lines (the beams drawn along their line, read for their quantities whether or not their body is drawn from the mesh, as walls is), beam_mesh_quantities, and add_beam_quantities, which writes the six into the beam's Qto_BeamBaseQuantities where it holds none of them. The pass also reads the quantities of a beam it replaces from its record box.
  • tools/re/beam_quantities_vs_ifc.py (Revit's quantities against its own body's faces, and what rvt-rs writes) and tools/re/beam_added_quantities.py (what one export adds to another's, as the sums of the beam's faces).
  • Report RE-423, a changelog fragment, the release criteria's W7 entry and a docs/format-reconnaissance.md addendum.

Testing

Measured end to end on the Measure runner (no local builds here; CI builds and runs the pure helpers' tests); the helpers compile and pass their tests in a rustc stub harness here:

  • final-head unfiltered run 42972912571 (head e10641ce, which is main at 47aa70be plus this change, against 47aa70be, every flag, 126 models each side): 107 exports byte-identical and 19 move, the same 19 as in the first run below (the housing's six files, the timber office's two and 11 Autodesk samples). The scorers' diff holds only the lines of the eight files that move (the housing's six and the timber office's two; the concrete office's four are byte-identical): its qtos_vs_ifc and mcp_answers_vs_ifc lines, equal rises by six per beam (+126, +126, +246, +246, +426 and +426, and +12 on each terrain file) and missing falls by the same, different and rvt-rs quantities Revit does not write do not move, and no psets_vs_ifc line changes. The body_sources of the 101 models that report them are identical, the 18 held-out models' exports are byte-identical, diagnostics.json differs on 10 models (the housing's four large files, the timber office at permit and the five rac_advanced saves) in no key but exported.total_entities (+1 to +28, the Qto_BeamBaseQuantities set of beams that held none), and same-project gates passed on the head;

  • unfiltered run 42964333038 (head 781ed0cd, kept under refs/archive/2026-11-11/cited/781ed0cd1a45, against 5d291201, every flag, 126 models each side): 107 exports byte-identical and 19 move, the housing's six files, the timber office's two and 11 Autodesk samples. No line of qtos_vs_ifc or psets_vs_ifc of any model gains a different or a value Revit does not write; the 18 held-out models' counts are identical; the body_sources of the 101 models that report them are identical on both sides (29 and 345 beams drawn as partition_beam_axis in the rac_advanced and rst_basic saves); same-project gates passed;

  • run 42964336667 kept both sides' exports of the samples; tools/re/ifc_element_diff.py finds only IfcBeam changing, only by the six values added, on 938 beams, nothing else;

  • run 42967574116, the first version (head 4a1b78d6, kept under refs/archive/2026-11-11/cited/4a1b78d692d4), whose beam bodies are the saved meshes: tools/re/beam_added_quantities.py reads every one of the six values on every one of the 938 beams as the sum the rule gives of its faces, none anything else. That version failed same-project gates on six Autodesk saves, because it replaced the beam bodies and the gate holds rac_advanced to 29 and rst_basic to 345 beams drawn along their axes; this one keeps them;

  • run 42967412141, tools/re/beam_quantities_vs_ifc.py on the new head over the housing's four large files and both offices.

  • timing run 42972934548 (timing, base 47aa70be, head e10641ce, one runner per file, 68 files): the cost above, table in the report's section 5.

  • tools/check-local.sh: not run locally (no local builds here); CI builds and tests it

  • Verified end to end on real Revit files: the runs above

  • If this touches the IFC exporter: the runs above, and the report states what it does not touch (the 8 tubes, one beam per state of the concrete housing, the beams' bodies)

Audit-honesty checklist

  • Docs state only what ships (the criteria entry, the addendum, the fragment and the report describe this change)
  • Changelog fragment under changelog.d/added/
  • Limitations in the report: one project with a Revit export (the BIM4LCA housing and office, Revit 2024), the 938 sample beams are read, not scored, and the tubes and one concrete housing beam per state get none, and the cost in time and memory on 11 of 68 timed files (the housing and timber office are not timed)
  • No emojis, no private paths

Legal and contribution hygiene

  • Apache-2.0; revit-ifc's CreateBeamColumnBaseQuantities cited by file and function as RE-353 read it (CLEANROOM.md source 5), none of its code copied
  • No Autodesk proprietary source, decompiled internals or NDA'd SDK content

Breaking changes

None: no public type or signature changes; a beam's export gains six quantities it did not write.

…aved mesh along its own axis where its record box overruns the solid (#1046) (RE-418)
…s axial extent and that 49 of the timber office's mullions carry a box that overruns the solid (#1046) (RE-418)
…rfaceArea of its lateral faces and of the end faces its solid keeps (#1046) (RE-404)
…values equal on the timber office at permit, 5 of 126 exports move (#1046) (RE-418)
…aceArea of each curtain mullion against Revit's, with the body's prism read along its own axis (#1046) (RE-418) (RE-404)
… the axis its record runs it along, and no prism with more than 32 planes is read (#1046) (RE-418)
…se positive on a rac_advanced mullion and the plane cap (#1046) (RE-418)
…rea (the record's axis for the prism, the plane cap, and the partner check on the kept ends) (#1046) (RE-404)
…e partner check that leaves them out (#1046) (RE-404)
… it adds a plane, and partner_ends uses the imported HashMap (#1046) (RE-404)
…exports byte-identical and the 58 Autodesk samples unchanged (#1046) (RE-418)
…rea (RE-418's measured numbers: 125 of 126 exports byte-identical, the 58 samples unchanged) (#1046) (RE-404)
…ns that gain a NetSurfaceArea of their own lateral faces and ends, with tools/re/mullion_added_areas.py (#1046) (RE-404)
… its six base quantities come from the prism the mesh is (#1693) (RE-423)
…se quantities from the mesh, as a wall does, and a mesh must be one piece with no hole (#1693) (RE-423)
…faces, and a second reads the quantities one export adds to another's (#1693) (RE-423)
… landed; the tree is main plus RE-423's own change, its fragment, report and doc segments) (#1693) (RE-423)
…mCommon values of mesh beams (#1697) and the bodies that are not Revit's (#1698) (#1693) (RE-423)
… 14 to 69% in time and 1.8 to 2.5 times the peak memory on 11 of the 68 files Measure times (#1693) (RE-423)
DrunkOnJava added a commit that referenced this pull request Nov 11, 2026
… of the symbols they read, sized before any is decoded (#1694) (#1701)

## Summary

The saved-mesh pass cuts its batches of shared symbols by the bytes of
record body they read, sized before any symbol is decoded, instead of
from the objects per symbol of the batch before. The default export's
peak memory falls from 875 to 889 MiB to 360 to 392 on Autodesk's
`rac_basic` of 2023 to 2027, from 1,790 to 1,396 on Snowdon Towers
Architectural, from 934 to 1,001 to 724 to 792 on `rme_advanced` and
`rme_basic`, and from 1,439 and 1,550 to 1,301 and 1,436 on the BIM4LCA
office. No export changes (126 of 126 byte-identical) and no timed file
takes more than 2% longer.

## Motivation

#1694 (the pass's peak memory after #1691). Its dhat run named the
holder, the decoded graph objects (Measure 42960663793), and its
batch-plan probe (Measure 42973819930) found that the plan sizes each
batch as `20,000 * records / objects` of the one before it while the
symbols sort by id with the largest last, so a batch that meets them
holds several times its budget. Rows were registered on the issue before
every run:
#1694 (comment)
(the fix's rows), the results at
#1694 (comment)
and
#1694 (comment),
and the two levers tried and not carried (a budget of 1,000,000 bytes,
and not keeping the owners' graphs) at
#1694 (comment)
and
#1694 (comment).

## Changes

- `src/research/native_saved_scene.rs`: `body_sizes` (one
`extract_graphs` walk with `Options::graph_classes` empty, so each
selected record comes back with its Element base and `body_bytes` and no
graph is built) and `batch_end` (a pure function: a batch takes owners
while the bodies of the symbols they name, each counted once, stay
within `BATCH_BODY_BUDGET` = 2,000,000 bytes, always at least one owner,
and the owners that name no symbol stay a batch of their own).
`BATCH_OBJECT_BUDGET` and the first-batch, minimum and maximum symbol
counts are gone. Seven failure-first tests of `batch_end` (an owner over
the budget is a batch of its own, a zero budget advances, a shared
symbol counts once, a symbol with no size counts nothing, sizes that
overflow do not wrap, symbol-free owners stay apart, the budget is a
ceiling the batch may reach).
- `changelog.d/fixed/1694-saved-mesh-batches-by-bytes.md`.

## Testing

Measured end to end on the Measure runner (no local builds here; the
pure planner's tests also compile and pass in a standalone rustc
harness):

- unfiltered with `timing` against `main` 5f928b4 (every flag, every
scorer, 126 models each side),
[42977559276](https://github.com/DrunkOnJava/rvt-rs/actions/runs/42977559276)
on the fix (`81a4b59a`): **126 of 126 exports byte-identical**, no
scorer line moves, `same-project gates` pass; time reads 0.95 to 1.02 on
the 68 timed files (offices 1.01, Snowdon Architectural 1.02); the
export's peak memory, base to head: `rac_basic` 2023 to 2027 875, 889,
887, 887, 888 to 360, 378, 376, 375, 392 MiB; `rme_advanced` 2024 to
2027 981, 968, 970, 971 to 792, 783, 784, 787; `rme_basic` 945, 934,
934, 1,001 to 734, 724, 724, 724; Snowdon Architectural 1,790 to 1,396;
Snowdon Electrical 757 to 643; the BIM4LCA office as built 1,439 to
1,301 and at permit 1,550 to 1,436; Core Interior, Snowdon Structural
and `rac_advanced` unchanged. Two files rose: Snowdon HVAC 366 to 410
and RE1 Architecture 160 to 186 (their symbols come to one or two
batches under the budget, which the old first batch of 8 symbols did not
allow);
- `probe_1075_saved_batches` (the batched read makes the same elements
as the one-shot read, four selections of owners per model, exits with an
error on any difference),
[42977555634](https://github.com/DrunkOnJava/rvt-rs/actions/runs/42977555634):
`identical true` on 19 of 19 models;
- `probe_1075_heap_stages` at the fix against the same probe at its
base,
[42977552233](https://github.com/DrunkOnJava/rvt-rs/actions/runs/42977552233)
and
[42979872560](https://github.com/DrunkOnJava/rvt-rs/actions/runs/42979872560):
the pass's peak over its start, `rac_basic` 630.7 to 166.0 MiB,
`rme_advanced` 500.0 to 291.7, Snowdon Architectural 869.9 to 558.5,
Snowdon Electrical 318.6 to 228.7, with the same triangles on all 19
files.
- the fix merged with `main` (which now holds RE-423's beams, whose read
cost the 11 Autodesk files in #1699 their time and memory), the same
unfiltered run with timing:
[42983301930](https://github.com/DrunkOnJava/rvt-rs/actions/runs/42983301930),
its result goes on this PR.

- [ ] `tools/check-local.sh`: not run locally (no local builds here); CI
builds and tests it
- [x] Verified end to end on real Revit files: the runs above, read
against the rows registered on #1694
- [x] IFC output unchanged: 126 of 126 `ifc.sha256` equal
- [x] Performance change: the timing table above is the before and after

## Audit-honesty checklist

- [x] Changelog fragment under `changelog.d/fixed/`
- [x] Limitation stated: two files peak a little higher (above), and
`rac_advanced` and Snowdon Structural do not move (their peak is not a
batch: the owners the pass keeps while the batches run, which a lever
not carried here takes out at 8 to 26% more stage time)
- [x] No emojis, no private paths

## Legal and contribution hygiene

- [x] Apache-2.0; no Autodesk proprietary source, decompiled internals
or NDA'd SDK content

## Breaking changes

None.

## Related issues

Refs #1694 (it stays open until the pass is measured against 0.17.0
again).
DrunkOnJava added a commit that referenced this pull request Nov 11, 2026
… BIM4LCA housing and timber office, which read 0.98 to 1.01 in time and 0.99 to 1.03 in peak memory (#1693) (RE-423) (#1702)

## Summary

RE-423 (#1699, merged as `16411282`) stated its cost on the 68 files
Measure times and said the BIM4LCA housing and timber office, on which
its quantities are scored, were not among them. They are now timed (run
[42976698994](https://github.com/DrunkOnJava/rvt-rs/actions/runs/42976698994),
base `47aa70be`, head `302415ba`, one runner per shard, three rounds):
the six files read 0.98 to 1.01 in time and 0.99 to 1.03 in peak memory,
and the four office files timed again as controls read 1.00. The
fragment, the report's section 5 and the release criteria entry say so
in place of "not among the 68", and the report's reproduce lines name
`main` for `--ref` now that `feat/1693-beam-quantities` is gone.

## Motivation

#1693 (RE-423), #1694 (the saved-mesh pass's peak memory, where the
table is posted as the baseline for the batching change), #1636.

## Changes

- `changelog.d/added/1693-beam-base-quantities.md`,
`docs/release-1.0-criteria.md` and
`reports/element-framing/RE-423-beam-base-quantities.md` (section 5
gains the six files' table, section 6 names `--ref main`). No source,
workflow or script changes.

## Testing

Documents only. `python3 tools/release/changelog.py check` and `python3
tools/ci/api-doc-ids.py` pass. The numbers are those of the run above,
read from its `timing.md` and `timing-runners.txt`.

- [x] `tools/check-local.sh`: not run locally (no local builds here); CI
builds and tests it
- [x] Verified end to end on real Revit files: the run above
- [x] If this touches the IFC exporter: it does not

## Audit-honesty checklist

- [x] Docs state only what is measured (the six files, the controls, and
what was not timed: a structural model larger than Snowdon Towers
Structural)
- [x] Changelog fragment edited, under `changelog.d/added/`
- [x] No emojis, no private paths

## Legal and contribution hygiene

- [x] Apache-2.0; no code from another source
- [x] No Autodesk proprietary source, decompiled internals or NDA'd SDK
content

## Breaking changes

None.
DrunkOnJava added a commit that referenced this pull request Nov 11, 2026
…fice, beside the reference models, the office and the samples (#1694) (#1703)

## Summary

Measure's timing job times the BIM4LCA housing's four large files and
the timber office's two, beside the reference models, the four office
files and Autodesk's samples, with weights taken again from the last
tables and up to five shards.

## Motivation

The timing table left the second project's six large files out, so
RE-423 (#1699, which gave the saved-mesh pass the beams) had no time or
peak memory for the files it is scored on, and rvtDevelop timed them on
a scratch branch (run 42976698994; the table is on
#1694 (comment)).
The scratch commit dropped the reference-models unit to keep its run
small; this keeps it. The validation run then showed the shard weights
had drifted: the four shards of the old weights took 546, 823, 892 and
1,014 seconds against 790, 838, 770 and 775 planned.

## Changes

- `.github/workflows/measure.yml`: two units under `nordic` in the
timing plan, `housing` and `timber office`; a `bim4lca` field on every
timing row; a step that fetches the files a unit names with
`tools/ci/fetch-bim4lca.py research/bim4lca-measure.tsv models <files>`,
beside the office step. The weights of all units are six times the mean
of base and head times in the tables of runs 42977559276 and 42983436373
(reference models 68, offices 382, housing 554, timber office 437,
samples to 2023 421, 2024 696, 2025 296, 2026 296, 2027 on 290; the 2024
samples had grown from 559 and the 2026 and 2027 ones from 216 and 207),
and the plan may use five shards: with `nordic` and `samples`, the dry
run of the plan code gives 696, 622, 727, 717 and 678 seconds, the
longest 727 where four shards of the old weights took 1,014.

## Testing

- Run
[42983436373](https://github.com/DrunkOnJava/rvt-rs/actions/runs/42983436373),
dispatched from this branch at its first commit (`timing=true`,
`nordic=true`, `samples=true`, base 5f928b4, head 1641128): four
shards, the six files fetched, and one merged table of 74 rows that
holds them beside the reference models, the four office files and the
samples. The four office files read 0.99 to 1.01 in time and 1.00 in
peak memory, as in run 42976698994, and the six files time as
rvtDevelop's table (housing 22.4 to 23.6 s, timber office 32.8 s and
39.9 s). That run used the old weights; the shard split above is from
the plan code run on the three flag combinations (5, 4 and 5 shards).
- A dispatch with the new weights is the check that the longest shard is
near 727 seconds; its result goes on this PR before it is armed.

- [ ] `tools/check-local.sh`: workflow only
- [x] The timing dispatch above (old weights)
- [ ] The timing dispatch with the new weights

## Audit-honesty checklist

- [x] No emojis, no private paths
- [x] No user-visible change

## Legal and contribution hygiene

- [x] Apache-2.0; no Autodesk proprietary source or NDA'd SDK content

## Breaking changes

None.

## Related issues

Refs #1694.
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.

W7: beams' base quantities: rvt-rs writes Length on the beams drawn along their line and none of the other six, on 300 beams of the BIM4LCA files

1 participant