Repository navigation
feat(elements): leave out non-primary design options and export slab edges (#319) (RE-40) - #327
Merged
Merged
Conversation
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_a4d18639-1a4e-4a21-a189-3f095792a382) |
This was referenced Sep 23, 2026
DrunkOnJava
added a commit
that referenced
this pull request
Sep 23, 2026
…differ (RE-41) (#329) ## Summary A 40-byte `Global/ElemTable` record carries two ElementId-shaped `u32`s, at `+16` (`id_primary`) and `+36` (`id_secondary`), and rvt-rs declared only the first. Where the two differ, the second is the element's ElementId: the id of its partition record (RE-35) and the `Tag` Revit's own IFC export writes. `elem_table::declared_ids` now declares both, and every production path uses it. On Snowdon Towers Architectural the 37 element records that were left unattributed now export, all of them elements Revit's export holds. ## Motivation Found while measuring RE-40 (#327): the 33 elements of the primary design option on Snowdon are in Revit's export but were counted as `element_record_without_element_id`. Their chain records' ids were not declared, because the ElemTable holds them at `+36`, not `+16`. ## Changes - `src/elem_table.rs`: - `declared_ids(&[ElemRecord])` returns every `id_primary`, plus `id_secondary` on 40-byte records when it is non-zero, so nothing declared before is dropped; - `RECORD_LEN_40`; - `declared_element_ids` uses it; - the `id_secondary` doc and a unit test. - The 13 production call sites that built the set as `map(|r| r.id_primary)` now call it: `partition_element_records` (2), `partition_schema_mvp` (8), `partition_level_records`, `partition_names`, `partition_design_options`. `rvt-elem-table` uses it for its owner statistics. - `examples/probe_re41_elem_table_secondary_ids.rs` (new). `probe_re40_design_options` uses the new set. - `reports/element-framing/RE-41-elem-table-secondary-ids.md`, a support-matrix row (`experimental`), README, status, CHANGELOG, `docs/export-diagnostics.md`, the ElemTable layout doc, a reconnaissance addendum, and cross-references in RE-35 and RE-40. ## Measurements `probe_re41_elem_table_secondary_ids`: | file | records | ids differ | chain ids not `id_primary` | not `id_secondary` | |---|---:|---:|---:|---:| | Snowdon Architectural (2024, local) | 47,233 | 84 | 85 | 1 | | Snowdon Structural (2024, local) | 16,571 | 27 | 20 | 0 | | Core Interior, RE1 x4, `teste_export_2025`, Projeto1 | – | 0 | same | same | The 2016 to 2023 projects (28-byte layout) have no record whose ids differ. Each family file has exactly one, record 18, and a `0` there is not added. Of the 84 architectural records whose ids differ, 39 have their `id_secondary` as a `Tag` in Revit's IFC4 export (17 proxies, 16 walls, 4 columns, 2 column types), and none has its `id_primary` as one. Snowdon Architectural against Revit's IFC4 export: | | before (main) | after | |---|---:|---:| | exported elements | 6,007 | 6,044 | | in Revit's export | 5,907 | 5,944 | | Revit's elements of an exported entity that rvt-rs misses | 38 | 1 (a stair run with no readable frame) | | `element_record_without_element_id` | 37 | absent | | `confidence.unexported_element_records` / score | 37 / below 1 | 0 / 1.0 | Snowdon Structural gains one floor (670566), which the VIM export also holds. Core Interior, RE1 Architecture and RE1 Electrical export byte-identically apart from the header and owner-history timestamps, so the committed witness observations do not change. ## Testing - [x] `tools/check-local.sh` - [x] Every integration test with the family corpus and the magnetar + RE1 project corpus - [x] `cargo +1.85.0 check --profile ci --all-targets`, `cargo +nightly check --manifest-path fuzz/Cargo.toml` - [x] Snowdon Architectural and Structural exports scored against Revit's IFC4 export and the VIM ## Audit-honesty checklist - [x] Status `experimental`: the positive evidence is local. No licensed file has a differing record. - [x] What `id_primary` holds where the two differ is stated as unknown. The chain ids that neither id covers on Core Interior and RE1 Electrical are unchanged and stated. - [x] No emojis, no private paths. ## Legal and contribution hygiene - [x] Apache-2.0 - [x] Clean-room: byte observations scored against Revit's own IFC export and the VIM export. No SDK source or decompiled material. Snowdon and the VIM are measured locally and not committed. - [x] No PII ## Breaking changes `elem_table::declared_element_ids` can return more ids than before, on files where the two ids differ. No signature changes. ## Related issues Follows RE-40 (#327). Refs #309, #295. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Widens the declared ElementId set used across all partition element export paths; behavior is unchanged on most files but can add elements on models where primary and secondary ids diverge. > > **Overview** > **RE-41** fixes element attribution when a 40-byte `Global/ElemTable` row’s two `u32` ids at `+16` and `+36` disagree: rvt-rs used only `id_primary`, but on Snowdon (and similar) **`id_secondary` is the partition ElementId / IFC `Tag` Revit exports**. > > The change adds **`elem_table::declared_ids`**, which keeps every `id_primary` and also adds non-zero `id_secondary` on 40-byte records. **`declared_element_ids`**, partition scanning, design-option probes, and **`rvt-elem-table`** all use that set instead of mapping `id_primary` alone. > > On **Snowdon Towers Architectural**, 37 previously unattributed walls/columns/generic models now export (6,044 vs 6,007 elements; **`element_record_without_element_id` gone**). Structural gains one floor. **CI-licensed corpora** with no differing ids stay byte-identical aside from timestamps. > > Docs add RE-41 report/probe, support-matrix row, and updated export-diagnostics and status counts. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 82d3ff4. 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
A design option set's name entry closes with the ElementId of the set's primary option. The exporter now leaves out elements in a set's other options, as Revit's own IFC export does by default, and reports them as the skipped item
element_record_in_non_primary_design_option. Slab edges (OST_EdgeSlab), which RE-37 held back for this reason, now export asIfcBuildingElementProxy.Motivation
Closes #319. RE-35 §5 found that an element record holds its design option at
+0x2a, and that Revit's export omits every non-primary option, but the primary flag was not in the option or option-set records.Changes
src/partition_design_options.rs(new):compute_design_optionsreads each set's option list from its chain record (OST_DesignOptionSets, list at+0x56), finds the set's name entry with that exact list, and takes theu64after the name as the primary.DesignOptions::excludesandscan_non_primary_option_instances.src/partition_element_records.rs:DESIGN_OPTION_OFFSETandPartitionElementRecord::design_option;OST_EDGE_SLABin both category tables;src/partition_schema_mvp.rs:without_non_primary_optionsafter each of the six production scans. The scan functions themselves stay raw.src/reader.rs:RevitFile::design_options()(memoised).src/ifc/mod.rs: the new skipped item. It does not count towardunexported_element_records.src/ifc/category_map.rs:SlabEdge→IFCBUILDINGELEMENTPROXY.examples/probe_re40_design_options.rs,tests/design_options.rs(the licensed files read no design option),reports/element-framing/RE-40-design-option-primary.md.experimental), README, status, CHANGELOG,docs/export-diagnostics.mdand its schema description, a reconnaissance addendum, and RE-35 / RE-37 cross-references. README and status now give the current Snowdon totals: 6,007 exported, 5,907 in Revit's export.Measurements (Snowdon Towers Architectural, local only)
<primary>)The 18 removed are exactly RE-35 §5's bleacher slabs and walls plus the generic model in "Simple Dome". No element Revit's export holds was removed. The remaining 100 are the #309 type omissions and 6 slabs with no option.
No other corpus file has a design option: Snowdon Structural, Core Interior, the four RE1 models, Einhoven,
teste_export_2025, Projeto1,Exemplo_dataandmodelo_bimall resolve no set and export unchanged.While measuring, the 33 elements of the primary option 1500724 turned out to be exported by Revit but not attributed by rvt-rs. That has a separate cause in
Global/ElemTableand a separate PR (RE-41).Testing
tools/check-local.shdesign_options)cargo +1.85.0 check --profile ci --all-targets,cargo +nightly check --manifest-path fuzz/Cargo.toml(PartitionElementRecordgained a field)TagAudit-honesty checklist
experimental: the positive evidence is one local file. CI pins only that licensed files read no design option.u32 1before the set name is recorded, not interpreted. Non-default option export settings are not modelled.Legal and contribution hygiene
Breaking changes
PartitionElementRecordgains the public fielddesign_option(serde defaultNone). Code that builds the struct with a literal must set it.PRODUCT_RECORD_CATEGORIESandRECOVERED_CATEGORIESgrow by one entry.Related issues
Closes #319. Refs #309, RE-35 §5, RE-37 §3.
Note
Medium Risk
Changes which real-project elements are exported and adds a new public field on PartitionElementRecord; behavior is gated on partition parsing but affects IFC output fidelity on models with design options.
Overview
RE-40 (#319) aligns IFC export with Revit’s default design-option behavior: elements in non-primary options are dropped, and slab edges (
OST_EdgeSlab) are exported asIfcBuildingElementProxy.The exporter reads each design option set’s primary option from the set’s partition name entry (option list + trailing ElementId), memoized on
RevitFile::design_options().PartitionElementRecordnow exposesdesign_optionat+0x2a; production scans applywithout_non_primary_optionsso only main-model and primary-option instances are emitted. Unresolved sets (missing or conflicting name entries) fail closed and keep all options.Diagnostics add skipped reason
element_record_in_non_primary_design_option(intentional omission, notunexported_element_records). Docs, support matrix, probeprobe_re40_design_options, and corpus testtests/design_options.rsdocument and pin the behavior.Reviewed by Cursor Bugbot for commit d006ec5. Configure here.