Skip to content

feat(elements): leave out non-primary design options and export slab edges (#319) (RE-40) - #327

Merged
DrunkOnJava merged 1 commit into
mainfrom
feat/design-option-primary
Sep 23, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
feat/design-option-primary

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

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 as IfcBuildingElementProxy.

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_options reads 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 the u64 after the name as the primary.
    • DesignOptions::excludes and scan_non_primary_option_instances.
    • It fails closed: a set with no entry, or with entries that disagree, stays unresolved and keeps all its options.
    • Unit tests for the record list, the name entry, and the exclusion rule.
  • src/partition_element_records.rs:
    • DESIGN_OPTION_OFFSET and PartitionElementRecord::design_option;
    • OST_EDGE_SLAB in both category tables;
    • the volumeless count no longer includes non-primary-option elements.
  • src/partition_schema_mvp.rs: without_non_primary_options after 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 toward unexported_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.
  • Docs: a support-matrix row (experimental), README, status, CHANGELOG, docs/export-diagnostics.md and 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)

set name primary (VIM: <primary>)
1500723 Bandstand Options 1500724 "Twisty Trellis"
2059966 Bleacher Seating 2059970 "Middle Stair"
placed instances of recovered categories count in Revit's IFC4 export
in primary option 2059970 29 29
in non-primary options (2059967, 1500727) 27 0
export before after
elements not in Revit's export 118 100
slab edges (all in Revit's export) 0 59

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_data and modelo_bim all 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/ElemTable and a separate PR (RE-41).

Testing

  • tools/check-local.sh
  • Every integration test with the family corpus and the magnetar + RE1 project corpus (44 of 44 test binaries, including the new design_options)
  • cargo +1.85.0 check --profile ci --all-targets, cargo +nightly check --manifest-path fuzz/Cargo.toml (PartitionElementRecord gained a field)
  • Snowdon export scored against Revit's IFC4 export by Tag

Audit-honesty checklist

  • Status experimental: the positive evidence is one local file. CI pins only that licensed files read no design option.
  • The u32 1 before the set name is recorded, not interpreted. Non-default option export settings are not modelled.
  • No emojis, no private paths.

Legal and contribution hygiene

  • Apache-2.0
  • Clean-room: byte observations scored against Revit's own IFC export and the VIM export. BuiltInCategory names come from the public enum. No SDK source or decompiled material. Snowdon and the VIM are measured locally and not committed.
  • No PII

Breaking changes

PartitionElementRecord gains the public field design_option (serde default None). Code that builds the struct with a literal must set it. PRODUCT_RECORD_CATEGORIES and RECOVERED_CATEGORIES grow 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 as IfcBuildingElementProxy.

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(). PartitionElementRecord now exposes design_option at +0x2a; production scans apply without_non_primary_options so 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, not unexported_element_records). Docs, support matrix, probe probe_re40_design_options, and corpus test tests/design_options.rs document and pin the behavior.

Reviewed by Cursor Bugbot for commit d006ec5. Configure here.

@cursor

cursor Bot commented Sep 23, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@DrunkOnJava
DrunkOnJava merged commit 7578bfc into main Sep 23, 2026
23 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/design-option-primary branch September 23, 2026 06:30
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 -->
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.

Design options: frame slot +0x2a names the option; leave out non-primary options once the primary flag is found

1 participant