Skip to content

feat(elements): contain elements naming two Levels in their base constraint's storey (#365) (RE-59) - #368

Merged
DrunkOnJava merged 1 commit into
mainfrom
feat/base-constraint-storeys
Sep 24, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
feat/base-constraint-storeys

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

An element whose partition element record names two Levels, its base and top constraint, is now contained in its base constraint's storey (RE-59). The base constraint is the higher of the two Levels at or below the record's base, else the lower.

RE-27 declined these records, because the reference list does not order the two: the lower Level comes first on 452 of Snowdon's two-Level records and second on 198. Such elements fell back to matching their box base against storey elevations. That fallback misses:

  • walls with a base offset;
  • walls drawn from their centreline (RE-54);
  • curtain walls.

The rule gives the storey Revit's own IFC export uses on every record that names two Levels:

file records naming two Levels base constraint = Revit's storey
Snowdon Towers (local only) 650 650
2024_Core_Interior 482 482
RE1 Architecture 7 7

Per element, against Revit's own containment (tools/re/storeys_vs_ifc.py; a part takes its aggregate whole's storey):

file in Revit's storey, before → after on no storey, before → after in a different storey, before → after
Snowdon Towers 3,975 → 5,612 1,931 → 294 45 → 45
2024_Core_Interior 853 → 854 1 → 0 0 → 0
RE1 Architecture 27 → 34 7 → 0 0 → 0
the MIT tutorial house (2024 and 2025) no oracle 230 → 1 no oracle
  • Core Interior now binds all 970 building elements, each in Revit's storey. That includes RE-27's last unbound wall, 55840.
  • The 294 Snowdon elements left name no Level: light fixtures hosted on ceilings, railings, proxies and sanitary fixtures.
  • The house's last one is a railing that names no Level. Closes Tutorial house (Revit 2024): 53 elements bind to no storey #365.

Changes

  • src/element_record_level_refs.rs:
    • named_levels and base_constraint_level;
    • CONSTRAINT_LEVELS_FIELD, LEVEL_BIND_SOURCE_FIELD and BASE_CONSTRAINT_SOURCE;
    • the module doc.
  • src/partition_schema_mvp.rs:
    • element_record_decoded keeps a two-Level record's pair;
    • resolve_base_constraint_levels binds the base constraint from the Levels' own elevations (RE-51).
  • src/ifc/export_content.rs: LevelBindSource carries partition_element_record_base_constraint for those elements.
  • src/ifc/mod.rs: the diagnostics sentence and the doc of apply_record_level_reference_storeys.
  • tests/iter_elements_typed.rs: core_interior_2024_storey_containment_is_evidence_backed pins the new measured state: 970 of 970 bound, all through the record's Level, none on the building.
  • examples/probe_re59_base_constraint_levels.rs, tools/re/storeys_vs_ifc.py, reports/element-framing/RE-59-base-constraint-levels.md.
  • Docs:
    • the support-matrix row record-level-reference-storey-bind, whose reference side is now measured;
    • README (a storey-containment row), status, user-guide, contribution-map, the reconnaissance addendum and CHANGELOG.
  • research/witness/magnetar-2024-core-interior{,-slim}/observations/rvt-rs.json regenerated:
    • 970 elements bound through their own Level, up from 488;
    • IFCRELCONTAINEDINSPATIALSTRUCTURE 14 to 13;
    • 965 more property values.

Testing

End to end, against real files. No new tests; one existing corpus test's pinned numbers move to the new measurement.

  • The probe on Snowdon, Core Interior, RE1 and the MIT house, joined with Revit's containment (the first table).
  • rvt-ifc on the same files, then tools/re/storeys_vs_ifc.py before and after (the second table). The report's §3 has the inputs' sha256 and the output.
  • The CI witness steps, replayed locally: both Core verdicts PASS with --compare-committed, --witness-agreement holds, and ifcopenshell.validate reports nothing.
  • Local gates:
    • fmt, clippy -D warnings, rustdoc -D warnings;
    • the workspace suite;
    • the corpus tests under --profile ci;
    • cargo +1.85.0 check and the fuzz workspace check.

What this does not do

  • Elements whose record names no Level, which stay in the IfcBuilding.
  • Records naming three or more Levels (3 Snowdon stairs).
  • The 45 Snowdon elements in a different storey from Revit's, mostly mullions under a different curtain-wall parent. One of them, curtain panel 1593696, is new: it now inherits its curtain wall's storey, but Revit exports it as a curtain wall nested under another.

Audit-honesty checklist

  • Every count is measured against Revit's own export of the same model, or before and after on one with no export.
  • RE finding: report, probe, reconnaissance addendum, end-to-end scorer.
  • No emojis, private paths or personal data.

Legal and contribution hygiene

  • Apache-2.0
  • Clean-room: byte observations, and Revit's own exports as oracles.
  • Snowdon and the MIT house stay local.

Related issues

Closes #365. Refs #219, #33.


Note

Medium Risk
Changes how IFC spatial containment is assigned for a large class of elements (walls, columns, stairs, curtain walls); behavior is evidence-backed against Revit exports but affects export structure and downstream storey grouping.

Overview
Storey containment now resolves two-Level element records instead of leaving them on elevation fallback or unplaced. When a partition element record names exactly two Levels (base and top constraint, in no fixed order), the exporter picks the base constraint: the higher Level at or below the record's base elevation, otherwise the lower. That Level becomes m_levelId with bind source partition_element_record_base_constraint, and IFC containment follows the existing record-level-reference path.

Impact: Core Interior goes from 969/970 to 970/970 building elements on a named storey (including the last wall that named no single Level). Snowdon Towers gains ~1,637 elements in Revit-matching storeys; elements with no Level in the record still land in IfcBuilding. Records with three+ Levels stay unresolved.

Tooling and evidence: Adds named_levels / base_constraint_level, resolve_base_constraint_levels in the partition MVP, LevelBindSource on export, probe probe_re59_base_constraint_levels, scorer tools/re/storeys_vs_ifc.py, RE-59 report, and updated corpus test / witness JSON / docs.

Reviewed by Cursor Bugbot for commit b2bcf61. Configure here.

…traint's storey (#365) (RE-59)

A partition element record naming two Levels names its base and top
constraint, in no fixed order. The base is the higher of the two at or
below the record's base, else the lower. That is the storey Revit's own
export contains the element in on 650 of 650 Snowdon records, 482 of 482
on Core Interior and 7 of 7 on RE1.

With it, Core Interior binds all 970 building elements, each in Revit's
storey. Snowdon has 5,612 elements in Revit's storey (3,975 before) and
294 on none (1,931 before). The tutorial house goes from 230 elements on
no storey to 1.
@cursor

cursor Bot commented Sep 24, 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_a8d1caf5-b08f-4220-95d8-97e705465a6c)

@DrunkOnJava
DrunkOnJava merged commit 1b32523 into main Sep 24, 2026
23 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/base-constraint-storeys branch September 24, 2026 04:09
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.

Tutorial house (Revit 2024): 53 elements bind to no storey

1 participant