Skip to content

feat(ifc): write a spiral stair flight's Pset_StairFlightCommon.NumberOfTreads - #1725

Closed
DrunkOnJava wants to merge 1 commit into
mainfrom
pilot/03-stairflight-counts
Closed

DrunkOnJava wants to merge 1 commit into
mainfrom
pilot/03-stairflight-counts

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Pset_StairFlightCommon.NumberOfTreads is now written on a spiral stair flight, from the number of treads its run's own records give. On the BIM4LCA office as built this is the one flight of 35 that rvt-rs left out, and Revit's export writes 18 there.

The task's counts are not all flights. psets_vs_ifc.txt counts a name over every object that holds it, and the 18 / 17 / 17 missing values are 14 IfcStair + 3 IfcStairType + 1 / 0 / 0 IfcStairFlight (the "Revit's most common values where rvt-rs writes none" rows name the entities: on IfcStair x14, IfcStairType x3, IfcStairFlight x1 for NumberOfTreads, on IfcStair x14, IfcStairType x3 for NumberOfRiser and NosingLength). So:

  • The 14 stairs and the 3 stair types are placement, not absence. revit_set_placement::attach runs only under rvt-ifc --revit-set-placement (export_pipeline.rs:806), and the evidence file is measured with IFC4's placement. Under the flag stair_flight_additions writes the stair's flight set (RE-287) and add_stair_type_flight_sets copies the type's Pset_StairCommon zeros into Pset_StairFlightCommon (RE-286), which is Revit's 0.0 on those three types.
  • NumberOfRiser and NosingLength are absent on no flight at all (35 of 35 and 37 of 37 equal).
  • NumberOfTreads is absent on exactly one flight, and that one is real.

Evidence

Read: psets_vs_ifc.txt of the three models; src/ifc/revit_set_placement.rs; src/ifc/export_content.rs (stair_property_set, stair_type_zeros); src/research/partition_schema_mvp/stairs.rs (attach_stair_dimensions, attach_native_stair_dimensions); src/research/partition_schema_mvp/stair_bodies.rs (attach_stair_run_bodies, attach_spiral_run_bodies); src/research/native_stairs.rs (spiral, native_spiral_runs); src/research/partition_stairs.rs (run_sketch, scan_run_ends); reports/element-framing/RE-287-stair-container-flight-set.md; docs/support-matrix.json; and both IFC files of the office, matched by Tag.

The flight: #591293=IFCSTAIRFLIGHT(...,'Assembled Stair:Stair:3057027 Run 1',...,'Non-Monolithic Run:TERÄSASKELMA',...,'3057703',...,.SPIRAL.) — the only .SPIRAL. of the 35 flights in either file. Revit's Pset_StairFlightCommon on it (#591343) holds NumberOfRiser 19 and NumberOfTreads 18; rvt-rs's (#648099) holds NumberOfRiser 19, RiserHeight, TreadLength, NosingLength and Reference, and no NumberOfTreads.

Why the reader leaves it out: on Revit 2024 a flight's count comes from attach_stair_run_bodies, which needs run_sketch (a straight, level first boundary line) and then scan_run_ends for the run's begin- and end-with-riser flags, and computes risers - 1 + !begin + !end. A spiral run's plan is an arc, so run_sketch gives None, no ends are read, and no count is computed. The run's riser count, riser height and tread depth come from elsewhere and are written.

The rule: a spiral run's treads are already read, one StairsTreadInfo per tread, by native_spiral_runs for its body, and Revit's ActualTreadsNumber for that run is the number of them. docs/support-matrix.json records the office's spiral run "drawn as its 18 treads (RE-217 section 11)", and stair_bodies_vs_ifc.txt gives rvt-rs's body volume 4.540283 ft3 against Revit's 4.540287 ft3, so the reader's treads are Revit's 18 and not 17 or 19. attach_spiral_run_bodies now pushes STAIR_TREAD_COUNT_FIELD as run.treads.len().

What it leaves out, and why:

  • The count is written only where the spiral body is drawn from those treads, i.e. after the existing gates (a run type with treads and no risers, not monolithic, a tread thickness, and the nosing/mirroring condition). A spiral run whose body is not drawn keeps no count, though Revit would write one.
  • The assembled stair's own Pset_StairCommon.NumberOfTreads (18) is still not read; only its flight's, and with --revit-set-placement the stair's flight set, which sums it.
  • The housing's two flights without NumberOfTreads (1429891, 1430751) are .STRAIGHT and hold only NosingLength and Reference — their run's data is not read at all, so no rule here covers them.
  • The 3 stair types' zeros and the 14 stairs' flight sets are RE-286 and RE-287, unchanged.

