Repository navigation
feat(elements): recover 256/256 IFCCOLUMN from Revit 2024 partition element records - #210
Merged
Merged
Conversation
…ement records Decode the partition element-record header — u64 self ElementId, i64 BuiltInCategory at +0x12, fixed marker at +0x50, six f64 feet of model bounding box at +0x58 — and recover OST_Columns instances from it. Selection is fail-closed in three steps: the record's leading u64 must be declared in Global/ElemTable; records whose bbox is centred on the plan origin are family-local type envelopes and are dropped; co-located footprint groups collapse to their highest ElementId, since Revit allocates ids monotonically and the newer of a superseded pair is the live element. On 2024_Core_Interior.rvt that is exactly the 256 columns Revit's own exporter emits — no false positives, no misses. IFC export emits IfcColumn with a project placement and a bounding-box extrusion, labelled as an envelope rather than a recovered family profile, plus an RvtColumnGeometry property set recording that the profile and the base/top Level bind are still unresolved. The slim manifest's `columns` category moves to `known` at 256/256 with tolerance 0, so the OctetProof verdict now compares IFCCOLUMN across all three lineages instead of excluding it; both verdicts still PASS and both rvt-rs observation hashes changed. `real_file_element_geometry` now stays in unsupported_features while any emitted element lacks a body, so partial geometry is not read as a solved claim. Closes #204
`unsupported_features` carried `real_file_element_geometry` only while no exported element had a body, so the first category to gain geometry cleared the gap for every other one. It now reports `real_file_element_geometry` when nothing has a body and `partial_element_geometry` when some do and some do not — on Core Interior, 256 IFCCOLUMN with bodies against 82 slabs/spaces without. The slim manifest's `rooms_spaces` gap names the new code; both rvt-rs observations record it in `unsupported_entities`, so their hashes and the slim verdict hash changed. The ci.yml comment describing the slim surface as four fields wide is updated to five (comment only).
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_4890029b-33d9-477a-9044-6e3adf745501) |
This was referenced Aug 30, 2026
Partition element-record recovery for walls / doors / windows: recall is 100%, precision is not
#211
Closed
Closed
… the column row's scope
DrunkOnJava
added a commit
that referenced
this pull request
Aug 30, 2026
…rom Revit 2024 partition element records (#211) (#221) Closes #211. Explains and closes #216. `2024_Core_Interior.rvt` (sha256 `c805df44…`) against Revit's own full-project export `IFC Exports/2024_Core_Interior_slim.ifc` (sha256 `bfdf36ff…`), whose per-entity `Tag` carries the source ElementId. ## The rule #210 established that the Revit 2024 partition element-record header reaches **100 %** of the exported ElementIds in every architectural category. What was missing was precision. Two fields inside the 54 bytes #210 recorded as "0xff sentinel padding + three unattributed words" supply it: ```text +0x32 u64 container ElementId, 0xffff_ffff_ffff_ffff = none +0x42 u32 placement kind: 0xffffef7f placed instance 0xffff8000 family/type symbol envelope ``` > A record is a standalone placed instance — what Revit's exporter emits as a > building element — **iff** `u64 @ +0x32 == 0xFFFF_FFFF_FFFF_FFFF` **and** > `u32 @ +0x42 == 0xFFFF_EF7F`. `PartitionElementRecord::is_exported_instance`. Both halves are required; neither is sufficient alone. **This is not a re-opening of RE-19.** The carrier is the element record's own `BuiltInCategory` field, not the `ArcWallRectOpening` index and not a schema-field decode. Both RE-19 negatives stand and are still reported: `schema_field_wall_instances` still fires (its check now requires a wall whose body did *not* come from an element record, so an element-record wall cannot clear it by accident), and door/window **host binding** is still unsupported. ## Set-difference evidence Prologue bytes `+0x1a..+0x50`, exported vs not exported: | side | distinct patterns | shape | |---|---:|---| | exported | 1 per category | `ff`×40 then `7fefffff` `<w46>` `<w4a>` `ffffffff` | | container members | 9 owner values | `ff`×24 then **`<owner u64>`** then `ff`×8 then `7fefffff` … | | type symbols | 2 per category | `ff`×40 then **`0080ffff`** `<w46>` `<w4a>` `ffffffff` | Rules measured independently and together (ElementId sets, not counts): | category | A: `+0x32` unset | B: `+0x42` placed | **A ∧ B** | exported | |---|---:|---:|---:|---:| | `OST_Walls` (-2000011) | 361 (1 FP) | 1209 (849 FP) | **360 exact** | 360 | | `OST_Doors` (-2000023) | 147 (15 FP) | 185 (53 FP) | **132 exact** | 132 | | `OST_Windows` (-2000014) | 8 (2 FP) | 7 (1 FP) | **6 exact** | 6 | | `OST_Columns` (-2000100) | 273 (17 FP) | 375 (119 FP) | **256 exact** | 256 | Every non-sentinel `+0x32` value is a container ElementId: all nine are declared in `Global/ElemTable`, all are lower than every member id that names them, each owns a contiguous ElementId block spanning several categories at once, and none has an element record of its own (brute scan of all 23470 decodable records finds none). | owner | columns | walls | doors | windows | member range | |---:|---:|---:|---:|---:|---| | 16229 | 23 | 66 | 14 | 1 | 16347 – 16995 | | 21984 | 24 | 8 | – | – | 22008 – 22077 | | 23117 | 24 | 57 | 11 | – | 23134 – 23733 | | 26863 | 24 | 63 | 14 | – | 26880 – 28001 | | 26908 | – | 27 | – | – | 26993 – 27045 | | 33696 | 24 | 70 | 14 | – | 33748 – 34467 | | 81029 | – | 277 | – | – | 81041 – 87363 | | 87754 | – | 4 | – | – | 87758 – 87764 | | 108205 | – | 277 | – | – | 108216 – 114538 | Full write-up, histograms and reproduction commands: [`reports/element-framing/RE-21-partition-element-record-instance-rule.md`](reports/element-framing/RE-21-partition-element-record-instance-rule.md). ## Measured before → after `cargo build --profile ci --bin rvt-ifc && ./target/ci/rvt-ifc <rvt> -o /tmp/x.ifc --diagnostics /tmp/d.json` | decoder metric | before | after | export expects | manifest status | |---|---:|---:|---:|---| | `by_ifc_type.IFCWALL` | 0 | **360** | 360 | `known_gap` → **`known`**, tol 0 | | `by_ifc_type.IFCDOOR` | 0 | **132** | 132 | `known_gap` → **`known`**, tol 0 | | `by_ifc_type.IFCWINDOW` | 0 | **6** | 6 | `known_gap` → **`known`**, tol 0 | | `by_ifc_type.IFCCOLUMN` | 256 | 256 | 256 | `known` (rule replaced) | | `by_ifc_type.IFCSLAB` | 64 | 64 | 80 | `known_gap` (#212) | | `by_ifc_type.IFCSPACE` | 18 | 18 | 116 | `known_gap` | | `exported.material_count` | 102 | 102 | 10 | `known_gap` | | `step.IFCPROPERTYSET` | 320 | **818** | 0 | `known_gap` | | `step.IFCUNITASSIGNMENT` | 1 | 1 | 1 | `known` | | `exported.storey_count` | 11 | 11 | 15 | `decoder_baseline` | | `building_elements_with_geometry` | 256 | **754** | — | — | | `exported.storey_bound_elements` | 256 | **743** of 836 | — | — | | `step.IFCRELCONTAINEDINSPATIALSTRUCTURE` | 11 | 11 | — | — | ("before" = `main` at f4b88df, i.e. after #217.) Id-set check on the emitted IFC (not just counts): ``` IFCWALL: rvt-rs=360 export=360 exact=True missing=0 extra=0 IFCDOOR: rvt-rs=132 export=132 exact=True missing=0 extra=0 IFCWINDOW: rvt-rs=6 export=6 exact=True missing=0 extra=0 IFCCOLUMN: rvt-rs=256 export=256 exact=True missing=0 extra=0 ``` ## #216 falls out The 136 `OST_Columns` ids Revit omits split with no remainder: - **17 type symbols** (`+0x42 == 0xffff8000`) — ids 5755, 19250, 22374, 24299, 28008, 53894, 75407–75417, exactly the 17 #216 lists as family-local; - **119 container members** (`+0x32` set) — the blocks 16347–16369, 22045–22068, 23134–23157, 26880–26903, 33748–33771 that #216 identified as "exact co-locations of an exported column", each owned by the id allocated just before its block. So the #204 heuristic is **retired**: `partition_schema_mvp` no longer drops origin-centred family-local bounding boxes and no longer collapses co-located footprint groups to their highest `ElementId`. It applies the direct test, reproduces the same 256/256 columns, and additionally the wall / door / window id sets — which the heuristic could not (648 / 139 / 8). `is_family_local` is kept as a documented, strictly weaker diagnostic: the `+0x42` symbol set is a superset of it on every category, catching 15 door, 2 window and 1 wall symbols whose envelope is centred on only one axis (e.g. id 17331 spans `x −1.749…1.749` but `y −0.332…3.251`). ## What did not move `OST_Floors` stays `known_gap` (#212), measured not hand-waved: 124 distinct ids carry the category, 79 of the 80 exported slabs have a record at all, and the rule selects 99 (TP 79 / FP 20 / FN 1). `+0x42` is `0xffffef7f` on all 146 floor records — there are no slab type symbols on this file — so the rule degenerates to `+0x32` alone there. That needs a slab-appropriate identity key, not a looser tolerance. No tolerance was widened anywhere in this PR. ## Storey elevations — the #213 evidence base did not widen silently #217 derives storey elevations from element-record base `z`. Adding three categories to the record set would have widened that evidence base by accident, so the restriction is now measured, against the fifteen `IfcBuildingStorey.Elevation` values in the export: | category | distinct base elevations | equal to a storey | not a storey | |---|---:|---:|---| | `OST_Columns` | 11 | 11 | — | | `OST_Doors` | 11 | 11 | — | | `OST_Walls` | 13 | 12 (adds **−40 ft**) | 56.4167 | | `OST_Windows` | 6 | **0** | 80.73, 95.73, 110.73, 125.73, 140.73, 155.73 | A window sits at its sill height above the level that hosts it, so its record base is never a storey elevation; a wall may start mid-storey. Only `IFCCOLUMN` therefore *supplies* elevations (new `ifc::STOREY_ELEVATION_SOURCE_TYPES`), which keeps #213's measured "no false positives" claim exactly as recorded and `storey_count` at 11. Every record-bodied element still *binds* by exact match, so `IfcRelContainedInSpatialStructure` stays 11 while storey-bound elements go **256 → 743 of 836**: all 256 columns, all 132 doors, 355 of 360 walls. The 5 walls at −40 / 56.4167 ft and all 6 windows stay unbound rather than being placed by proximity. **Of the four export elevations #213 could not reach (−40, −20, 15, 185.5 ft), these categories surface exactly one: −40 ft, from wall records — and taking it costs one elevation that is not a storey.** That trade is left open rather than taken. The other three carry no record of any of the four categories. ## IFC4 attribute arity (#214) `tools/ci/ifc_schema_arity.py` on a fresh Core Interior export including the new walls/doors/windows: ``` IFC schema conformance passed schema: IFC4 instances checked: 15035 across 36 entity type(s) PredefinedType populated: IfcColumn=256, IfcSlab=64, IfcWall=360 ``` ## Verdicts ``` magnetar-2024-core-interior-slim: PASS — witnesses ifc-lite, ifcopenshell, rvt-rs surface: 8 fields, excluded: 5, diffs: 0 ``` surface `IFCWALL`, `IFCDOOR`, `IFCWINDOW`, `IFCCOLUMN`, `IFCROOF`, `IFCBEAM`, `IFCFLOWTERMINAL`, `IFCUNITASSIGNMENT` (was 5 fields / 8 excluded); `verdict_hash_sha256` `afa87bb0a4e35ea8e5fa9a1adb21b29f8a0ba532571c88fd00c14dabcd4c7145`. ``` magnetar-2024-core-interior: PASS — witnesses ifc-lite, ifcopenshell, rvt-rs surface: 4 fields, excluded: 8, diffs: 0 ``` `verdict_hash_sha256` `ae4679f6044a4c3caa0b2f3a6030648bc633b1d878957a759120f011f71ded5e`. Both `rvt-rs.json` observations were regenerated **after** merging `origin/main` at f4b88df (#217), so their `observation_hash_sha256` reflects both changes: `d88897c6d9b8223350a831f4caf48d76d469a4d4f47815da56da6d34e9364fb7`. ## Diagnostics vocabulary made precise Two composite `unsupported_features` were half-true after this change, so they were split into what is actually still missing: - `typed_door_window_discrimination_and_host_binding` now fires only when no typed door or window is exported at all. When they are exported but carry no host, the narrower **`door_window_host_wall_binding`** fires instead. - New **`revit_element_parameters_to_ifc_property_sets`** fires while every exported `IfcPropertySet` is rvt-rs provenance about a recovered body rather than a Revit element parameter (#35). The two manifest rows that previously borrowed the door/window feature name now use accurate ones. - `schema_field_wall_instances` keeps firing (see above). ## Docs `docs/status.md`, `docs/support-matrix.json` (`column-instance-recovery` → `element-record-instance-recovery`, still `verified`, scope restated for four categories; `typed-door-window` and `schema-field-wall` stay `unsupported` with their honesty invariants intact), `docs/verification-protocol.md` edges table + honesty note, `docs/supported-profile.md`, `README.md` (three surgical lines), `CHANGELOG.md`, and the new RE-21 report. ## Gates run `cargo fmt --all`, `cargo clippy --profile ci --all-targets -- -D warnings`, `RUSTDOCFLAGS="-D warnings" cargo doc --no-deps`, `cargo +1.85.0 check --all-targets` (MSRV 1.85, no let-chains), `tools/check-local.sh`, and the full `cargo test --profile ci` suite with `RVT_PROJECT_CORPUS_DIR` / `RVT_CORPUS_TIER1_DIR` — all green, including every tier-2 target from #209 (`elem_table_corpus`, `arc_wall_corpus`, `partition_scanner`, `iter_elements_typed`, `re15_geometry_invariants`, `re19_door_window_wall_negative`, `walker_to_ifc_integration`) plus `witness_verdict`, `witness_registry`, `project_count_fixtures`, `support_matrix`. `tests/iter_elements_typed.rs::core_interior_2024_rect_openings_not_fake_doors` now pins the exact counts **and** asserts every recovered Wall/Door/Window carries provenance `partition_schema_mvp::element_category_record`, so the RE-19 negative is enforced by mechanism, not by a zero. ## Merge with #217 `origin/main` at f4b88df was merged into this branch before the final measurement, so every number above is post-#217. The STEP emitter and `category_map` `predefined_type` values are untouched; the hunks in `src/ifc/mod.rs` are `unsupported_export_features`, the new `STOREY_ELEVATION_SOURCE_TYPES` restriction described above, one re-export line, and one `expect` message. ## Follow-ups - #212 slab instance identity — the rule does not hold there; the record bbox is also the obvious source for the unresolved extrusion thickness. - Door/window host-wall binding (`door_window_host_wall_binding`) — the record body past `+0xa8` was dumped but not yet mined for a host reference. - `docs/octetproof-spec.md` §6's worked verdict example is a two-lineage snapshot and was already stale before this PR (the committed verdict has three lineages); refreshing a published 1.0.0 artifact is a separate call. - `+0x46` / `+0x4a` remain unattributed; their values correlate with class, which may be a schema class-id join worth a look. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes core decode/IFC export and cross-witness gates for a corpus-proven Revit 2024 edge; scope is narrow but wrong instance filtering would skew real-project exports and CI verdicts. > > **Overview** > **Revit 2024 partition element records** now drive typed **Wall, Door, Window, and Column** recovery using a direct byte rule instead of the retired #204 column heuristic (family-local bbox drop + highest-`ElementId` per footprint). Records decode **container reference** at `+0x32` and **placement kind** at `+0x42`; `PartitionElementRecord::is_exported_instance` keeps only standalone placed instances. On Core Interior that matches Revit’s export **ElementId sets** at tolerance 0 (360/132/6/256), with bbox envelope geometry and shared `RvtElementRecordGeometry` property sets in IFC. > > **Production and verification** wire walls/doors/windows through `partition_schema_mvp::instances_from_partition_category_records`, unify element-record geometry in `export_content`, and narrow **storey elevation sourcing** to columns only (`STOREY_ELEVATION_SOURCE_TYPES`) while other record-bodied elements still **bind** storeys by exact base elevation (743/836 bound). OctetProof manifests move walls/doors/windows to **`known`** on the slim edge (8-field claimed surface); diagnostics split host binding vs discrimination and add `revit_element_parameters_to_ifc_property_sets`. RE-19/schema-field walls and door/window **host** binding stay explicitly unsupported; slabs (`OST_Floors`) remain #212 `known_gap`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit cb75c37. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
DrunkOnJava
added a commit
that referenced
this pull request
Aug 31, 2026
…lement records (#210) Recovers architectural column instances from `2024_Core_Interior.rvt` and closes the last measured gap on the full-project export that had no decoder path at all. ## How columns present in the bytes Revit 2024 project partitions frame each *element* record with a fixed prologue. Reading it on `2024_Core_Interior.rvt` (sha256 `c805df44…`, eight `Partitions/*` streams, ~190 MiB inflated): ```text +0x00 u64 ElementId of this record (declared in Global/ElemTable) +0x08 u32 record flags (0x00e1 / 0x0111 / 0x0131 / 0x0141 / …) +0x0c u32 0x0000059f on every observed record of this shape +0x10 u16 0 +0x12 i64 BuiltInCategory id, negative (OST_Columns = -2000100) +0x1a 54B 0xff sentinel padding + three unattributed words +0x50 8B bbox marker 46 01 ff ff ff ff ab 05 +0x58 48B bounding box: min x/y/z, max x/y/z, feet, f64 LE ``` 24880 records of this shape exist on that file. The marker sits at exactly `+0x50` on 23470 of them (94.3 %), which is why the offset is treated as fixed rather than searched, and **every** leading `u64` is an ElementId declared in `Global/ElemTable` — the decoder requires that join, so a stray byte match cannot become an element. `OST_Columns` alone is not an instance claim: 393 distinct ElementIds carry it. Two further steps, both structural rather than fitted: 1. **Family-local bboxes are type definitions, not placements.** A symbol's envelope is stored in family coordinates and is therefore centred on the plan origin (`min_x == -max_x`, `min_y == -max_y`). 17 of the 393 are like that — the `Column_Sqaure : 24" x 24"` symbol (id 5755) plus per-level variants. Dropped. 2. **Co-located pairs are a superseded generation and its replacement.** The remaining 375 collapse to 256 distinct project-coordinate footprint origins: 137 footprints hold one record, 119 hold exactly two. In every pair the two records differ only in top extent (e.g. `76.0 → 91.0` vs `76.0 → 90.33`, an 8-inch difference consistent with a column being attached to a slab after placement). Revit allocates ElementIds monotonically, so the higher id in each group is the live element. That yields 256 ids. They are not merely the right *count*: the emitted `IfcColumn.Tag` set is byte-for-byte the set of ElementIds in Revit's own export (`{int(c.Tag) for c in cols} == reference ids` → `True` under IfcOpenShell 0.8.5), and the placements agree — column 20375 lands at (24.0, 110.0, 76.0) ft, the centre of the 2 ft box whose min corner is the (23.0, 109.0, 76.0) the Revit exporter writes. ## What ships - `src/partition_element_records.rs` — the record decoder, version-gated to Revit 2024, fail-closed on the ElemTable join, the `+0x10` zero word, the BuiltInCategory band, the bbox marker, non-finite doubles and inverted boxes. - `partition_schema_mvp::columns_from_partition_category_records` — the three-step instance selection above, merged into production `iter_elements` as `class == "Column"`. `columns_from_records` is split out so the rule is unit-tested without a corpus file. - IFC export emits `IfcColumn` with a project placement and a bounding-box `IfcExtrudedAreaSolid`. This is an **envelope, not a recovered family profile**, and the `RvtColumnGeometry` property set says so (`ProfileResolved: false`, `LevelBindResolved: false`, `BodySource: partition_element_record_bbox`). Base/top Level ElementIds stay unbound (#86). ## Measured, before → after `./target/ci/rvt-ifc <rvt> -o /tmp/x.ifc --diagnostics /tmp/d.json`, `2024_Core_Interior.rvt`, every value re-measured on this branch (nothing estimated): | metric | before | after | |---|---:|---:| | `by_ifc_type.IFCCOLUMN` | 0 | **256** | | `by_ifc_type.IFCSLAB` | 64 | 64 | | `by_ifc_type.IFCSPACE` | 18 | 18 | | `by_ifc_type.IFCWALL` / `IFCDOOR` / `IFCWINDOW` / `IFCROOF` / `IFCBEAM` / `IFCFLOWTERMINAL` | 0 | 0 | | `storey_count` | 12 | 12 | | `material_count` | 102 | 102 | | `step.IFCUNITASSIGNMENT` | 1 | 1 | | `step.IFCPROPERTYSET` | 64 | **320** | | `building_elements` | 82 | 338 | | `building_elements_with_geometry` | 0 | **256** | `rvt-elements --counts` goes from `{ArcWallRectOpening 3777, Floor 64, Level 12, Material 102, Room 18}` (3973) to the same plus `Column 256` (4229). Export wall-clock on this machine: 13.1 s → 15.8 s. ## Manifests - `2024-core-interior-slim.json`: `columns` moves `known_gap` → **`known`**, `decoder_expected` 0 → 256, tolerance 0. `property_sets.decoder_expected` 64 → 320. `rooms_spaces.unsupported_feature` moves to the new `partial_element_geometry` code (see below). - `2024-core-interior.json` (the 20 KB element fixture): `columns` moves `known` → **`decoder_baseline`**, `decoder_expected` 0 → 256. That reference has no `IFCCOLUMN`, so scoring the count there would be wrong; it is scored against the full export in the sibling manifest. `property_sets.decoder_expected` 64 → 320. ## Verdicts Both regenerated and both `PASS`. **The observation hashes changed** (`research/witness/*/observations/rvt-rs.json`), so the umbrella mirror will need the new bytes after merge. ``` magnetar-2024-core-interior: PASS — witnesses ifc-lite, ifcopenshell, rvt-rs surface: 7 fields, excluded: 5, diffs: 0 magnetar-2024-core-interior-slim: PASS — witnesses ifc-lite, ifcopenshell, rvt-rs surface: 5 fields, excluded: 8, diffs: 0 ``` The slim claimed surface widens from four fields to five: `entity_counts.IFCCOLUMN` joins `IFCROOF`, `IFCBEAM`, `IFCFLOWTERMINAL` and `IFCUNITASSIGNMENT`. It is the first field in that surface with a non-zero expectation — the other four are agreements about absence. ## Diagnostics fix (second commit) `unsupported_features` carried `real_file_element_geometry` only while *no* exported element had a body, so the first category to gain geometry silently cleared the gap for every other one. It now reports `real_file_element_geometry` when nothing has a body and the new `partial_element_geometry` when some do and some do not. Documented in `docs/export-diagnostics.md`. ## Generalisation — deliberately not taken here The same header carries every other building category. Measured with the shipped decoder on the same file (`scan_category_records` + the same family-local drop and footprint de-duplication), against the ElementId set Revit's export tags: | category | records | ids carrying the category | recall of exported ids | after the instance filter | TP | FP | FN | |---|---:|---:|---:|---:|---:|---:|---:| | `OST_Columns` | 480 | 392 | **256 / 256** | 256 | 256 | 0 | 0 | | `OST_Walls` | 1488 | 1210 | 360 / 360 | 648 | 360 | 288 | 0 | | `OST_Doors` | 335 | 200 | 132 / 132 | 139 | 132 | 7 | 0 | | `OST_Windows` | 9 | 9 | 6 / 6 | 8 | 6 | 2 | 0 | | `OST_Floors` | 146 | 124 | 79 / 80 | 67 | 43 | 24 | 37 | | `OST_Rooms` | 399 | 277 | n/a | 169 | — | — | — | Category membership alone reaches every exported wall, door and window ElementId and all but one slab, which is a real result — but only columns survive the instance filter exactly, so **no other category's status moved** in this PR and the documented RE-19 / RE-20 negatives are untouched. (`IfcSpace` carries no ElementId tag in this export, so rooms cannot be scored by id at all.) Follow-up issues carry these numbers. ## Gate `cargo fmt --all -- --check`, `cargo clippy --all-targets -- -D warnings`, `cargo +1.85.0 check --all-targets` (MSRV, no let-chains), `tools/check-local.sh`, and the full suite (1127 tests) all green. With `RVT_PROJECT_CORPUS_DIR` set, the tier-two targets from #209's new CI step are green too: `elem_table_corpus`, `arc_wall_corpus`, `partition_scanner`, `iter_elements_typed`, `re15_geometry_invariants`, `re19_door_window_wall_negative`, `walker_to_ifc_integration`, plus `project_count_fixtures`, `witness_verdict`, `witness_registry`, `support_matrix`, `json_schema_contracts`. Branched from `main` and merged `origin/main` (e8ac9a1, #209) mid-flight; the ElemTable record-origin fix does not move any number here. Closes #204 ## Follow-ups filed - #211 — walls / doors / windows: category recall is 100 % (360/360, 132/132, 6/6) but the instance filter over-counts (648 / 139 / 8). RE-19 stands; this is a different mechanism, not a re-opening. - #212 — slabs: 79 of 80 ids carry the category, but footprint de-duplication is the wrong identity rule for plates (43 TP / 37 FN). Also the obvious source for `floor_slab_extrusion_thickness`. - #213 — bind columns to storeys via the record bbox base elevation; the 10 distinct base z values are themselves better elevation evidence than the current name strings. - #215 — recover the real column profile from the family-local symbol record instead of the instance envelope. - #216 — research: what the 137 non-exported `OST_Columns` elements actually are (17 family-local symbols, 119 exact co-locations of an exported column). Answering it would replace the highest-id heuristic with a direct test, and probably fixes #211 too. - #214 — pre-existing and unrelated to this change: the IFC4 writer omits the trailing `PredefinedType` attribute on every building element (`IFCSLAB` / `IFCSPACE` on `main` have the same shape), so the instances are non-conformant even though IfcOpenShell tolerates them.
DrunkOnJava
added a commit
that referenced
this pull request
Aug 31, 2026
…rom Revit 2024 partition element records (#211) (#221) Closes #211. Explains and closes #216. `2024_Core_Interior.rvt` (sha256 `c805df44…`) against Revit's own full-project export `IFC Exports/2024_Core_Interior_slim.ifc` (sha256 `bfdf36ff…`), whose per-entity `Tag` carries the source ElementId. ## The rule #210 established that the Revit 2024 partition element-record header reaches **100 %** of the exported ElementIds in every architectural category. What was missing was precision. Two fields inside the 54 bytes #210 recorded as "0xff sentinel padding + three unattributed words" supply it: ```text +0x32 u64 container ElementId, 0xffff_ffff_ffff_ffff = none +0x42 u32 placement kind: 0xffffef7f placed instance 0xffff8000 family/type symbol envelope ``` > A record is a standalone placed instance — what Revit's exporter emits as a > building element — **iff** `u64 @ +0x32 == 0xFFFF_FFFF_FFFF_FFFF` **and** > `u32 @ +0x42 == 0xFFFF_EF7F`. `PartitionElementRecord::is_exported_instance`. Both halves are required; neither is sufficient alone. **This is not a re-opening of RE-19.** The carrier is the element record's own `BuiltInCategory` field, not the `ArcWallRectOpening` index and not a schema-field decode. Both RE-19 negatives stand and are still reported: `schema_field_wall_instances` still fires (its check now requires a wall whose body did *not* come from an element record, so an element-record wall cannot clear it by accident), and door/window **host binding** is still unsupported. ## Set-difference evidence Prologue bytes `+0x1a..+0x50`, exported vs not exported: | side | distinct patterns | shape | |---|---:|---| | exported | 1 per category | `ff`×40 then `7fefffff` `<w46>` `<w4a>` `ffffffff` | | container members | 9 owner values | `ff`×24 then **`<owner u64>`** then `ff`×8 then `7fefffff` … | | type symbols | 2 per category | `ff`×40 then **`0080ffff`** `<w46>` `<w4a>` `ffffffff` | Rules measured independently and together (ElementId sets, not counts): | category | A: `+0x32` unset | B: `+0x42` placed | **A ∧ B** | exported | |---|---:|---:|---:|---:| | `OST_Walls` (-2000011) | 361 (1 FP) | 1209 (849 FP) | **360 exact** | 360 | | `OST_Doors` (-2000023) | 147 (15 FP) | 185 (53 FP) | **132 exact** | 132 | | `OST_Windows` (-2000014) | 8 (2 FP) | 7 (1 FP) | **6 exact** | 6 | | `OST_Columns` (-2000100) | 273 (17 FP) | 375 (119 FP) | **256 exact** | 256 | Every non-sentinel `+0x32` value is a container ElementId: all nine are declared in `Global/ElemTable`, all are lower than every member id that names them, each owns a contiguous ElementId block spanning several categories at once, and none has an element record of its own (brute scan of all 23470 decodable records finds none). | owner | columns | walls | doors | windows | member range | |---:|---:|---:|---:|---:|---| | 16229 | 23 | 66 | 14 | 1 | 16347 – 16995 | | 21984 | 24 | 8 | – | – | 22008 – 22077 | | 23117 | 24 | 57 | 11 | – | 23134 – 23733 | | 26863 | 24 | 63 | 14 | – | 26880 – 28001 | | 26908 | – | 27 | – | – | 26993 – 27045 | | 33696 | 24 | 70 | 14 | – | 33748 – 34467 | | 81029 | – | 277 | – | – | 81041 – 87363 | | 87754 | – | 4 | – | – | 87758 – 87764 | | 108205 | – | 277 | – | – | 108216 – 114538 | Full write-up, histograms and reproduction commands: [`reports/element-framing/RE-21-partition-element-record-instance-rule.md`](reports/element-framing/RE-21-partition-element-record-instance-rule.md). ## Measured before → after `cargo build --profile ci --bin rvt-ifc && ./target/ci/rvt-ifc <rvt> -o /tmp/x.ifc --diagnostics /tmp/d.json` | decoder metric | before | after | export expects | manifest status | |---|---:|---:|---:|---| | `by_ifc_type.IFCWALL` | 0 | **360** | 360 | `known_gap` → **`known`**, tol 0 | | `by_ifc_type.IFCDOOR` | 0 | **132** | 132 | `known_gap` → **`known`**, tol 0 | | `by_ifc_type.IFCWINDOW` | 0 | **6** | 6 | `known_gap` → **`known`**, tol 0 | | `by_ifc_type.IFCCOLUMN` | 256 | 256 | 256 | `known` (rule replaced) | | `by_ifc_type.IFCSLAB` | 64 | 64 | 80 | `known_gap` (#212) | | `by_ifc_type.IFCSPACE` | 18 | 18 | 116 | `known_gap` | | `exported.material_count` | 102 | 102 | 10 | `known_gap` | | `step.IFCPROPERTYSET` | 320 | **818** | 0 | `known_gap` | | `step.IFCUNITASSIGNMENT` | 1 | 1 | 1 | `known` | | `exported.storey_count` | 11 | 11 | 15 | `decoder_baseline` | | `building_elements_with_geometry` | 256 | **754** | — | — | | `exported.storey_bound_elements` | 256 | **743** of 836 | — | — | | `step.IFCRELCONTAINEDINSPATIALSTRUCTURE` | 11 | 11 | — | — | ("before" = `main` at 55491d7, i.e. after #217.) Id-set check on the emitted IFC (not just counts): ``` IFCWALL: rvt-rs=360 export=360 exact=True missing=0 extra=0 IFCDOOR: rvt-rs=132 export=132 exact=True missing=0 extra=0 IFCWINDOW: rvt-rs=6 export=6 exact=True missing=0 extra=0 IFCCOLUMN: rvt-rs=256 export=256 exact=True missing=0 extra=0 ``` ## #216 falls out The 136 `OST_Columns` ids Revit omits split with no remainder: - **17 type symbols** (`+0x42 == 0xffff8000`) — ids 5755, 19250, 22374, 24299, 28008, 53894, 75407–75417, exactly the 17 #216 lists as family-local; - **119 container members** (`+0x32` set) — the blocks 16347–16369, 22045–22068, 23134–23157, 26880–26903, 33748–33771 that #216 identified as "exact co-locations of an exported column", each owned by the id allocated just before its block. So the #204 heuristic is **retired**: `partition_schema_mvp` no longer drops origin-centred family-local bounding boxes and no longer collapses co-located footprint groups to their highest `ElementId`. It applies the direct test, reproduces the same 256/256 columns, and additionally the wall / door / window id sets — which the heuristic could not (648 / 139 / 8). `is_family_local` is kept as a documented, strictly weaker diagnostic: the `+0x42` symbol set is a superset of it on every category, catching 15 door, 2 window and 1 wall symbols whose envelope is centred on only one axis (e.g. id 17331 spans `x −1.749…1.749` but `y −0.332…3.251`). ## What did not move `OST_Floors` stays `known_gap` (#212), measured not hand-waved: 124 distinct ids carry the category, 79 of the 80 exported slabs have a record at all, and the rule selects 99 (TP 79 / FP 20 / FN 1). `+0x42` is `0xffffef7f` on all 146 floor records — there are no slab type symbols on this file — so the rule degenerates to `+0x32` alone there. That needs a slab-appropriate identity key, not a looser tolerance. No tolerance was widened anywhere in this PR. ## Storey elevations — the #213 evidence base did not widen silently #217 derives storey elevations from element-record base `z`. Adding three categories to the record set would have widened that evidence base by accident, so the restriction is now measured, against the fifteen `IfcBuildingStorey.Elevation` values in the export: | category | distinct base elevations | equal to a storey | not a storey | |---|---:|---:|---| | `OST_Columns` | 11 | 11 | — | | `OST_Doors` | 11 | 11 | — | | `OST_Walls` | 13 | 12 (adds **−40 ft**) | 56.4167 | | `OST_Windows` | 6 | **0** | 80.73, 95.73, 110.73, 125.73, 140.73, 155.73 | A window sits at its sill height above the level that hosts it, so its record base is never a storey elevation; a wall may start mid-storey. Only `IFCCOLUMN` therefore *supplies* elevations (new `ifc::STOREY_ELEVATION_SOURCE_TYPES`), which keeps #213's measured "no false positives" claim exactly as recorded and `storey_count` at 11. Every record-bodied element still *binds* by exact match, so `IfcRelContainedInSpatialStructure` stays 11 while storey-bound elements go **256 → 743 of 836**: all 256 columns, all 132 doors, 355 of 360 walls. The 5 walls at −40 / 56.4167 ft and all 6 windows stay unbound rather than being placed by proximity. **Of the four export elevations #213 could not reach (−40, −20, 15, 185.5 ft), these categories surface exactly one: −40 ft, from wall records — and taking it costs one elevation that is not a storey.** That trade is left open rather than taken. The other three carry no record of any of the four categories. ## IFC4 attribute arity (#214) `tools/ci/ifc_schema_arity.py` on a fresh Core Interior export including the new walls/doors/windows: ``` IFC schema conformance passed schema: IFC4 instances checked: 15035 across 36 entity type(s) PredefinedType populated: IfcColumn=256, IfcSlab=64, IfcWall=360 ``` ## Verdicts ``` magnetar-2024-core-interior-slim: PASS — witnesses ifc-lite, ifcopenshell, rvt-rs surface: 8 fields, excluded: 5, diffs: 0 ``` surface `IFCWALL`, `IFCDOOR`, `IFCWINDOW`, `IFCCOLUMN`, `IFCROOF`, `IFCBEAM`, `IFCFLOWTERMINAL`, `IFCUNITASSIGNMENT` (was 5 fields / 8 excluded); `verdict_hash_sha256` `afa87bb0a4e35ea8e5fa9a1adb21b29f8a0ba532571c88fd00c14dabcd4c7145`. ``` magnetar-2024-core-interior: PASS — witnesses ifc-lite, ifcopenshell, rvt-rs surface: 4 fields, excluded: 8, diffs: 0 ``` `verdict_hash_sha256` `ae4679f6044a4c3caa0b2f3a6030648bc633b1d878957a759120f011f71ded5e`. Both `rvt-rs.json` observations were regenerated **after** merging `origin/main` at 55491d7 (#217), so their `observation_hash_sha256` reflects both changes: `d88897c6d9b8223350a831f4caf48d76d469a4d4f47815da56da6d34e9364fb7`. ## Diagnostics vocabulary made precise Two composite `unsupported_features` were half-true after this change, so they were split into what is actually still missing: - `typed_door_window_discrimination_and_host_binding` now fires only when no typed door or window is exported at all. When they are exported but carry no host, the narrower **`door_window_host_wall_binding`** fires instead. - New **`revit_element_parameters_to_ifc_property_sets`** fires while every exported `IfcPropertySet` is rvt-rs provenance about a recovered body rather than a Revit element parameter (#35). The two manifest rows that previously borrowed the door/window feature name now use accurate ones. - `schema_field_wall_instances` keeps firing (see above). ## Docs `docs/status.md`, `docs/support-matrix.json` (`column-instance-recovery` → `element-record-instance-recovery`, still `verified`, scope restated for four categories; `typed-door-window` and `schema-field-wall` stay `unsupported` with their honesty invariants intact), `docs/verification-protocol.md` edges table + honesty note, `docs/supported-profile.md`, `README.md` (three surgical lines), `CHANGELOG.md`, and the new RE-21 report. ## Gates run `cargo fmt --all`, `cargo clippy --profile ci --all-targets -- -D warnings`, `RUSTDOCFLAGS="-D warnings" cargo doc --no-deps`, `cargo +1.85.0 check --all-targets` (MSRV 1.85, no let-chains), `tools/check-local.sh`, and the full `cargo test --profile ci` suite with `RVT_PROJECT_CORPUS_DIR` / `RVT_CORPUS_TIER1_DIR` — all green, including every tier-2 target from #209 (`elem_table_corpus`, `arc_wall_corpus`, `partition_scanner`, `iter_elements_typed`, `re15_geometry_invariants`, `re19_door_window_wall_negative`, `walker_to_ifc_integration`) plus `witness_verdict`, `witness_registry`, `project_count_fixtures`, `support_matrix`. `tests/iter_elements_typed.rs::core_interior_2024_rect_openings_not_fake_doors` now pins the exact counts **and** asserts every recovered Wall/Door/Window carries provenance `partition_schema_mvp::element_category_record`, so the RE-19 negative is enforced by mechanism, not by a zero. ## Merge with #217 `origin/main` at 55491d7 was merged into this branch before the final measurement, so every number above is post-#217. The STEP emitter and `category_map` `predefined_type` values are untouched; the hunks in `src/ifc/mod.rs` are `unsupported_export_features`, the new `STOREY_ELEVATION_SOURCE_TYPES` restriction described above, one re-export line, and one `expect` message. ## Follow-ups - #212 slab instance identity — the rule does not hold there; the record bbox is also the obvious source for the unresolved extrusion thickness. - Door/window host-wall binding (`door_window_host_wall_binding`) — the record body past `+0xa8` was dumped but not yet mined for a host reference. - `docs/octetproof-spec.md` §6's worked verdict example is a two-lineage snapshot and was already stale before this PR (the committed verdict has three lineages); refreshing a published 1.0.0 artifact is a separate call. - `+0x46` / `+0x4a` remain unattributed; their values correlate with class, which may be a schema class-id join worth a look. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes core decode/IFC export and cross-witness gates for a corpus-proven Revit 2024 edge; scope is narrow but wrong instance filtering would skew real-project exports and CI verdicts. > > **Overview** > **Revit 2024 partition element records** now drive typed **Wall, Door, Window, and Column** recovery using a direct byte rule instead of the retired #204 column heuristic (family-local bbox drop + highest-`ElementId` per footprint). Records decode **container reference** at `+0x32` and **placement kind** at `+0x42`; `PartitionElementRecord::is_exported_instance` keeps only standalone placed instances. On Core Interior that matches Revit’s export **ElementId sets** at tolerance 0 (360/132/6/256), with bbox envelope geometry and shared `RvtElementRecordGeometry` property sets in IFC. > > **Production and verification** wire walls/doors/windows through `partition_schema_mvp::instances_from_partition_category_records`, unify element-record geometry in `export_content`, and narrow **storey elevation sourcing** to columns only (`STOREY_ELEVATION_SOURCE_TYPES`) while other record-bodied elements still **bind** storeys by exact base elevation (743/836 bound). OctetProof manifests move walls/doors/windows to **`known`** on the slim edge (8-field claimed surface); diagnostics split host binding vs discrimination and add `revit_element_parameters_to_ifc_property_sets`. RE-19/schema-field walls and door/window **host** binding stay explicitly unsupported; slabs (`OST_Floors`) remain #212 `known_gap`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 2c9d2971d7e42cc2473d0da579485467340216c4. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Recovers architectural column instances from
2024_Core_Interior.rvtand closes the last measured gap on the full-project export that had no decoder path at all.How columns present in the bytes
Revit 2024 project partitions frame each element record with a fixed prologue. Reading it on
2024_Core_Interior.rvt(sha256c805df44…, eightPartitions/*streams, ~190 MiB inflated):24880 records of this shape exist on that file. The marker sits at exactly
+0x50on 23470 of them (94.3 %), which is why the offset is treated as fixed rather than searched, and every leadingu64is an ElementId declared inGlobal/ElemTable— the decoder requires that join, so a stray byte match cannot become an element.OST_Columnsalone is not an instance claim: 393 distinct ElementIds carry it. Two further steps, both structural rather than fitted:min_x == -max_x,min_y == -max_y). 17 of the 393 are like that — theColumn_Sqaure : 24" x 24"symbol (id 5755) plus per-level variants. Dropped.76.0 → 91.0vs76.0 → 90.33, an 8-inch difference consistent with a column being attached to a slab after placement). Revit allocates ElementIds monotonically, so the higher id in each group is the live element.That yields 256 ids. They are not merely the right count: the emitted
IfcColumn.Tagset is byte-for-byte the set of ElementIds in Revit's own export ({int(c.Tag) for c in cols} == reference ids→Trueunder IfcOpenShell 0.8.5), and the placements agree — column 20375 lands at (24.0, 110.0, 76.0) ft, the centre of the 2 ft box whose min corner is the (23.0, 109.0, 76.0) the Revit exporter writes.What ships
src/partition_element_records.rs— the record decoder, version-gated to Revit 2024, fail-closed on the ElemTable join, the+0x10zero word, the BuiltInCategory band, the bbox marker, non-finite doubles and inverted boxes.partition_schema_mvp::columns_from_partition_category_records— the three-step instance selection above, merged into productioniter_elementsasclass == "Column".columns_from_recordsis split out so the rule is unit-tested without a corpus file.IfcColumnwith a project placement and a bounding-boxIfcExtrudedAreaSolid. This is an envelope, not a recovered family profile, and theRvtColumnGeometryproperty set says so (ProfileResolved: false,LevelBindResolved: false,BodySource: partition_element_record_bbox). Base/top Level ElementIds stay unbound (RE-15-06: Partition names partial; Level ElementId bind blocked (RE-20) #86).Measured, before → after
./target/ci/rvt-ifc <rvt> -o /tmp/x.ifc --diagnostics /tmp/d.json,2024_Core_Interior.rvt, every value re-measured on this branch (nothing estimated):by_ifc_type.IFCCOLUMNby_ifc_type.IFCSLABby_ifc_type.IFCSPACEby_ifc_type.IFCWALL/IFCDOOR/IFCWINDOW/IFCROOF/IFCBEAM/IFCFLOWTERMINALstorey_countmaterial_countstep.IFCUNITASSIGNMENTstep.IFCPROPERTYSETbuilding_elementsbuilding_elements_with_geometryrvt-elements --countsgoes from{ArcWallRectOpening 3777, Floor 64, Level 12, Material 102, Room 18}(3973) to the same plusColumn 256(4229). Export wall-clock on this machine: 13.1 s → 15.8 s.Manifests
2024-core-interior-slim.json:columnsmovesknown_gap→known,decoder_expected0 → 256, tolerance 0.property_sets.decoder_expected64 → 320.rooms_spaces.unsupported_featuremoves to the newpartial_element_geometrycode (see below).2024-core-interior.json(the 20 KB element fixture):columnsmovesknown→decoder_baseline,decoder_expected0 → 256. That reference has noIFCCOLUMN, so scoring the count there would be wrong; it is scored against the full export in the sibling manifest.property_sets.decoder_expected64 → 320.Verdicts
Both regenerated and both
PASS. The observation hashes changed (research/witness/*/observations/rvt-rs.json), so the umbrella mirror will need the new bytes after merge.The slim claimed surface widens from four fields to five:
entity_counts.IFCCOLUMNjoinsIFCROOF,IFCBEAM,IFCFLOWTERMINALandIFCUNITASSIGNMENT. It is the first field in that surface with a non-zero expectation — the other four are agreements about absence.Diagnostics fix (second commit)
unsupported_featurescarriedreal_file_element_geometryonly while no exported element had a body, so the first category to gain geometry silently cleared the gap for every other one. It now reportsreal_file_element_geometrywhen nothing has a body and the newpartial_element_geometrywhen some do and some do not. Documented indocs/export-diagnostics.md.Generalisation — deliberately not taken here
The same header carries every other building category. Measured with the shipped decoder on the same file (
scan_category_records+ the same family-local drop and footprint de-duplication), against the ElementId set Revit's export tags:OST_ColumnsOST_WallsOST_DoorsOST_WindowsOST_FloorsOST_RoomsCategory membership alone reaches every exported wall, door and window ElementId and all but one slab, which is a real result — but only columns survive the instance filter exactly, so no other category's status moved in this PR and the documented RE-19 / RE-20 negatives are untouched. (
IfcSpacecarries no ElementId tag in this export, so rooms cannot be scored by id at all.) Follow-up issues carry these numbers.Gate
cargo fmt --all -- --check,cargo clippy --all-targets -- -D warnings,cargo +1.85.0 check --all-targets(MSRV, no let-chains),tools/check-local.sh, and the full suite (1127 tests) all green. WithRVT_PROJECT_CORPUS_DIRset, the tier-two targets from #209's new CI step are green too:elem_table_corpus,arc_wall_corpus,partition_scanner,iter_elements_typed,re15_geometry_invariants,re19_door_window_wall_negative,walker_to_ifc_integration, plusproject_count_fixtures,witness_verdict,witness_registry,support_matrix,json_schema_contracts.Branched from
mainand mergedorigin/main(bcc4e53, #209) mid-flight; the ElemTable record-origin fix does not move any number here.Closes #204
Follow-ups filed
floor_slab_extrusion_thickness.OST_Columnselements actually are (17 family-local symbols, 119 exact co-locations of an exported column). Answering it would replace the highest-id heuristic with a direct test, and probably fixes Partition element-record recovery for walls / doors / windows: recall is 100%, precision is not #211 too.PredefinedTypeattribute on every building element (IFCSLAB/IFCSPACEonmainhave the same shape), so the instances are non-conformant even though IfcOpenShell tolerates them.