Skip to content

fix(ifc): a column starting at z = 0 takes its bottom from its geometry node (RE-173) - #753

Merged
DrunkOnJava merged 2 commits into
DrunkOnJava:mainfrom
helenkwok:fix/column-z-from-grep-node
Oct 18, 2026
Merged

DrunkOnJava merged 2 commits into
DrunkOnJava:mainfrom
helenkwok:fix/column-z-from-grep-node

Conversation

@helenkwok

@helenkwok helenkwok commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Refs #746. Some column records hold a box that starts at exactly z = 0.0 while the column starts higher, so rvt-rs draws those columns from the ground. This affects 131 of the 135 columns in Autodesk's rmeadvancedsampleproject (Revit 2024), all 54 in BIM4LCA Housing_Timber_As-Built (#746), and all 7 in Housing_Concrete_BuildingPermit.

Where the right value is. Revit also stores the instance's geometry node. In the inflated Partitions/* streams the column's u64 ElementId occurs again as u64 id · u64 3 · u64 0xffffffffffffffff, with two boxes of six f64 (min x, y, z, max x, y, z) at 96 and 48 bytes before the id. The two boxes have the same x and y extents, and the second holds Revit's z-range. The schema class tags around them are GArray (0x0820, parent GInstance) and GRep (0x0841). A column can have several such nodes, and they do not always agree.

The rule (fail closed).

  • It applies only to a Column or StructuralColumn whose record box starts at exactly 0.0.
  • A node counts when both of its boxes are finite with max above min, their x and y extents are equal and match the record's to 1e-6 ft, its top equals the record's top (within 0.01 ft), and its bottom differs from the record's.
  • The bottom moves only if every counting node gives the same bottom. The top is kept.
  • The element is marked m_column_z_source = partition_geometry_node.
  • Revit 2024 only.
  • Cost: one memchr::memmem pass per partition, only when a column starts at 0.0.

Measured against Revit. Autodesk files use Revit's Base Level + Base Offset and Top Level + Top Offset parameters; the BIM4LCA files, whose export has no Revit parameters, use the geometry in Revit's IFC4 export.

file columns rewritten rewritten and equal to Revit not rewritten
rmeadvanced 135 131 131 4, already right
Housing_Concrete_BuildingPermit 7 7 7 0
Housing_Timber_As-Built 54 54 54 0
racadvanced 176 0 176 right by Revit's exported geometry (see note)
rstadvanced 203 0 203 right
racbasic 3 0 3 right by Revit's exported geometry (see note)
Office_Concrete_BuildingPermit 346 0 unchanged
Office_Timber_BuildingPermit 340 0 unchanged

No column that main gets right is changed.

Note on racadvanced and racbasic. An earlier version of this table counted 12 racadvanced columns and 1 racbasic column as wrong. That came from comparing with Revit's exported parameters. For the 12 racadvanced columns Revit's IFC writes Base Offset, Top Offset and Length in feet divided by 304.8, labelled as millimetres (column 201277: Base Offset -0.013123 = -4 ft, Top Offset 0.006562 = 2 ft, Length 0.019685 = 6 ft). The racbasic column (414482, a drop-cap column) has parameters giving a top of 10.171 ft, while Revit's own exported body tops at 2980 mm = 9.777 ft, as here. Revit's exported body geometry agrees with main and with this PR on all 176 racadvanced columns and on that racbasic column.

Not covered. Columns whose record box does not start at 0.0 are never touched; on these samples none of them is wrong. Revit 2023 and 2025 are not checked. On Housing_Timber_* the storeys still need #752; this rule does not need Levels.

Test. tests/column_node_z.rs:

  • Required data: RVT_NORDIC_LCA_DIR with ARK_NordicLCA_Housing_Concrete_BuildingPermit.rvt (CC BY-SA 4.0, BIM4LCA; fetched by URL and sha256 as listed in corpus/tier2/README.md, not committed). The 7 columns' bottoms and tops must equal Revit's.
  • Optional check: with RVT_REVIT2024_SAMPLES_DIR and rmeadvancedsampleproject.rvt, at least 131 columns must start above z = 0.
  • Result: both fail on main (1406153: bottom 0, Revit 170.60367454068242) and pass with the change.

