Skip to content

fix(elements): read Precast stair types and stair types with a project-parameter entry (#2297) (RE-65) - #2300

Merged
DrunkOnJava merged 4 commits into
mainfrom
fix/2297-precast-stair-types
Dec 6, 2026
Merged

DrunkOnJava merged 4 commits into
mainfrom
fix/2297-precast-stair-types

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Dec 6, 2026 •

Copy link
Copy Markdown
Owner

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, PredefinedType and GlobalId, and in the stairs' Name and ObjectType. (The type's own Name keeps rvt-rs's Family:Type form, 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) by IfcStairType HALF_TURN_STAIR, Tag 462868, and names them Precast Stair:Stair:<ElementId>. rvt-rs gave them no type object, no ObjectType and a Stair-<ElementId> name.

Two reads of the stair type record stopped short, and both are fixed (RE-65 §8):

  • Construction value 2 is now Precast Stair. RE-65 left it unnamed, having seen it only on Snowdon's unused type named "Precast Stair".
  • A parameter entry can be a positive id that fits an ElementId, taken to be a project or shared parameter's. Type 462868's second entry is 403070. The name read stopped at any entry that wasn't a negative BuiltInParameter; walked past this one, the name is "POR-1" on the concrete files and "POR-4.kellari" on the timber ones, Revit's type Names for Tag 462868. Zero, or a positive value too large for an ElementId, still stops the read.

Motivation

#2297. The stairs themselves already matched Revit's PredefinedType by Tag; their type object was missing.

Changes

  • src/research/partition_stairs.rs: component_type_at reads construction 2 as Precast Stair; stair_type_name walks 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 native m_typeId.
  • probes/examples/probe_2297_stair_type_records.rs: each copy of each stair type record, which of component_type_at's checks it passes, and its parameter entries walked as stair_type_name walks 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

  • Against main, unfiltered with the samples, the BIM4LCA models and the Revit 2025 set (run 47638372413 on dfeeb352; 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 untyped IfcStair from 4 to 0. Stairs with Revit's Name and ObjectType go from 32 to 36, flights with Revit's Name from 3 to 11, and system-family IfcSlab rows with Revit's Name from 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 three Pset_StairCommon counts), and Pset_StairCommon.IsExternal and three Pset_StairFlightCommon counts not written; on the four stairs, Pset_StairCommon.Reference and Pset_EnvironmentalImpactIndicators.Reference go from missing to equal. The timber files gain their one stair the same way (equal +5, missing +2 for the same reasons). No names_vs_ifc or psets_vs_ifc row gets worse on any of the four files. The same-project gates pass.
  • Held out: run 47638378900, 25 of 25 exports and 7 of 7 diagnostics identical. That shows nothing else moved. Precast Stair itself rests on this one type in one design (the housing in two materials, at two stages).
  • The probes as they land (run 47640130433 on 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, PredefinedType and 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).
  • Where the read stopped, before the change: both half-turn stairs' reference lists name exactly 462868, as the typed stairs name theirs (run 47633769516), and 462868's tagged record passed every check up to its name (run 47636183073).
  • No unit tests.

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

…ct-parameter entry; land the two #2297 probes; status names Precast Stair (#2297) (RE-65)
… 2025-2027's native read keeps construction 2 unnamed (RE-65 §8)
@DrunkOnJava
DrunkOnJava marked this pull request as ready for review December 6, 2026 11:12
@DrunkOnJava
DrunkOnJava merged commit 2664244 into main Dec 6, 2026
63 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/2297-precast-stair-types branch December 6, 2026 11:24
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant