Repository navigation
feat(elements): infer second-prologue ElementIds from reference order (RE-34) - #313
Merged
Merged
Conversation
… (RE-34) A second-prologue element record (RE-30) carries no ElementId at +0x00, but its own id is one slot of its reference list, and records sit in each partition in ascending ElementId order. assign_second_prologue_ids finds the longest strictly rising chain through a partition twice, with ties resolved toward smaller and toward larger ids, and gives a placed instance an id only when both agree, so the id is forced by the order. Ids named by 56 or more records across the file (Levels, types) are never candidates, and floors, building pads and ceilings never get an id, because their lists name their sketch one id earlier. Hidden-id hold-outs make no wrong pick: 3,458 correct on Core Interior, 445 on Snowdon, 41, 7 and 36 on the RE1 models; zero wrong holds for context thresholds 48 to 64. Snowdon Towers Architectural now exports 4,245 elements instead of 80 (readiness 36% -> 91%); 4,077 of its tagged elements are in Revit's export and the other 115 are real elements Revit's export omits (#309). The RE1 MEP models gain their ducts, pipes and fittings, all in Revit's export. Core Interior, which has no such records, exports byte-identically. The result is memoised as RevitFile::second_prologue_ids and used by the element-record sweeps and the unattributed count. Assigned elements carry an element_id_from_reference_order provenance warning and an m_id_from_reference_order field. tests/second_prologue_ids.rs holds the Core hold-out at zero wrong; examples/probe_re34_holdout.rs runs it on any file.
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_b75fd5b4-4344-4190-94b3-4b3564a1eea2) |
3 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Sep 23, 2026
…t (RE-34) (#314) ## Summary An element whose `Tag` RE-34 inferred from its record's reference list and the frame order now says so in the IFC: `ElementIdSource = 'reference_order'` in its `RvtElementRecordGeometry` property set. The viewer's support-profile panel now describes what RE-34 leaves out. ## Motivation #313 records the inference on the decoded element (field and provenance warning), but the IFC, which is what users take away, did not carry it. On Snowdon Towers Architectural that covers 4,142 exported elements. A consumer, and the viewer's element info panel, can now tell an inferred id from one read off the record. Records that carry their id write nothing new. ## Changes - `src/ifc/export_content.rs`: `ELEMENT_ID_SOURCE_PROPERTY` / `ELEMENT_ID_FROM_REFERENCE_ORDER`, written when the decoded element has `m_id_from_reference_order`, plus a unit test covering one inferred and one read id. - `viewer/index.html` ("Not ready"): records whose ElementId neither the record nor the record order gives, and elements Revit's export filters out (#309), replace the old "records with no ElementId". - CHANGELOG. ## Testing - [x] `tools/check-local.sh` - [x] Snowdon Architectural export: 4,142 `ElementIdSource` properties; `ifcopenshell.validate` reports no issue - [x] 2024_Core_Interior export byte-identical to main apart from the header timestamp ## Breaking changes None. ## Related issues Refs #295, #309. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Additive IFC metadata and viewer copy only; no change to id assignment logic or exports where ids are read from records. > > **Overview** > **RE-34 inferred ElementIds are now labeled in exported IFC.** When an element’s `Tag` was assigned from reference-list / frame-order inference rather than read from the record, the exporter adds `ElementIdSource = 'reference_order'` on `RvtElementRecordGeometry`. Records with a native id omit the property (Core Interior stays unchanged aside from header timestamps). > > New constants and export logic live in `export_content.rs`, with a unit test covering one inferred and one read id. The viewer **Supported profile** “Not ready” copy is updated to describe ids that neither the record nor order resolve (e.g. second-layout floors) and elements Revit’s export omits but rvt-rs still exports. **CHANGELOG** documents the addition. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 7528906. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This was referenced Sep 23, 2026
DrunkOnJava
added a commit
that referenced
this pull request
Sep 23, 2026
… does (#309) (#316) ## Summary Placed element-record instances whose bounding box has no volume (2D symbol families) are left out of the export, as Revit's own IFC export leaves them out. The sidecar reports them as `element_record_without_volume`. This cuts the Snowdon elements outside Revit's export from 115 to 55. ## Motivation #309 tracks elements rvt-rs exports that Revit's export omits. After RE-34 (#313) that was 115 on Snowdon Towers. They follow their **type**: eight type ids that no exported element names cover 111 of them. Three of those types sit next to the strings "Floor Drain-2D", "ADA Clear Space" and "Wheel Chair Circle", which are 2D symbol families with no 3D body. The byte signature is exact: | category | omitted, bbox flat on an axis | exported by Revit, bbox flat | |---|---|---| | Specialty equipment | 45 / 45 | 0 / 211 | | Plumbing fixtures | 15 / 15 | 0 / 130 | | all other categories | – | 0 | | Core Interior, RE1 Architecture / Mechanical / Plumbing, Snowdon Structural | – | 0 (no flat instance at all) | ## Changes - `src/partition_element_records.rs`: - `VOLUME_EPSILON_FEET` and `PartitionElementRecord::has_volume`; - `scan_volumeless_instances`, which counts by class once per ElementId; - flat second-prologue frames no longer count as unattributed. - `src/partition_schema_mvp.rs`: `select_instance_records` skips instances without volume. Sketch lines take their own path and are unaffected. - `src/ifc/mod.rs`: the `element_record_without_volume` skipped item. It is not counted toward `unexported_element_records`, because these are omitted by design, not missing. - Docs: README, docs/status.md, docs/export-diagnostics.md, the schema's reason description, docs/support-matrix.json (Snowdon now 4,185 exported, 55 outside Revit's export), a RE-34 report §8 addendum, and CHANGELOG. ## Testing - [x] `tools/check-local.sh --corpus` - [x] Unit test: a flat and a solid instance, decoded and counted - [x] Snowdon Architectural: 4,185 exported; 4,077 of 4,132 tagged in Revit's export; `element_record_without_volume` = 60 (45 + 15); `unexported_element_records` unchanged at 684 - [x] Core Interior: IFC byte-identical apart from the header timestamp ## Breaking changes None. The skipped item is additive. ## Related issues Refs #309 (the 47 curtain panels, 7 walls and 1 slab remain; the panel types include the system "Empty" panel). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Export filtering and additive diagnostics only; Core Interior IFC stays byte-identical aside from header timestamp per PR testing. > > **Overview** > Placed partition element-record instances whose bounding box is flat on any axis (2D symbol families such as floor drains and ADA clearance graphics) are **no longer exported**, aligning rvt-rs with Revit’s IFC behavior (#309). > > **Export path:** `PartitionElementRecord::has_volume()` (with `VOLUME_EPSILON_FEET`) gates instance selection in `select_instance_records` and unattributed-frame counting; flat second-prologue frames are not treated as missing ElementIds. > > **Diagnostics:** IFC export diagnostics add a `skipped` bucket `element_record_without_volume` (via `scan_volumeless_instances`), documented in the export-diagnostics schema and user docs. These omissions are intentional and do **not** feed `unexported_element_records`. > > **Measured impact:** On Snowdon Towers Architectural, export drops from 4,245 to **4,185** elements; elements outside Revit’s export fall from **115 to 55** (60 volumeless instances). Docs, support matrix, and CHANGELOG are updated accordingly. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4ad86fa. 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.
Summary
Records in the second element-record prologue (RE-30) now get their ElementId from the reference list and the frame order. The id is taken only when the ordering forces it. Hidden-id hold-outs on five files make no wrong pick, and Autodesk's Snowdon Towers architectural sample goes from 80 exported elements to 4,245.
Motivation
On Snowdon (and on parts of the RE1 MEP models) most records carry no ElementId at
+0x00, so the fail-closed decode dropped them. RE-30 found the id is one slot of the record's reference list (§7) and that records sit in ascending ElementId order (§8). The one-sided chain it tried made 32 wrong picks, so nothing shipped (#295). Full report:reports/element-framing/RE-34-second-prologue-element-ids.md.The rule
+0x00id. A second-prologue placed instance (no container, placement0xffffef7f, RE-33) may take any declared id in its reference list after the leading slot.Measurements
Hold-outs (every
+0x00id hidden, then scored):Zero wrong holds for context thresholds 48 to 64 (56 is the middle of that band). Without the filter, the Core hold-out made 6 wrong picks, each a Level or type id named by 66 to 260 records; no true own id is named by more than 34.
End to end against Revit's exports, by
Tag:The 115 on Snowdon were checked one by one. They are 45 specialty-equipment items, 47 panels and 15 fixtures whose reference lists hold no exported element of that type, 7 bleacher-seating walls, and the #309 slab. All are real elements Revit's exporter leaves out, the same limitation the first-prologue path already has (#309), and none is a wrong id for an exported element. Each carries an
element_id_from_reference_orderprovenance warning.Readiness on Snowdon rises from 36% to 91%, and the unattributed count drops from 4,886 to 684. Core Interior's IFC body is byte-identical and its export time unchanged (2.75 s).
Changes
src/partition_element_records.rs:framed_elements,context_element_idsandassign_second_prologue_ids(the double chain) withlongest_rising_chain;compute_second_prologue_ids,decode_frame_asandfind_category_records_assigned;SECOND_PROLOGUE_CONTEXT_REFERENCESandSKETCH_OWNING_CATEGORIES;PartitionElementRecord::id_from_reference_orderfield;src/reader.rs:RevitFile::second_prologue_idsmemo.src/partition_schema_mvp.rs:m_id_from_reference_orderfield and provenance warning.tests/second_prologue_ids.rs(Core hold-out, zero wrong),examples/probe_re34_holdout.rs, andtests/element_records_2025.rs(the RE1 MEP recall pins).element-records-second-prologue-ids, partial; RE-33 row corrected), and CHANGELOG. RE-33's "zero false positives on four files" now reads correctly as holding for records carrying their id at+0x00.Testing
tools/check-local.sh --corpus --viewerandnpm run test:browsercargo +1.85.0 check --profile ci --all-targetsandcargo +nightly check --manifest-path fuzz/Cargo.tomlvalidateon the Snowdon Architectural (84,077 instances), RE1 Mechanical and RE1 Plumbing exports of this branch (rebased on fix(ifc): write IfcBoolean as .T. / .F. #312): no validation issues.tools/ci/ifc_schema_arity.pypasses on them too.Audit-honesty checklist
Legal and contribution hygiene
CLEANROOM.md)Breaking changes
PartitionElementRecordgainsid_from_reference_order(serde defaultfalse).element_record_without_element_idcounts fall on files with second-prologue records, because assigned records are exported instead.Related issues
Refs #295 (resolved for all but sketch-owning categories), #309, #94, #95.