Skip to content

feat(ifc): export stairs as aggregates of their runs, landings and stringers (#323) (RE-39) - #325

Merged
DrunkOnJava merged 1 commit into
mainfrom
feat/stair-aggregates
Sep 23, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
feat/stair-aggregates

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Stairs now export the way Revit exports them. Each stair is an IfcStair with no body of its own, and IfcRelAggregates relates it to its runs (IfcStairFlight), landings (IfcSlab .LANDING.) and stringers (IfcMember .STRINGER.). Each part names its stair in its reference list. On Snowdon Towers every aggregate relation rvt-rs writes is one Revit's own export has.

Motivation

#323. RE-37 left stairs out because Revit exports them as aggregates, and bounding-box bodies for a stair plus each of its parts would double the volume.

Changes

  • src/ifc/entities.rs: IfcEntity::Aggregate { whole, parts }.
  • src/ifc/step_writer.rs: one IFCRELAGGREGATES per aggregate, resolved after all element ids are assigned. A part is left out of IfcRelContainedInSpatialStructure: it reaches the storey through its whole. An aggregate whose whole is not a building element changes nothing.
  • src/partition_element_records.rs: OST_STAIRS, OST_STAIRS_RUNS, OST_STAIRS_LANDINGS and OST_STAIRS_STRINGER_CARRIAGE join the product categories.
  • src/ifc/category_map.rs: StairsRun → IFCSTAIRFLIGHT, StairsLanding → IFCSLAB .LANDING., StairsStringer → IFCMEMBER .STRINGER.. Stair → IFCSTAIR already existed.
  • src/partition_schema_mvp.rs: attach_aggregate_wholes gives each run, landing or stringer the one exported stair its reference list names (fail closed on none or several). record_references is shared with RE-38's name pass.
  • src/ifc/export_content.rs: stairs carry no body, and parts are grouped into Aggregate entities.
  • Unit tests for the writer (relation, containment, invalid whole) and the exporter (bodiless stair, aggregate built).
  • examples/probe_re39_stair_parts.rs, reports/element-framing/RE-39-stair-aggregates.md, a support-matrix row (experimental, local evidence), README, status, CHANGELOG.

Measurements (Snowdon Towers Architectural, local only)

rvt-rs Revit's IFC4 export
stair aggregates 26 26 (same stairs)
parts attached 228 (169 stringers, 42 flights, 17 landings) all 228 in the matching aggregate
new elements 256 (27 stairs, 42 flights, 17 landings, 170 stringers) all 256 are Revit's

Revit's aggregates hold 67 more parts:

  • 65 railings. They name their stair too, but Revit aggregates only 65 of the 70 that do, and no byte read tells the five apart, so railings stay standalone.
  • 1 stringer that names two stairs (left standalone).
  • 1 run with no readable placed-instance frame.

IfcOpenShell reports no issue on the 127,070-instance export, and the schema-arity gate passes. Core Interior, the RE1 models and the Snowdon structural sample export byte-identically, since none has stairs.

Testing

  • tools/check-local.sh
  • Every integration test with the family corpus and the magnetar + RE1 project corpus
  • cargo +1.85.0 check --profile ci --all-targets, cargo +nightly check --manifest-path fuzz/Cargo.toml
  • python -m ifcopenshell.validate and tools/ci/ifc_schema_arity.py on the Snowdon export

Audit-honesty checklist

Legal and contribution hygiene

  • Apache-2.0
  • Clean-room: byte observations scored against Revit's own IFC export. BuiltInCategory names come from the public enum. No SDK source or decompiled material. Snowdon is measured locally and not committed.
  • No PII

Breaking changes

IfcEntity gains the Aggregate variant. Code that matches every variant must handle it. IfcModel JSON (the viewer's wasm output) can carry {"kind": "Aggregate", ...} rows.

Related issues

Refs #323.


Note

Medium Risk
Adds a breaking IfcEntity::Aggregate variant and changes IFC spatial containment for stair parts; logic is scoped with fail-closed linking but affects core export and STEP emission paths.

Overview
Stairs now export like Revit IFC4: each stair is a bodiless IfcStair, with runs, landings, and stringers emitted as IfcStairFlight, IfcSlab .LANDING., and IfcMember .STRINGER. and linked via IfcRelAggregates. Partition decoding adds stair-related BuiltInCategory values; attach_aggregate_wholes sets m_aggregate_whole when a part’s reference list names exactly one exported stair (ambiguous or missing links stay standalone; railings are intentionally excluded).

The export path introduces IfcEntity::Aggregate, skips extrusion geometry for aggregate wholes, groups parts after the production walk, and the STEP writer emits IFCRELAGGREGATES while omitting aggregate parts from storey containment (spatial structure is reached through the stair). IFC class mappings and docs/support matrix/changelog/probe probe_re39_stair_parts document RE-39 / #323.

Reviewed by Cursor Bugbot for commit 7d2b40f. Configure here.

…ringers (#323) (RE-39)

A stair's runs, landings and stringers name the stair's ElementId in their
reference lists. Each stair now exports as an IfcStair with no body of its
own, related by IfcRelAggregates to its IfcStairFlight runs, IfcSlab
.LANDING. landings and IfcMember .STRINGER. stringers, as Revit's own IFC4
export does. A part reaches the spatial structure through its stair and is
left out of the storey containment.

On Snowdon Towers Architectural (local only) the same 26 stairs aggregate as
in Revit's export, every one of the 228 parts rvt-rs attaches is in the
matching Revit aggregate, and all 256 new elements are Revit's. Railings
stay standalone: Revit aggregates 65 of the 70 that name a stair, and
nothing read tells the other five apart. Core Interior, the RE1 models and
the structural sample export unchanged.

IfcEntity::Aggregate carries the relation; the STEP writer emits it after
every element id is assigned. examples/probe_re39_stair_parts.rs measures
the link; the report is reports/element-framing/RE-39-stair-aggregates.md.
@cursor

cursor Bot commented Sep 23, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_23372859-239e-441e-8350-3706d9a8401b)

@DrunkOnJava
DrunkOnJava merged commit 35cce3f into main Sep 23, 2026
23 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/stair-aggregates branch September 23, 2026 06:06
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