Skip to content

fix(ifc): an element on a Level that is not a building story goes to the building story below that Level, as Revit's exporter places it (#1842) - #1867

Merged
DrunkOnJava merged 4 commits into
mainfrom
fix/1842-non-story-levels
Nov 13, 2026
Merged

DrunkOnJava merged 4 commits into
mainfrom
fix/1842-non-story-levels

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

A Level whose Building Story setting is off is not a storey of Revit's IFC export (RE-118). rvt-rs bound nothing to such a Level, so an element whose record names one was left on no storey unless its height placed it.

Revit's exporter walks the Levels in elevation order, ties by ElementId (revit-ifc, CLEANROOM.md source 5: LevelUtil.FindAllLevels with its LevelElevationComparer, and Exporter.BeginDocumentExportCommon). It gives a Level that is not a building story the nearest building story below it. A Level below every building story gets none, and its elements are contained in the building. apply_partition_level_storeys now does the same, in the order recover_partition_levels already returns. A Level below every building story still binds nothing.

Motivation

#1842: HWT-25's Revit 2027 structural model (CHL) has 104 elements on no storey with 15 storeys read. Autodesk's Snowdon Towers structural sample has 656, with 7 of its 19 Levels not building stories.

probe_1842_level_storeys (in this PR; counts only, so it also runs on held-out models) counted every model Measure holds, in run 43344165070:

Model Levels Not building stories, above the first At a storey's elevation
Snowdon Towers structural, 2024 19 7 0
BIM4LCA housing, timber, as built 10 2 1
BIM4LCA housing, timber, permit 18 10 1
BIM4LCA housing on terrain, concrete and timber 6 each 2 each 0
rst_basic, 2016 to 2027 9 0 (all 9 below every building story: none is one) 0

Every other model has none, the held-out models included. rst_basic's case, no building story at all, is not this rule's: those Levels still bind nothing. Its storeys are #1842's second half.

Changes

  • src/ifc/mod.rs apply_partition_level_storeys: a Level that is not a building story records the storey index of the last building story before it, if any.
  • probes/examples/probe_1842_level_storeys.rs: the census above.
  • tools/ci/scrub-holdout-results.sh: keeps the probe's count line for held-out models.
  • Changelog fragment.

Testing

Rows, registered before the run:

  1. What moves. At most the five files above with a Level that is not a building story above a storey: the four housing files and Snowdon Structural. Every other ifc.sha256 and diagnostics.json is identical.
  2. Against Revit's export. On each housing file, storeys_vs_ifc counts "same storey as Revit's" up or level, "on no storey; Revit's is a storey" down or level, and "a different storey from Revit's" not up. Main's counts (run 43337536977):
    • timber as built: 1,609 same, 26 on no storey;
    • timber at permit: 1,535 same, 31 on no storey;
    • each terrain file: 476 or 477 same, 25 on no storey, 3 different.
      Any element that moves to a storey other than Revit's is named here.
  3. The tied Level. On both timber housing files one such Level sits at a storey's elevation (Nordic LCA housing as-built (Revit 2024): all Level records decode with elevation_feet = null, so storeys are at 0 ft and columns read 178 ft tall from z = 0 #746: Bet 1-lattia at Level_01). Whatever its elements do is read in row 2's counts, and named.
  4. Snowdon Structural, which has no Revit export in Measure: unsupported_geometry_missing_level goes down from 656, reported by class.
  5. same-project gates pass.

The run: unfiltered Measure of this head against its merge-base, every scorer, with the samples, BIM4LCA, R2025, rac_advanced and the held-out models.

  • rustfmt --edition 2024 --check passes; CI runs the rest
  • Verified end to end on real Revit files: rows 1 to 5
  • Touches the IFC exporter: Core Interior has no such Level (row 1)
  • Performance: n/a

Audit-honesty checklist

  • Docs: no doc says such a Level's elements are left on no storey
  • Changelog fragment
  • No limitation resolved or introduced in the docs; rst_basic stays as it was
  • Commit message says what and why
  • No emojis
  • No private paths or personal details
  • The probe states its FACT; revit-ifc is cited by file and method, nothing copied

