Repository navigation
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
Conversation
|
Unfiltered Measure 43345687403 at
|
…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.
## 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`.
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.FindAllLevelswith itsLevelElevationComparer, andExporter.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_storeysnow does the same, in the orderrecover_partition_levelsalready 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:rst_basic, 2016 to 2027Every 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.rsapply_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.Testing
Rows, registered before the run:
ifc.sha256anddiagnostics.jsonis identical.storeys_vs_ifccounts "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):Any element that moves to a storey other than Revit's is named here.
Bet 1-lattiaatLevel_01). Whatever its elements do is read in row 2's counts, and named.unsupported_geometry_missing_levelgoes down from 656, reported by class.same-project gatespass.The run: unfiltered Measure of this head against its merge-base, every scorer, with the samples, BIM4LCA, R2025,
rac_advancedand the held-out models.rustfmt --edition 2024 --checkpasses; CI runs the restAudit-honesty checklist
rst_basicstays as it wasLegal and contribution hygiene
Breaking changes
None.
Related issues
Part of #1842.