Repository navigation
fix(ifc): write IfcBoolean as .T. / .F. - #312
Merged
Merged
Conversation
PropertyValue::Boolean rendered IFCBOOLEAN(.T) and IFCBOOLEAN(.F), missing the closing dot of an ISO 10303-21 enumeration, and its unit test pinned the malformed form. Every export with a boolean property was invalid IFC: IfcOpenShell's validator reported 2,400 errors on the Core Interior export, 9,349 on Snowdon, and nothing else. The committed fixtures carry no IfcBoolean, so the IfcOpenShell CI job never saw one. It now also runs ifcopenshell.validate and the schema arity check on the Einhoven and Core Interior exports; both report no issue with this fix.
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_47847ab8-812e-481e-9c56-a208fd1cb9f9) |
9 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Sep 23, 2026
… (RE-34) (#313) ## 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 - For each partition: first-prologue records are fixed at their `+0x00` id. A second-prologue placed instance (no container, placement `0xffffef7f`, RE-33) may take any declared id in its reference list after the leading slot. - The longest strictly rising chain is found **twice**, with ties resolved toward smaller and toward larger ids. A record gets an id only when **both agree**. - Ids named by ≥ 56 records across the file (Levels, types) are never candidates. - Floors, building pads and ceilings never get an id, because their list names their sketch at id − 1 (Snowdon floor 1423899 next to sketch 1423898). ## Measurements Hold-outs (every `+0x00` id hidden, then scored): | file | correct | wrong | |---|---:|---:| | 2024_Core_Interior | 3,458 | **0** | | Snowdon Towers Architectural (first-prologue records) | 445 | **0** | | RE1 Architecture / Mechanical / Plumbing | 41 / 7 / 36 | **0** | 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`: | file | exported before | after | not in Revit's export | |---|---:|---:|---:| | Snowdon Architectural (local) | 80 | 4,245 | 115 | | Snowdon Structural (local) | 26 | 60 | — | | RE1 Mechanical | 33 | 48 | 0 | | RE1 Plumbing | 9 | 39 | 0 | | RE1 Architecture / Core Interior | unchanged | unchanged | 0 | 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_order` provenance 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_ids` and `assign_second_prologue_ids` (the double chain) with `longest_rising_chain`; - `compute_second_prologue_ids`, `decode_frame_as` and `find_category_records_assigned`; - `SECOND_PROLOGUE_CONTEXT_REFERENCES` and `SKETCH_OWNING_CATEGORIES`; - the `PartitionElementRecord::id_from_reference_order` field; - the sweeps and the unattributed count use the assignment. - `src/reader.rs`: `RevitFile::second_prologue_ids` memo. - `src/partition_schema_mvp.rs`: `m_id_from_reference_order` field and provenance warning. - `tests/second_prologue_ids.rs` (Core hold-out, zero wrong), `examples/probe_re34_holdout.rs`, and `tests/element_records_2025.rs` (the RE1 MEP recall pins). - The report, a RE-30 §9 addendum, README, docs/status.md, docs/export-diagnostics.md, docs/support-matrix.json (new `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 - [x] `tools/check-local.sh --corpus --viewer` and `npm run test:browser` - [x] `cargo +1.85.0 check --profile ci --all-targets` and `cargo +nightly check --manifest-path fuzz/Cargo.toml` - [x] Browser viewer (ad hoc Playwright run, not committed): Snowdon Architectural (94.7 MB) loads in 18 s within wasm32 memory, showing "Geometry · 91%", 10 storeys, 4,185 elements with geometry and "Incomplete model · 684 model element records could not be exported", with no page error. Native peak RSS for its export is 1.77 GB, against 0.52 GB for Core Interior. - [x] Unit tests for the chain, the tie fail-closed case, non-instance frames, and assigned records decoding and dropping out of the unattributed count - [x] IfcOpenShell 0.8.5 `validate` on the Snowdon Architectural (84,077 instances), RE1 Mechanical and RE1 Plumbing exports of this branch (rebased on #312): no validation issues. `tools/ci/ifc_schema_arity.py` passes on them too. ## Audit-honesty checklist - [x] The 115 Snowdon elements Revit omits are stated everywhere the recall is, and the RE-33 claim is narrowed accordingly - [x] The threshold is a measured band, not a proof; the report says what lies outside it - [x] No emojis, private paths or PII. Snowdon was measured locally and is not committed. ## Legal and contribution hygiene - [x] Apache-2.0; public byte observations and prior RE reports only (`CLEANROOM.md`) ## Breaking changes `PartitionElementRecord` gains `id_from_reference_order` (serde default `false`). `element_record_without_element_id` counts 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.
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
PropertyValue::BooleanwroteIFCBOOLEAN(.T)/IFCBOOLEAN(.F), missing the closing dot of an ISO 10303-21 enumeration. Every export with a boolean property was invalid IFC. It now writes.T./.F., and CI validates real-project exports in full so this class of defect can't hide again.Motivation
Running
python -m ifcopenshell.validateon real exports turned up exactly one kind of error,An enumeration literal '' is not expected, on everyIfcBoolean:ThicknessResolved)ProfileResolved,LevelBindResolved, …)The unit test pinned the malformed form. The IfcOpenShell CI job validates only the committed synthetic fixtures, which carry no boolean, and the real-project step only counted entities. The project's own blog post (
docs/blog/2026-04-ifc4-exporter.md) documents the correctIFCBOOLEAN(.T.).Changes
src/ifc/entities.rs: the enumeration's closing dot, and the unit test..github/workflows/ci.yml("IfcOpenShell validates synthetic project"): a new step exports Core Interior and runsifcopenshell.validateplustools/ci/ifc_schema_arity.pyon it and on the Einhoven export. Both report no issue with this fix; validation of Core takes about 1.5 s.Testing
cargo test --lib entitiesifcopenshell.validate(0.8.5) on the Einhoven and Core Interior exports: "No validation issues found"tools/ci/ifc_schema_arity.pyon both: passes (593 and 26,438 instances)Breaking changes
None for readers that parse STEP correctly. A tool that matched the malformed
.F)text would need to match.F.).Related issues
None.
Note
Low Risk
Narrow writer formatting fix plus stronger CI validation; only consumers that matched the malformed
.F)literal would need to accept.F.).Overview
Boolean property values in IFC exports are now valid STEP.
PropertyValue::Booleanpreviously wroteIFCBOOLEAN(.T)/IFCBOOLEAN(.F), omitting the closing dot required by ISO 10303-21 enumerations, so every export with boolean properties failed IfcOpenShell validation. Emission is corrected toIFCBOOLEAN(.T.)/IFCBOOLEAN(.F.), with unit tests and comments updated to match.CI now full-schema-checks real exports that actually carry booleans. Synthetic fixtures have no
IfcBoolean, so the defect only showed up on large real projects (e.g. thousands of flags on Core Interior). The IfcOpenShell job adds a step that exports 2024_Core_Interior, runspython -m ifcopenshell.validateon both Einhoven and Core Interior outputs, and runsifc_schema_arity.pyon those files. CHANGELOG records the fix.Reviewed by Cursor Bugbot for commit bf550e2. Configure here.