Changes

  • src/research/partition_schema_mvp/stair_bodies.rs: attach_spiral_run_bodies pushes the run's number of treads as STAIR_TREAD_COUNT_FIELD, which export_content::stair_property_set writes as the flight's Pset_StairFlightCommon.NumberOfTreads; its doc comment says so.
  • docs/format-reconnaissance.md, docs/support-matrix.json: the sentence stating the spiral/assembled stair's tread count is not read now says its own is not and its flight's is, and the flight-set value count on the office goes from 111 to 112 (14 stairs of eight properties, the spiral stair's NumberOfTreads no longer missing).
  • changelog.d/fixed/spiral-flight-tread-count.md: the user-visible value.

No test pins this value; tests/ is untouched.

What was not checked

I could not compile or measure. CI must confirm the build, clippy and rustfmt, and the measurement must confirm:

  • the office's flight 3057703 reads NumberOfTreads 18 equal to Revit's, and the office's Pset_StairFlightCommon.NumberOfTreads goes from 34 to 35 equal of 52 with no value different;
  • with --revit-set-placement, the spiral stair 3057027's flight set gains NumberOfTreads 18, so the office's flight-set value count is 112 and not 111 as the doc now says;
  • the timber office's three flights that lack NumberOfTreads (28 of 48 equal) are spiral runs and take Revit's count too. I have no Revit export for that model, so if they are not spiral runs, or if Revit's count there is not the number of the run's treads, the rule is wrong on them and must be narrowed to the office's run or dropped;
  • no other model changes: the rule is gated on Revit 2024 (NATIVE_SPIRAL_RUN_REVIT_VERSIONS) and on a spiral run, so the R2025 stair models and every 2025 to 2027 file are untouched.

Pilot draft: written by an automated worker and pushed as proposed, with rustfmt applied. Not yet read by a maintainer session; please do not review, approve or arm it.

@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Superseded by #1761: the same commit on a fresh branch, with the measured rows in its body.

DrunkOnJava added a commit that referenced this pull request Nov 11, 2026
…erOfTreads, the number of its run's treads (#1016) (#1761)

## Summary

`Pset_StairFlightCommon.NumberOfTreads` is now written on a spiral stair
flight, from the number of treads its run's own records give. On the
BIM4LCA office as built this is the one flight of 35 that rvt-rs left
out, and Revit's export writes 18 there.

The task's counts are not all flights. `psets_vs_ifc.txt` counts a name
over every object that holds it, and the 18 / 17 / 17 missing values are
14 `IfcStair` + 3 `IfcStairType` + 1 / 0 / 0 `IfcStairFlight` (the
"Revit's most common values where rvt-rs writes none" rows name the
entities: `on IfcStair x14, IfcStairType x3, IfcStairFlight x1` for
`NumberOfTreads`, `on IfcStair x14, IfcStairType x3` for `NumberOfRiser`
and `NosingLength`). So:

- **The 14 stairs and the 3 stair types are placement, not absence.**
`revit_set_placement::attach` runs only under `rvt-ifc
--revit-set-placement` (`export_pipeline.rs:806`), and the evidence file
is measured with IFC4's placement. Under the flag
`stair_flight_additions` writes the stair's flight set (RE-287) and
`add_stair_type_flight_sets` copies the type's `Pset_StairCommon` zeros
into `Pset_StairFlightCommon` (RE-286), which is Revit's 0.0 on those
three types.
- **`NumberOfRiser` and `NosingLength` are absent on no flight at all**
(35 of 35 and 37 of 37 equal).
- **`NumberOfTreads` is absent on exactly one flight**, and that one is
real.

## Evidence

Read: `psets_vs_ifc.txt` of the three models;
`src/ifc/revit_set_placement.rs`; `src/ifc/export_content.rs`
(`stair_property_set`, `stair_type_zeros`);
`src/research/partition_schema_mvp/stairs.rs`
(`attach_stair_dimensions`, `attach_native_stair_dimensions`);
`src/research/partition_schema_mvp/stair_bodies.rs`
(`attach_stair_run_bodies`, `attach_spiral_run_bodies`);
`src/research/native_stairs.rs` (`spiral`, `native_spiral_runs`);
`src/research/partition_stairs.rs` (`run_sketch`, `scan_run_ends`);
`reports/element-framing/RE-287-stair-container-flight-set.md`;
`docs/support-matrix.json`; and both IFC files of the office, matched by
Tag.

The flight: `#591293=IFCSTAIRFLIGHT(...,'Assembled Stair:Stair:3057027
Run 1',...,'Non-Monolithic
Run:TERÄSASKELMA',...,'3057703',...,.SPIRAL.)` — the only `.SPIRAL.` of
the 35 flights in either file. Revit's `Pset_StairFlightCommon` on it
(`#591343`) holds `NumberOfRiser` 19 and `NumberOfTreads` 18; rvt-rs's
(`#648099`) holds `NumberOfRiser` 19, `RiserHeight`, `TreadLength`,
`NosingLength` and `Reference`, and no `NumberOfTreads`.

Why the reader leaves it out: on Revit 2024 a flight's count comes from
`attach_stair_run_bodies`, which needs `run_sketch` (a straight, level
first boundary line) and then `scan_run_ends` for the run's begin- and
end-with-riser flags, and computes `risers - 1 + !begin + !end`. A
spiral run's plan is an arc, so `run_sketch` gives `None`, no ends are
read, and no count is computed. The run's riser count, riser height and
tread depth come from elsewhere and are written.

The rule: a spiral run's treads are already read, one `StairsTreadInfo`
per tread, by `native_spiral_runs` for its body, and Revit's
`ActualTreadsNumber` for that run is the number of them.
`docs/support-matrix.json` records the office's spiral run "drawn as its
18 treads (RE-217 section 11)", and `stair_bodies_vs_ifc.txt` gives
rvt-rs's body volume 4.540283 ft3 against Revit's 4.540287 ft3, so the
reader's treads are Revit's 18 and not 17 or 19.
`attach_spiral_run_bodies` now pushes `STAIR_TREAD_COUNT_FIELD` as
`run.treads.len()`.

What it leaves out, and why:

- The count is written only where the spiral body is drawn from those
treads, i.e. after the existing gates (a run type with treads and no
risers, not monolithic, a tread thickness, and the nosing/mirroring
condition). A spiral run whose body is not drawn keeps no count, though
Revit would write one.
- The assembled stair's own `Pset_StairCommon.NumberOfTreads` (18) is
still not read; only its flight's, and with `--revit-set-placement` the
stair's flight set, which sums it.
- The housing's two flights without `NumberOfTreads` (1429891, 1430751)
are `.STRAIGHT` and hold only `NosingLength` and `Reference` — their
run's data is not read at all, so no rule here covers them.
- The 3 stair types' zeros and the 14 stairs' flight sets are RE-286 and
RE-287, unchanged.

## Changes

- `src/research/partition_schema_mvp/stair_bodies.rs`:
`attach_spiral_run_bodies` pushes the run's number of treads as
`STAIR_TREAD_COUNT_FIELD`, which `export_content::stair_property_set`
writes as the flight's `Pset_StairFlightCommon.NumberOfTreads`; its doc
comment says so.
- `docs/format-reconnaissance.md`, `docs/support-matrix.json`: the
sentence stating the spiral/assembled stair's tread count is not read
now says its own is not and its flight's is, and the flight-set value
count on the office goes from 111 to 112 (14 stairs of eight properties,
the spiral stair's `NumberOfTreads` no longer missing).
- `changelog.d/fixed/spiral-flight-tread-count.md`: the user-visible
value.

No test pins this value; `tests/` is untouched.

## 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_StairFlightCommon.NumberOfTreads` equal, before | after
| different |
|---|---:|---:|---:|
| Office as built | 34 of 52 | 35 of 52 | 0 |
| Office at permit | 34 of 52 | 35 of 52 | 0 |
| Timber office as built | 28 of 48 | 29 of 48 | 0 |
| Timber office at permit | 25 of 48 | 26 of 48 | 0 |

- With `--revit-set-placement` the spiral stair's own flight set gains
the count too: 50 to 52 of 52 on the office as built and at permit, 42
to 44 of 48 on the timber office as built, 36 to 38 of 48 at permit.
Different stays 0.
- "rvt-rs values Revit does not write" is unchanged on all four files
(7, 15, 6, 50), with and without the option.
- No other model moves for this change: the Revit 2025 stair models, one
of them a spiral, and every sample save are unchanged, as the rule is
held to Revit 2024.

## Still open

- The timber office's other flights without a count (4 values with the
option on as built, 10 at permit) are not spiral runs; their runs' data
is not read.
- A spiral run whose body is not drawn from its treads gets no count.
- The assembled stair's own `Pset_StairCommon.NumberOfTreads` is still
not read.

Stack: this is change 1 of 5 measured together; each branch holds the
ones before it, so its own diff is its last commit until those land.
First draft: #1725.

## 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.
@DrunkOnJava
DrunkOnJava deleted the pilot/03-stairflight-counts branch November 12, 2026 02:13
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