Repository navigation
fix(ifc): write Reference only in the sets a Revit export confirms (#1016) (RE-239) - #1120
Merged
Merged
Conversation
Merged
3 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Oct 30, 2026
…lement (#1097) (RE-263) (#1119) ## Summary `Pset_BuildingCommon.NumberOfStoreys` is now written only where every storey rvt-rs exports contains an element, where Revit's exporters before IFC 26.1 (storeys that contain an element) and since (every storey) give the same number. Elsewhere it is left out, and the census's count-apart for it (#1098) is removed. The maintainer's decision, 2026-10-29: strict, as for every other value. ## Motivation #1097, RE-263. A `.rvt` does not say which exporter will export it, so where the two rules disagree any number rvt-rs writes is wrong for one of them. #1098 had kept IFC4's count and relabelled the disagreement in the scorer instead of narrowing the value. ## Changes - `src/ifc/step_writer.rs`: the writer's containment rules (elements in spaces, aggregate parts, folded body pieces) become functions it calls, and `every_storey_holds_an_element` uses the same rules; the building set drops `NumberOfStoreys` where it is false. - `src/ifc/mod.rs`: the diagnostics' `Pset_` value count follows (`tests/parameter_diagnostics.rs`). - `tools/re/psets_vs_ifc.py`: #1098's count-apart removed. - `tests/spatial_property_sets.rs`: RE1's building set is expected without `NumberOfStoreys` where a storey of Revit's export holds no element. - `research/witness/...core-interior*/observations/rvt-rs.json`: `IFCPROPERTYSINGLEVALUE` 29,082 to 29,081 (after #1120), copied from this PR's CI artifact; both verdicts replay PASS, verdict files unchanged. - RE-263 §5 and §6, `changelog.d/changed/number-of-storeys-unambiguous.md`, `changelog.d/research/number-of-storeys.md`. ## Testing Measure [40985981272](https://github.com/DrunkOnJava/rvt-rs/actions/runs/40985981272), against main at b31c3f4, every model and scorer: | `NumberOfStoreys` over 30 models | before | after | |---|---:|---:| | equal | 7 | 1 | | different | 23 | 0 | | missing | 0 | 29 | Kept on R2025 `01_Walls` only. The BIM4LCA office loses its two equal values: Revit's export contains an element in all 10 storeys, rvt-rs's in fewer, so rvt-rs cannot rule out the older exporter's count. Every other census value and every other scorer output (1,198 files) is unchanged. Unit tests: none (banned). ## Audit-honesty checklist - [x] RE-263 and the changelog state the rule and what it loses - [x] No private paths, emojis or jargon ## Legal and contribution hygiene - [x] Apache-2.0; revit-ifc read and cited only (RE-263 §2) ## Breaking changes None. ## Related issues Refs #1097, #1016.
DrunkOnJava
added a commit
that referenced
this pull request
Nov 11, 2026
…viceCommon.Reference (#1016) (#1763) ## Summary `Pset_ShadingDeviceCommon` joins `CONFIRMED_REFERENCE_SETS` in `src/ifc/export_content.rs`, so a shading device now carries its type's name as `Pset_ShadingDeviceCommon.Reference`, the set Revit's own IFC4 export writes it in. This is the smallest change that lets the next measurement score the value: the counts prove Revit writes 44 of them, and the equality of rvt-rs's value to Revit's is what that measurement decides. `IsExternal` is deliberately not written; see "What was not checked". ## Evidence **What the timber office's census says** (`evidence/nordic-office-timber-as-built/psets_vs_ifc.txt`): - `Pset_ShadingDeviceCommon.Reference: 44, equal 0, different 0, missing 44`, and the value census reads `('IfcIdentifier', 'JSV-1') x44; on IfcShadingDevice x44`. So Revit writes the property on every `IfcShadingDevice` it holds and on no other entity, and every value is the same string, `JSV-1`. - `Pset_ShadingDeviceCommon.IsExternal: 45, ... missing 45`, `('IfcBoolean', True) x45; on IfcShadingDevice x44, IfcShadingDeviceType x1`. - `Pset_ShadingDeviceCommon.Roughness: 1, ... missing 1` (one value, on the type). **The elements are the same elements.** `class_sets_vs_ifc.txt` reads `IfcShadingDevice 44 44 0 0`: Revit's export holds 44 and rvt-rs writes 44, none extra, none missing. `names_vs_ifc.txt` reads `44 system family | IfcShadingDevice | Name equal | ObjectType equal`. **How `Reference` is derived for a confirmed set.** `reference_set_kinds` (`export_content.rs:2499`) takes every IFC4 standard set that `applies_to` the entity and predefined type, keeps the ones in `CONFIRMED_REFERENCE_SETS`, and `reference_property_sets` writes the element's type name into each as `Reference`. The type name is `family_and_type`'s second field (`export_content.rs:1040-1044`), the same value every other confirmed set already carries. `Pset_ShadingDeviceCommon` applies to `IFCSHADINGDEVICE` with no predefined-type scope (`standard_property_sets/table.rs:3681-3700`), and declares `Reference` as `Identifier`, so the existing machinery writes it with no other change. **Why the value is likely Revit's, and why that is still a measurement.** `type_objects_vs_ifc.txt` reads `TypeName carried: 10518 of 10518; equal to Revit's type: 10518`, and `ObjectType` (which `step_writer.rs:3240-3248` writes as `Family:Type`) is equal to Revit's on all 44 shading devices. So the type name rvt-rs reads for these 44 is Revit's type name, and `JSV-1` is a type name of this project (its wall sweeps are `JSV-4`, `JSV-5`, `JSV-6` in `mesh_bodies_vs_ifc.txt`). What is **not** measured is that Revit's `Reference` is that type name on these elements: the timber office's IFC files are not in the evidence, so the 44 values' equality to rvt-rs's rule is unmeasured. The set is added on the strength of the counts, and the next measurement decides whether it stays. **What the rule leaves out.** Nothing on the element side: Revit writes the property on all 44 `IfcShadingDevice` and on no other entity, and rvt-rs writes the same 44. rvt-rs still writes nothing where it reads no type name for the element, which is a missing value, not a wrong one. The set is written on no type object, as Revit writes no `Reference` on the `IfcShadingDeviceType`. **History.** `CONFIRMED_REFERENCE_SETS` was introduced by #1120 (RE-239 §7) with the rule "a set joins the list when a reference export confirms it". `Pset_ShadingDeviceCommon` was removed on 2026-10-29 because no IFC4 export then held a shading device (RE-239 §7, and the note on the `property_sets` row of `tests/fixtures/project-counts/2024-core-interior.json`). The timber office's export now holds 44 of them, so the condition that removed it no longer holds. ## Changes - `src/ifc/export_content.rs`: `Pset_ShadingDeviceCommon` added to `CONFIRMED_REFERENCE_SETS`, in alphabetical order. - `src/ifc/export_content.rs`: the list's doc comment records that the set joins on the timber office's export, which writes it on all 44 of its `IfcShadingDevice` and on no other element, and that the value's equality is what the next measurement scores. - `changelog.d/added/shading-device-reference.md`: the fragment for the new property. - `tests/fixtures/project-counts/2024-core-interior.json` and `2024-core-interior-slim.json`: the `property_sets` row's `decoder_expected` moves 6578 -> 6598, with a note sentence. **This is a test edit, and it is required**: Core Interior holds 20 shading devices, the 2026-10-29 removal moved this same pin by exactly 20 (6528 -> 6508), and 20 is past the row's `decoder_tolerance` of 8. The 6598 is arithmetic from that recorded move, not a measurement; CI measures it. `IFCPROPERTYSINGLEVALUE` and `IFCRELDEFINESBYPROPERTIES` are not pinned in these fixtures, only named in the note, and the note says they move by 20 with it. No docs sentence states this value: `rg Pset_ShadingDeviceCommon docs/ README.md` finds nothing, so no docs page is updated. `reports/element-framing/RE-239-export-file-values.md` §7 still lists the set as "in no reference export"; that is a dated finding of 2026-10-29 and is left as it stands, superseded by this pull request. ## Measured One Measure run scored this change together with the four others it was drafted beside (run 43058225020, head `d17975d3`, base `aa5dc4c6`): every model, with the BIM4LCA office and housing, the 23 Revit 2025 models, Autodesk's samples of every release, rac_advanced, BIMcollab and the held-out pairs. All 39 shards and both same-project gates passed, and the check run `same-project gates` on `d17975d3` reads pass. 20 of 126 exports change; each changed row carries the name of the value its change writes, so the rows below are this change's alone. A second run kept both sides' exports of the 25 sample saves of 2024 to 2027, which no Revit export scores, and they were compared entity by entity with the step ids taken out (run 43073245751). A third measured the four office files with `--revit-set-placement`, as W7 is measured (run 43073951032). After the second read's two fixes, the stack's final head with `main` merged (`e41d96b5` against `39826420`) was measured again in full (run 43077331708, rows registered on #1636 before it was read): every row below repeats, 24 of 126 exports move and no other, and both same-project gates pass on that head. | Model | `Pset_ShadingDeviceCommon.Reference` equal, before | after | different | |---|---:|---:|---:| | Timber office as built | 0 of 44 | 44 of 44 | 0 | | Timber office at permit | 0 of 44 | 44 of 44 | 0 | - "rvt-rs values Revit does not write" is unchanged on both (6, 50), with and without `--revit-set-placement`. - Core Interior's 20 shading devices gain the set too: `IFCPROPERTYSET` 6,578 to 6,598, `IFCPROPERTYSINGLEVALUE` 28,569 to 28,589, `IFCRELDEFINESBYPROPERTIES` 7,107 to 7,127. Revit's export of that model writes no standard property set at all, so the census counts these apart (4,680 to 4,700 values not scored) and no Revit value checks them. - The two project-count fixtures pin 6,598, and both artifacts' `rvt-rs.json` observations are refreshed from that run in a commit of their own; `tools/ci/witness-verdict.py` replays both to PASS with the committed verdicts unchanged. - No other model holds a shading device: no sample save, Revit 2025 model or held-out pair changes for this. ## Still open - `Pset_ShadingDeviceCommon.IsExternal` (45 values on the timber office, 44 devices and their type) is not written: nothing read gives the value. - The rule is confirmed against Revit on one project in two states. Stack: this is change 3 of 5 measured together; each branch holds the ones before it, so its own diff is its last commit until those land. First draft: #1727. ## Testing - Built, linted and tested by CI on this head; nothing was built on a workstation. - Verified end to end on real Revit files against Revit's own exports: the Measure runs named above, which anyone can repeat with `gh workflow run measure.yml --ref main -f ref=<this head> -f base=aa5dc4c6d93e861015c10e0a0d8f9f16c8b57e71 -f nordic=true -f r2025=true -f samples=true -f racadv=true -f bimcollab=true -f holdout=true`. - No test was added: no unit test, and no pinned count moves except where the body says so. ## Audit-honesty checklist - [x] Docs state what this change writes and what it leaves out - [x] A changelog fragment under `changelog.d/` - [x] No emojis, private paths or personal data in committed files - [x] Limits are in the body above and in the code's doc comments ## Legal and contribution hygiene - [x] Apache-2.0 - [x] No Autodesk proprietary source, decompiled internals or NDA material. Where revit-ifc (CLEANROOM.md source 5) is cited, it is read and cited by file and class, and no code is copied. - [x] No fixture with real-world personal data ## Breaking changes None.
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
rvt-rs writes an element's type name as
Referenceonly in the 34 IFC4 standard sets where a measured Revit export writes it with the same value (CONFIRMED_REFERENCE_SETS), and in no other set until one does. The maintainer's decisions, 2026-10-29 (RE-239 §7): keep the census set-asides of #1115 and #1118, which Revit's IFC4 exports back, and makeReferencefail closed everywhere rather than skip the one unconfirmed set found.Motivation
#1016 (W7). The census set aside 4,210 rvt-rs values its reference exports could not hold. Checked against the office's and R2025's IFC4 exports, 24 of their 25 properties are written equal there and never different;
Pset_ShadingDeviceCommon.Referenceis in no export. rvt-rs could also writeReferencein 9 further sets no export confirms.Changes
src/ifc/export_content.rs:CONFIRMED_REFERENCE_SETS, the 34 sets (31 equal on the office and R2025 IFC4 exports, and the duct fitting, duct segment and pipe fitting types on RE1's IFC2X3 exports);reference_set_kindskeeps only those.tests/fixtures/project-counts/2024-core-interior{,-slim}.json:IFCPROPERTYSET6,528 to 6,508, with a dated note.research/witness/...core-interior*/observations/rvt-rs.json:IFCPROPERTYSET6,528 to 6,508,IFCPROPERTYSINGLEVALUE29,102 to 29,082,IFCRELDEFINESBYPROPERTIES7,062 to 7,042, copied from this PR's CI artifact; both verdicts replay PASS, verdict files unchanged.changelog.d/changed/shading-device-reference.md.Testing
Measure 40986458174, against main at b31c3f4, every model and scorer:
Pset_ShadingDeviceCommon), RE1 Electrical (its 5 alarms losePset_AlarmTypeCommon) and BIMcollab's 2015 structural model (its footings' sets). Every other export is byte-identical.Unit tests: none (banned).
Audit-honesty checklist
Legal and contribution hygiene
Breaking changes
None in the API. Exports of models with shading devices, alarms, footings, reinforcing bars, transport elements or ramp flights lose those elements'
Referencesets.Related issues
Refs #1016.