Repository navigation
fix(elements): read Precast stair types and stair types with a project-parameter entry (#2297) (RE-65) - #2300
Merged
Merged
Conversation
DrunkOnJava
marked this pull request as ready for review
December 6, 2026 11:12
This was referenced Dec 6, 2026
DrunkOnJava
added a commit
that referenced
this pull request
Dec 6, 2026
… all sketched runs USERDEFINED, as Revit 27.3 does (#2110) (RE-217) (#2302) ## Summary On a Revit 2027 save, a stair flight type that rvt-rs would write `NOTDEFINED` is written `USERDEFINED`, with `NOTDEFINED` as its `ElementType`, where every flight it types is a sketched run. That's what Revit's exporter from 27.3 writes for a flight whose run style it can't name. Earlier exporters wrote `NOTDEFINED`, and rvt-rs keeps doing so on earlier releases. A run's style is the class of the one run cell its native `StairsRun` record holds (RE-217 §14). On the 15 models with a Revit export that hold stairs, it matches Revit's flight type by Tag on every flight: - straight cell → `STRAIGHT` (174); - spiral cell → `SPIRAL` (5); - sketched cell → `NOTDEFINED` (4: the BIM4LCA timber office's two runs, as built and at permit). rvt-rs reads a run's style only as straight or spiral. So a winder run, which revit-ifc names `WINDER`, would also be `NOTDEFINED` in rvt-rs, and so would a run whose record isn't read. The step leaves both out: it applies only to a type all of whose flights hold a sketched cell. ## Motivation #2110, from a reporter's Revit 2027 model: three exports of it by Revit 27.3 and 27.4 write no `NOTDEFINED` flight type, and the 9 flights whose types rvt-rs writes `NOTDEFINED` are the 9 Revit writes `USERDEFINED`. revit-ifc's `IFCExportInfoPair` predefined-type setter turns a value assigned as `NOTDEFINED` into `USERDEFINED` from the tag `IFC_v27.3.0.12`, and `StairsExporter.GetValidatedStairFlightType` names a flight by its run's style, parsed into the IFC4 enumeration, which has no member for a sketched run, so it is `NOTDEFINED` (read at `IFC_v19.2.0` and `IFC_v27.3.0.12`). ## Changes - `src/research/native_stairs.rs`: `native_run_reads` returns the runs whose graph holds one `StairsSketchedRunCell`, read in the same `StairsRun` pass as the run shapes (`native_run_shapes` keeps its signature). - `src/research/partition_schema_mvp/stair_bodies.rs`, `fields.rs`: a sketched run carries `STAIR_RUN_SKETCHED_FIELD`. - `src/ifc/export_content.rs`, `src/ifc/mod.rs`, `src/ifc/from_decoded.rs`: `IfcModel::sketched_runs`, the ElementIds of those runs. - `src/ifc/category_map.rs`: `UNNAMED_FLIGHT_TYPE_USERDEFINED_FROM` (2027) and the classes it applies to, with the evidence and limits. - `src/ifc/step_writer.rs`: after the type objects are grouped, a `NOTDEFINED` flight type on a 2027 save whose flights are all in `sketched_runs` is written `USERDEFINED` with `ElementType` `'NOTDEFINED'`. A type with any other flight stays `NOTDEFINED`. - `probes/examples/probe_2110_run_types.rs`, `tools/re/run_cells_vs_ifc.py`: each run's cell class, and its pairing with Revit's flight type by Tag. - `reports/element-framing/RE-217-stair-runs-2025.md` §14, `docs/status.md`, `changelog.d/changed/2027-flight-types-userdefined.md`. - Two tests that build an `IfcModel` literal gain the new field. No unit tests. ## Testing - **The change against `main`**, unfiltered with the samples, the BIM4LCA models and the Revit 2025 set ([run 47639862454](https://github.com/DrunkOnJava/rvt-rs/actions/runs/47639862454) on `9ce96840`). Registered before the run: exactly one export moves, `rac_basic`'s 2027 save. Result: 100 of 101 exports identical, all 101 diagnostics identical, no scorer differences, and the one export differs by the one line `IfcStairFlightType` Tag 141730 `.NOTDEFINED.` → `.USERDEFINED.` with `ElementType` `'NOTDEFINED'`, its GlobalId unchanged. The same-project gates pass. Since then `main` (with #2300) has been merged in and only docs and comments changed; the head, `b7470942`, gives the same ([run 47645032411](https://github.com/DrunkOnJava/rvt-rs/actions/runs/47645032411): 100 of 101 exports and all diagnostics identical, no scorer differences, gates pass). - **The cell matches Revit's flight type** on every model with a Revit export that holds stairs: [run 47638192794](https://github.com/DrunkOnJava/rvt-rs/actions/runs/47638192794), the counts above, every flight paired, none against the reading. Across Autodesk's 2024 to 2027 samples (Snowdon left out), the probe reads 52 straight cells and 4 sketched (`rac_basic`'s run 665560, on each save), and no winder cell; across every model it reads none. - **Held out:** [run 47639869740](https://github.com/DrunkOnJava/rvt-rs/actions/runs/47639869740), 25 of 25 exports and 7 of 7 diagnostics identical. - **What exercises it:** one export in CI, `rac_basic`'s 2027 save, and no Revit export of that model checks it. The sketched style rests on one building with a Revit export (24.0.5), and the reporter's runs' cells aren't read, so this doesn't claim to fix all nine of theirs. ## Breaking changes `IfcModel` gains a public field, `sketched_runs`, which cargo-semver-checks counts as breaking (`constructible_struct_adds_field`): code that builds an `IfcModel` with a struct literal naming every field adds it, or uses `..Default::default()`. Announced with `!` in the title, as #2284 did for `framing_members`, and in the changelog entry. Output changes only on Revit 2027 saves, as above. ## Clean-room declaration The changes in this PR are based on public byte observations of the BIM4LCA and Autodesk sample files, checked against Revit's own IFC exports of the BIM4LCA and Revit 2025 models; the reporter's counts on #2110 and #2046; and Autodesk's open-source exporter revit-ifc, read for what Revit's export writes (`IFCExportInfoPair.cs`, `StairsExporter.cs`, `Toolkit/IFC4Enums.cs`, cited and not copied). I have not used Autodesk SDK source, ODA SDK source, leaked internal documentation, NDA material, or decompiled internal Revit implementation code beyond public symbol exports, and I have not copied or translated code from revit-ifc. Refs #2110
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
Stairs of the Precast Stair family on Revit 2024 saves now get their type: equal to Revit's export by Tag in the type object's Tag,
PredefinedTypeand GlobalId, and in the stairs'NameandObjectType. (The type's ownNamekeeps rvt-rs'sFamily:Typeform, as on every type.) On the four BIM4LCA housing files (Revit 2024, exported by Revit 24.0.5), Revit's export types the half-turn stairs (4 on the concrete files, 1 on the timber ones) byIfcStairTypeHALF_TURN_STAIR, Tag 462868, and names themPrecast Stair:Stair:<ElementId>. rvt-rs gave them no type object, noObjectTypeand aStair-<ElementId>name.Two reads of the stair type record stopped short, and both are fixed (RE-65 §8):
Motivation
#2297. The stairs themselves already matched Revit's
PredefinedTypeby Tag; their type object was missing.Changes
src/research/partition_stairs.rs:component_type_atreads construction 2 as Precast Stair;stair_type_namewalks past a positive ElementId-sized parameter entry. The constants' docs say so.probes/examples/probe_2297_stair_types.rs: each stair's reference list, the stair types it names and its nativem_typeId.probes/examples/probe_2297_stair_type_records.rs: each copy of each stair type record, which ofcomponent_type_at's checks it passes, and its parameter entries walked asstair_type_namewalks them.reports/element-framing/RE-65-stair-names.md§8,docs/support-matrix.json,docs/status.md,changelog.d/fixed/precast-stair-types.md.Testing
main, unfiltered with the samples, the BIM4LCA models and the Revit 2025 set (run 47638372413 ondfeeb352; commits after it change docs only). Registered before the run: only the four housing files move. Result: 97 of 101 exports and diagnostics identical, the four housing files moved. On concrete as built, elements typed as Revit types them go from 1,379 to 1,383, with entity, Tag and GlobalId agreement each up 4, and untypedIfcStairfrom 4 to 0. Stairs with Revit'sNameandObjectTypego from 32 to 36, flights with Revit'sNamefrom 3 to 11, and system-familyIfcSlabrows with Revit'sNamefrom 38 to 42. Property values equal to Revit's go from 6,576 to 6,587; "different" (1) and "values Revit does not write" (24) are unchanged. The new type object brings 7 of Revit's values into the comparison: 3 equal (the threePset_StairCommoncounts), andPset_StairCommon.IsExternaland threePset_StairFlightCommoncounts not written; on the four stairs,Pset_StairCommon.ReferenceandPset_EnvironmentalImpactIndicators.Referencego from missing to equal. The timber files gain their one stair the same way (equal +5, missing +2 for the same reasons). Nonames_vs_ifcorpsets_vs_ifcrow gets worse on any of the four files. The same-project gates pass.dfeeb352): 462868 is kept as Precast Stair, "POR-1" and "POR-4.kellari"; 460352 still stops; the controls read as before. Paired by Tag, the half-turn stairs' type object now equals Revit's in Tag,PredefinedTypeand GlobalId (3y5Ze_SfH5chbuK39p0p1I). What still differs there is the ladders' type 874355, written once per ladder (Type objects: 44 elements on the BIM4LCA concrete housing have a type GlobalId other than Revit's; one type is written once per ladder #2299).Breaking changes
None. Output changes only where a stair type has construction 2 or a project-parameter entry.
Clean-room declaration
The changes in this PR are based on public byte observations of the BIM4LCA housing files (CC BY-SA 4.0) checked against Revit's own IFC exports of them. I have not used Autodesk SDK source, ODA SDK source, leaked internal documentation, NDA material, or decompiled internal Revit implementation code beyond public symbol exports, and I have not copied or translated code from revit-ifc.
Closes #2297