cargo fmt --check, clippy -D warnings and cargo doc -D warnings pass. The integration suite gives the same result as main: one pre-existing failure, ifc_synthetic_project::synthetic_project_emits_valid_ifc4, which fails on main too. Report: reports/element-framing/RE-173-column-z-from-geometry-node.md.

Clean-room: based on public Autodesk Revit 2024 sample files, public BIM4LCA files, Revit's own IFC4 export as the oracle, and the file's own schema and exported symbol names only. No Autodesk SDK source, ODA SDK source, leaked documentation or decompiled code.

# Conflicts:
#	corpus/tier2/README.md
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 18, 2026 08:54
@DrunkOnJava
DrunkOnJava merged commit 270ed1f into DrunkOnJava:main Oct 18, 2026
25 checks passed
DrunkOnJava pushed a commit that referenced this pull request Oct 18, 2026
… cut body (RE-178) (#757)

Closes #756. Builds on #753 (RE-173) and shares its geometry-node reader.

**The rule (fail closed).** For a `Column` or `StructuralColumn` (Revit 2024), the IFC body takes the second box of the column's geometry node only when every node of the column, in every partition, has x and y extents equal to the column's (both boxes, 1e-6 ft), all of them give the same second-box z-range (0.01 ft), and that range lies inside the column's own extent and differs from it. Otherwise the body is unchanged. The node scan is shared with RE-173's `column_bottoms`, whose behaviour is unchanged.

**What changes and what does not.** Only the body: the extrusion depth becomes the cut height, and a body that starts above the column's base is a placed extrusion that far up. The placement stays at the column's own base, so storeys and containment do not move. `m_locationZ`, `m_bboxHeight`, `BoundingBoxHeight` and every parameter keep the column's own extent, as Revit's `Length` and offsets do. The element carries `BodyHeightSource = partition_geometry_node_after_joins`. No boolean.

Measured with `rvt-ifc` against Revit's exported body z-range (vertical `IfcExtrudedAreaSolid`, 0.01 ft at both ends), before = #753's head (`4a70c53`):

| file | columns | right before | right after |
|---|---:|---:|---:|
| rstadvanced | 203 | 14 | 203 |
| rstbasic | 30 | 29 | 30 |
| racadvanced, Technicalschool | 176 each | all | all |
| racbasic | 2 (+1 faceted) | 2 | 2 |
| rmeadvanced, rmebasic | 135 each | all | all |
| BIM4LCA Office_Concrete_As-Built | 279 | 265 | 279 |
| BIM4LCA Office_Concrete_BuildingPermit | 327 | 262 | 327 |
| BIM4LCA Office_Timber_As-Built | 339 | 337 | 339 |
| BIM4LCA Office_Timber_BuildingPermit | 335 | 330 | 331 |
| BIM4LCA Housing (6 files) | 7, 7, 5, 5, 54, 54 | all | all |

272 of the 276 cut columns are fixed and none regress (2,269 compared: 1,993 right before, 2,265 after). RE-173's columns stay right. Across all 19 files, storeys, placements, containment, GlobalIds and all other properties are identical between the two exports apart from `BodyHeightSource` on the 272.

**Not covered.** The 4 left are in Office_Timber_BuildingPermit, among the 14 columns whose node copies give different second-box z-ranges; the rule leaves them as they were. The rule also declines 48 uncut columns whose copies differ in plan, all right before and after. Plan-shaped cuts (the node holds a box), Revit 2023 and 2025, and DACH and Snowdon (no elements exported on main, #736) are not covered.

**Test.** `tests/column_cut_body.rs`, registered in `tools/ci/test-targets.txt`. With `RVT_NORDIC_LCA_DIR` holding BIM4LCA `ARK_NordicLCA_Office_Concrete_As-Built.rvt` (CC BY-SA 4.0, fetched by URL and sha256 as in `corpus/tier2/README.md`, not redistributed) its 14 cut columns' bodies must equal Revit's while `BoundingBoxHeight` keeps the own extent; on `4a70c53` it fails (`1343741: body top 182.087, Revit 180.610`). Optional, with `RVT_REVIT2024_SAMPLES_DIR`: `rstbasicsampleproject` column 1173925, cut at its bottom. `cargo fmt --check` and `cargo clippy --all-targets --all-features -- -D warnings` pass; the full suite passes except `ifc_synthetic_project::synthetic_project_emits_valid_ifc4`, which fails on main too.

Report: `reports/element-framing/RE-178-column-cut-body.md`.

Clean-room: public Autodesk Revit 2024 sample files and the BIM4LCA files, with Revit's own IFC4 export as the oracle and the file's own schema and exported symbol names only. No SDK source and no decompiled or disassembled code was used.
DrunkOnJava added a commit that referenced this pull request Oct 18, 2026
[Unreleased] becomes [0.5.0] — 2026-10-18, with an introduction, the
contributors, and what to change when upgrading from 0.4. The community
pull requests' entries are added and credited (#737, #738, #744, #751,
#752, #753, #755, #757, #758), and the repeated Added, Changed, Fixed and
Research headings are folded into one each, keeping every entry (107) and
its order; everything from [0.4.0] down is unchanged.

CITATION.cff said 0.1.2 (2026-04-20), though RELEASE.md has it agree with
Cargo.toml at every tag. Its abstract now describes the project as the
README does, without the "first open-source tool" and "verified against
11 releases" claims.
DrunkOnJava added a commit that referenced this pull request Oct 18, 2026
## Summary

Prepare v0.5.0. Merging this is not the release: the release is the signed `v0.5.0` tag on the merged commit, which runs `publish.yml` (crates.io, PyPI, the release binaries and the container image). The tag waits for the maintainer's go-ahead.

## Motivation

`main` is 0.4.0 plus everything under `[Unreleased]`: Revit 2026 projects (experimental), MEP ports, connections and systems, Revit's level, category, family, type and phase properties, rooms aggregated into their storeys, Snowdon Towers exporting again, and the first pull requests from outside contributors. Before 1.0 a breaking change bumps the minor version, and these are breaking for a 0.4 user:

- The MSRV is 1.87 (was 1.85).
- `rvt` has no `wasm` feature; the bindings are the `rvt-wasm` crate (C6).
- Each `IfcSpace` is aggregated into its storey instead of contained in it (#744).
- `ElemTableHeader::record_count` is a `u32` (#764).
- Type objects take Revit's GlobalIds (RE-167).

## Changes

- **Versions 0.4.0 → 0.5.0:** `rvt`, `rvt-py` and its pin, `rvt-wasm`, the `stream_evidence` pin, both lockfiles (only the workspace crates' version lines change), `.release-please-manifest.json` and `viewer/package.json`.
- **`CHANGELOG.md`:** `[Unreleased]` becomes `[0.5.0] — 2026-10-18`.
  - An introduction, the contributors, and an **Upgrading from 0.4** section.
  - The community pull requests' entries are added and credited (#737, #738, #744, #751, #752, #753, #755, #757, #758).
  - The repeated Added, Changed, Fixed and Research headings, which later merges had appended, are folded into one each. All 107 entries are kept as written (checked as a multiset) and in their order, and everything from `[0.4.0]` down is byte-identical.
  - #778's clean-room policy change is added under Changed, so the section has 108 entries.
- **`CITATION.cff`:** it said 0.1.2 (2026-04-20), though `RELEASE.md` has it agree with `Cargo.toml` at every tag. Its abstract now describes the project as the README does, without the "first open-source tool" and "verified against 11 releases" claims.
- **Registry descriptions:** crates.io showed 0.4.0's description, which leaves out Revit 2023, and PyPI one that called element extraction and geometry "active research" and the export "document-level IFC4 scaffolding". `Cargo.toml` and `pyproject.toml` now say what the README says: typed elements from Revit 2023 to 2025 projects, 2026 experimental.
- **Witnesses:** the IFC header carries the version (#417), so both Core Interior `rvt-rs.json` observations and their verdicts are refreshed from this pull request's CI run.

## Testing

- CI on this pull request: every job `CI passed` requires, the witness replays among them.
- On the tag, the publish workflow runs its own checks before anything is published: wheel install and model open on each OS, `cargo install` and the CLI sample smoke, the docs.rs build preview and the viewer load smoke. crates.io and PyPI publish only after all of them pass, and PyPI only after crates.io.

## Audit-honesty checklist

- The docs keep describing 0.4.0 as the latest release until each 0.5.0 channel has been checked from what was published. That follows in a separate pull request (`docs/install.md`, `docs/python.md`, `docs/status.md`, `docs/supported-profile.md` and the README's release section).
- crates.io's trusted publisher (repository DrunkOnJava/rvt-rs, workflow `publish.yml`, environment `crates-io`) has to be in place before the tag, as `docs/maintaining.md` says; it is a registry-side setting this repository cannot check.

## Legal and contribution hygiene

N/A: release metadata only. Contributors are credited by their GitHub names in the CHANGELOG.

## Breaking changes

Listed under Motivation, with the migration for each in the CHANGELOG's **Upgrading from 0.4**.
DrunkOnJava added a commit that referenced this pull request Oct 18, 2026
…ed (#766) (#789)

## Summary

CI's tier-two job reads the BIM4LCA models its targets need, by byte range from VTT's `ARCH.zip`, so four targets that skipped in CI now run on every pull request (#766, second item).

## Motivation

Several of this month's fixes were measured on VTT's BIM4LCA example buildings (CC BY-SA 4.0). Their targets skip without `RVT_NORDIC_LCA_DIR`, which CI never set. A regression on those files would therefore pass CI, as #736 did on Snowdon. The targets are `level_parameters` (#751), `level_shared_elevation` (#752), `column_node_z` (#753) and `column_cut_body` (#757).

## Changes

- **`tools/ci/fetch-bim4lca.py`** (stdlib Python):
  - reads the archive's central directory from its last MiB;
  - for each pinned entry, reads the local header for the data offset, range-fetches the compressed bytes and inflates them as they arrive;
  - checks each file's size and sha256 against its pin.
  - A 200 answer to a range request, or an archive size other than the pinned 1,579,459,850 bytes, stops it as stale.
  - Exit codes: 0 when all files verify, 1 for a stale pin, 2 for an unreachable host after five tries.
  - `--pin` prints pin rows.
- **`research/bim4lca-models.tsv`:** the archive and five entries, 286 MB: four Revit 2024 models and Revit's IFC export of Housing_Terrain-Concrete.
- **`.github/workflows/ci.yml`**, tier-two job:
  - restores `_bim4lca` from a cache keyed on the pins file and fetches on a miss;
  - sets `RVT_NORDIC_LCA_DIR` only when all five verified;
  - reports a **NOT MEASURED** warning when the host is unreachable (the targets then skip visibly) and fails on a stale pin;
  - saves the cache from `main` only, so pull requests restore `main`'s copy rather than each storing 286 MB.
- **Docs:** `corpus/tier2/README.md`, a BIM4LCA section in `docs/reference-models.md`, and a Research entry in `CHANGELOG.md`.

## Testing

- **Pins:** the range reader's output for the five entries equals the hashes measured earlier on a full download of the archive, as recorded in `corpus/tier2/README.md`: `3df759b8…`, `c6b53726…`, `74712000…`, `23675d6c…` and the IFC's `c3946ee4…`.
- **This pull request's tier-two run** ([job 117734636435](https://github.com/DrunkOnJava/rvt-rs/actions/runs/39147646493/job/117734636435)):
  - The cache missed, as it does before `main` has saved one. The fetcher read the five files by range in about 8 seconds, `[verified]` each, and set `RVT_NORDIC_LCA_DIR`.
  - The four targets ran and passed, with no "skipping" line:
    - `column_cut_body::nordic_office_concrete_columns_stop_at_the_slab` (11.0 s)
    - `column_node_z::nordic_housing_concrete_column_z_is_revits` (8.5 s)
    - `level_shared_elevation::nordic_housing_timber_keeps_its_storeys` (1.2 s)
    - `level_parameters::nordic_housing_terrain_levels_are_revits_storeys` (2.5 s)
- After merge, `main`'s run should save the cache and later runs restore it. Checked and noted here then.

## Out of scope

- Measure integration: the BIM4LCA reference exports are 80 MB each, and #763 needs it.
- #766's R2025 item, which waits on the licence.
- The Actions cache was cleared of 1,162 unusable entries (3.6 GB) before this, so the 286 MB fits.

## Breaking changes

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

2 participants