Skip to content

fix(ifc)!: on Revit 2027 saves, write a flight type whose flights are all sketched runs USERDEFINED, as Revit 27.3 does (#2110) (RE-217) - #2302

Merged
DrunkOnJava merged 14 commits into
mainfrom
fix/2110-userdefined-stair-types
Dec 6, 2026
Merged

DrunkOnJava merged 14 commits into
mainfrom
fix/2110-userdefined-stair-types

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Dec 6, 2026 •

Copy link
Copy Markdown
Owner

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 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 fix(elements): read Precast stair types and stair types with a project-parameter entry (#2297) (RE-65) #2300) has been merged in and only docs and comments changed; the head, b7470942, gives the same (run 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, 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, 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

…EFINED as USERDEFINED with NOTDEFINED as its ElementType, as Revit 27.3's export does (#2110)
… which match Revit's on every scored model; docs and changelog (#2110)
…-out exporter version as inferred, and states the pre-27.3 limit
…pes whose flights are all sketched runs, read from each run's cell (RE-217 §14)
… type, the NOTDEFINED ones type floors and ladders); RE-217 §14 counts 174 straight flights and gives its reproduce command
…, and says the NOTDEFINED stair types include floors and ladders
@DrunkOnJava DrunkOnJava changed the title fix(ifc): on Revit 2027 saves, write a flight type whose flights are all sketched runs USERDEFINED, as Revit 27.3 does (#2110) (RE-217) fix(ifc)!: on Revit 2027 saves, write a flight type whose flights are all sketched runs USERDEFINED, as Revit 27.3 does (#2110) (RE-217) Dec 6, 2026
@DrunkOnJava
DrunkOnJava merged commit 09de17c into main Dec 6, 2026
36 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/2110-userdefined-stair-types branch December 6, 2026 12:36
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.

1 participant