Legal and contribution hygiene

  • Apache-2.0
  • No Autodesk proprietary source, decompiled internals or NDA material. revit-ifc (LGPL, CLEANROOM.md source 5) is read and cited, not copied.
  • No fixtures

Breaking changes

None.

Related issues

Part of #1842.

…ding Story setting, to tell why rst_basic's Levels give no storeys (#1842)
…here the others sit, with no names, so it runs on held-out models (#1842)
…the building story below that Level, as Revit's exporter places it (#1842)
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Unfiltered Measure 43345687403 at fd57a047 against the merge-base 925c482d, read against the rows above. Every row holds.

  1. What moves. 5 of 126 exports, and their 5 diagnostics.json: the four housing files and Snowdon Structural, the files the census named. Every other export and every other diagnostics.json is identical, the held-out models included.

  2. Against Revit's export (storeys_vs_ifc). "A different storey from Revit's" does not change anywhere.

    File Same storey as Revit's On no storey where Revit has one
    terrain, concrete 476 → 482 25 → 19
    terrain, timber 477 → 483 25 → 19
    timber, as built 1,609 → 1,620 26 → 15
    timber, permit 1,535 → 1,552 31 → 14

    The elements that move are beams, plus one pipe segment on each timber file. mcp_answers_vs_ifc's storey rows move by the same counts.

  3. The tied Level. No element of either timber file moves to a storey other than Revit's.

  4. Snowdon Structural: unsupported_geometry_missing_level 656 → 465, and storey-bound elements 633 → 824. Proxies 48 → 0, walls 18 → 0, the slab 1 → 0, footings 48 → 8, columns 17 → 2, beams 524 → 455.

  5. same-project gates pass on fd57a047.

@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 13, 2026 02:07
@DrunkOnJava
DrunkOnJava merged commit 387d6e0 into main Nov 13, 2026
109 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1842-non-story-levels branch November 13, 2026 02:25
DrunkOnJava added a commit that referenced this pull request Nov 13, 2026
…th no storey, as Revit's export writes it, instead of storeys made up from its elements' heights (#1842) (#1868)

## Summary

Stacked on #1867 (its commits are this branch's first). This PR's own
change is `3aba96fd`.

When the recovered Levels include no building story, rvt-rs now writes
no storey and contains the elements in the building, as Revit's export
does. Before, it fell back to storeys made up from walls or from its
elements' record-box elevations.

Every one of the 9 Levels of Autodesk's `rst_basic` sample, saved by
Revit 2016 to 2027, has its Building Story setting off
(`probe_1842_level_storeys`, run
[43344165070](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43344165070)).
With no Level storey, the export fell back to storeys named from element
heights: "Elevation -1.949 ft" and "Elevation -1.148 ft" on 2024 to
2027, binding 14 of the elements. No Revit export has such a storey.

Revit's exporter makes no storey from a Level that is not a building
story. It gives one below every building story none, so with no building
story at all no element is on a storey and the elements are contained in
the building (revit-ifc, CLEANROOM.md source 5:
`Exporter.BeginDocumentExportCommon`, and the
`relatedElementSetForBuilding` branch of its containment). `rst_basic`
is the only file Measure holds with no building story; it has no Revit
export there.

## Changes

- `apply_partition_level_storeys` returns whether Levels were recovered.
With Levels recovered and no storey left, the ArcWall path and
`apply_element_record_storeys` make up no storey.
- Changelog fragment `changelog.d/fixed/1842-no-building-story.md`.

## Testing

Rows, registered before the run. It runs against #1867's head
`fd57a047`, so it shows only this change.

1. **What moves.** The twelve `rst_basic` saves, 2016 to 2027, and
nothing else. Every other `ifc.sha256` and `diagnostics.json` is
identical: every other file with recovered Levels has a building story
among them.
2. **`rst_basic`.** `storey_count` 0 (from 5 on 2016 to 2023 and 2 on
2024 to 2027), and `storey_bound_elements` 0 (from 36 and 14). No
`IfcBuildingStorey` is written, and every element is in the
`IfcBuilding`. `storeys_vs_ifc` without a Revit export counts every
element as on no storey.
3. **`same-project gates`** pass. Any comparison of storeys between
saves is reported.
4. **#1864:** the 12 `rst_basic` level binds that differ between its
2025 and 2026 saves are read again here.

The run: unfiltered Measure of this head against `fd57a047`, every
scorer, with the samples, BIM4LCA, R2025, `rac_advanced` and the
held-out models.

- [x] `rustfmt --edition 2024 --check` passes; CI runs the rest
- [ ] Verified end to end on real Revit files: rows 1 to 4
- [x] Touches the IFC exporter: Core Interior has building stories (row
1)
- [ ] Performance: n/a

## Audit-honesty checklist

- [x] Docs: the sample's storeys are named in no doc
- [x] Changelog fragment
- [x] No limitation resolved or introduced in the docs. This rule has no
Revit export to check it on, so the evidence is the exporter's source
and RE-118's Building Story read, exact on Snowdon Towers' 37 Levels.
- [x] Commit message says what and why
- [x] No emojis
- [x] No private paths or personal details
- [x] revit-ifc is cited by file and method, nothing copied

## Legal and contribution hygiene

- [x] Apache-2.0
- [x] No Autodesk proprietary source, decompiled internals or NDA
material
- [x] No fixtures

## Breaking changes

None.

## Related issues

Part of #1842. Lands after #1867.
DrunkOnJava added a commit that referenced this pull request Nov 13, 2026
## Summary

Release metadata for v0.20.0 (RELEASE.md, steps 4 to 7), cut from `main`
at `925c482d` and merged with `main` up to `58395b62` (#1855, #1860,
#1861, #1863, #1866, #1867 and #1868 among it):
- every version file moves to 0.20.0 (`tools/release/bump_version.py`),
and `CITATION.cff` is dated 2026-11-12;
- the fragments under `changelog.d/` are assembled into a `[0.20.0]`
section, with its introduction and "Upgrading from 0.19" (the
work-budget bullet says a stop warns and the export is still written, as
#1855 settled);
- the README's release lines name v0.20.0;
- Core Interior's two witness observations and verdicts, and the two
synthetic IFC fixtures, are taken from CI's artifacts for `e10580d0`:
only `witness_version`, the verdict hashes, the retired "Unmapped Revit
unit identifiers" warning (RE-445) and an unset transparency (#1820)
differ.

Measured and rehearsed:
- the comparison with 0.19.0 is in the section, from Measure runs
[43357862138](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43357862138)
(unfiltered, `58395b62` against `v0.19.0`'s `09b18bd3`: 49 of 146
exports move, 0 census regressions, 0 body regressions) and
[43357979238](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43357979238)
(timing: no file more than 3% slower except one that reads 0.98 in the
earlier run of the same code, no peak higher by more than 2%, the
samples of 2023 to 2027 at a median 0.76 times the peak memory). The
release adds only notes, witness files, version strings and fixtures to
`58395b62`, so a run of `main` is the run of the release; a run of this
branch would move every export through the header's version string;
- `publish.yml` rehearsal on `d9946f4b`:
[43359414819](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43359414819)
passed. Only the changelog changed since.

**Why now.** `main` holds today's crafted-file and security fixes
(#1815, #1831, #1833, #1845), and neither GlobalId move. #1850 is back
in draft until the tag, and #1854's fix is #1859. Those two ship
together in 0.21.0 (#1854 comment 6841360704).

## Testing

- `python3 tools/release/changelog.py check` passes: no fragment is
left.
- `bump_version.py` checks the version files with the preflight's own
`check_versions`.
- The PII guard runs `release_preflight.py` on this PR.
- Timing against 0.19.0 is in the section, from run 43357979238 on
`58395b62`.

## Related issues

Release 0.20.0. Milestone `0.20.0`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ifc Work in the ifc area. type:bug Correctness defect or regression.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant