Skip to content

fix(ifc): the wall top and base passes tell a roof by its record class, not the IFC entity it is exported as (#1480) (RE-351) - #1974

Merged
DrunkOnJava merged 2 commits into
mainfrom
fix/1480-roof-record-class
Nov 14, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
fix/1480-roof-record-class

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

The third ask of #1480. The wall top and base passes asked "is this cutter a roof?" by the IFC entity it is exported as (ifc_type == "IFCROOF" in level_underside). They now ask the Revit record: export_content records every Roof element record with whether it is a level plate (RE-351: record box exactly its type's layers, plan outline read), as wall_tops::Roofs, and level_underside(id, roofs) lets any non-Roof record cut and a Roof only when it is a plate.

  • A Floor exported as IfcRoof keeps its cut (it was refused, fail-closed).
  • A Roof exported as IfcSlab is held to the plate rule (it cut at its box's underside).

The base pass (decide_base, from #1953) shares level_underside, so both passes change together.

Testing

Measure, unfiltered with held-out models, against main: dispatched with this PR. Expected: no export moves on models where every roof is exported as IfcRoof and every IfcRoof is a Roof record; any wall that moves is read against Revit's export before this leaves draft.

Clean-room: no format finding; a change of which existing field decides the rule.

@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Measure 43550237466 of head 1d1d2f5 against main 3d60662, unfiltered with nordic, r2025, samples and holdout: 120 of 120 exports byte for byte main's, diagnostics 102 of 102 equal, no scorer output moved. The registered expectation holds: no corpus file has a floor exported as IfcRoof or a roof exported as IfcSlab among the cutters of a wall's top or base, so keying the test on the record class changes no export here. It changes which class decides for a user's file where the two differ, as #1480 asks. Marking ready.

@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 14, 2026 03:49
@DrunkOnJava
DrunkOnJava merged commit 21d310f into main Nov 14, 2026
65 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1480-roof-record-class branch November 14, 2026 04:03
DrunkOnJava added a commit that referenced this pull request Nov 14, 2026
…cut along the roof's underside (#1478) (#1967)

## Summary

On Revit 2025 to 2027, a wall that no level underside cuts, whose top
join names one roof and nothing else, and whose roof is drawn from its
slopes as one solid of faces, is now cut along that roof's underside.
Each convex piece of its plan, cut by the plan of each roof face that
looks down, rises to that face's plane, one item each. Before, these
walls stood level at their record top, through the roof.

What each export gains, on 25 `IfcWall` in 17 Revit 2025 models (the
R2025 roof models `02_1Slope` to `17_Rooms_Stairs_Spiral`) and on
`rac_basic`'s 2025, 2026 and 2027 saves (no Revit export):
- the body goes from one extrusion to a solid of one item per piece
(`IfcWall` body `extrusion` to `solid`);
- `RvtElementRecordGeometry.BodyHeightSource` and the trust marker
`BodyHeightSource` read `wall_top_cut_along_sloped_roof`;
- `RvtElementRecordGeometry.TopCoverElementId` names the roof that cuts
the wall: 2901 on 12 walls, 3823 on 11 (the L-shaped hips), 3546 on 2
(the gables);
- `provenance.value_sources` gains two rows per wall, the inputs the cut
read: the roof's element record (`parts` with the roof's `element_id`,
2901, 3546 or 3823, and its `Partitions` stream) and the wall's own
native record (`reader` `native_wall`, `rule` `native`).

No other class, property or quantity changes. The wall's
`Qto_WallBaseQuantities` keep their values.

## Motivation

#1478, measured first: on puzzbobb's Revit 2025 models (Measure
43542785440, `wall_top_cover_vs_ifc`), wall 2892 is 355 plan points too
tall on 17 models (11.53 ft² of full height each), and 5 or 6 of the 7
walls are too tall on the L-shaped hips (48.27 and 59.80 ft²). Revit's
top follows the roof's underside, as polygonal face sets. Every `pair`
line shows rvt-rs's roof underside equal to Revit's over each wall's
plan ("varies 13.1684..19.4729 in 71 runs" on both sides), so the
surface to cut at is the one rvt-rs already writes.

## Changes

- `src/ifc/export_content/wall_tops.rs`:
- `sloped_top_solid`: the roof's `FacetedBrep` faces that look down
(outward normals, `Mesh` winds counter-clockwise from outside), each as
its plan triangle and plane; the wall's plan cut into convex pieces,
each clipped by each triangle (`clip_convex`), and each part a solid
`between_surfaces_mesh` from the wall's base to the face's plane;
- refused (the wall keeps its body) unless the parts cover the plan once
(`COVER_TOLERANCE_SQUARE_FEET`) and every vertex's underside lies above
the base and at or below the wall's top (`UNDERSIDE_TOLERANCE_FEET`);
- `cut_wall_tops` applies it to the walls `decide` left uncut, with
`BodyHeightSource` `wall_top_cut_along_sloped_roof` and
`TopCoverElementId`;
- the base pass leaves such a wall as it is, as
`base_cut_left_under_a_sloped_top`, so a base cut does not redraw it to
its own top;
  - the module doc says so.
- `partition_schema_mvp.rs` and `fields.rs`: roofs on
`SLOPED_ROOF_WALL_TOP_REVIT_VERSIONS` (2025 to 2027: 2025 is measured
against Revit's own exports of puzzbobb's 20 models, Measure
[43542785440](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43542785440);
2026 and 2027 have no Revit export with such a wall and are held to the
same project's 2025 save by the same-project gate) carry
`ROOF_CUTS_WALL_TOPS_FIELD`; `export_content.rs` collects them and
passes them to the top pass.
- `wall_cut_openings.rs`: an opening voids every piece of such a wall,
as of a stepped one. `element_provenance.rs`,
`tests/value_sources_offsets.rs` and `docs/export-diagnostics.md`
register the new source.
- A changelog fragment.

## Testing

Measure
[43544122324](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43544122324),
unfiltered against `main`, with nordic, r2025, samples and holdout.
Registered before it runs:

1. On the 20 R2025 models listed on #1478, `wall_top_cover_vs_ifc`'s
walls under a sloped roof become equal over the plan (summary `taller`
0), and no wall becomes lower.
2. ~~Only Revit 2025 files' exports move: the R2025 models and any 2025
sample with a wall under a sloped roof. Every 2024, 2026 and 2027 export
is byte for byte `main`'s.~~ As it turned out: the gate was widened to
2026 and 2027 before the Result run, so the Revit 2025 roof models and
`rac_basic`'s 2025, 2026 and 2027 saves move; every 2024 export is byte
for byte `main`'s, and the 2026 and 2027 saves are held to the 2025 save
by the same-project gate (run
[43547699441](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43547699441)).
3. `same-project gates`: a 2025 sample that moves is checked against its
2024 and 2026 saves, which this change leaves as they are. If the gate
reads that as a difference, the result goes on the PR, not a widened
gate.
4. Held-out counts: none moves for the worse.

If a wall comes out lower than Revit's, or the faces do not cover the
plan once on any of the 20, the rule is narrowed before this leaves
draft.

- [ ] `tools/check-local.sh`: no local builds; `rustfmt --check` passes;
CI runs the rest.

## Result

Measure
[43551765959](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43551765959)
(head `0232f664` against main `faec9c51`, unfiltered with nordic, r2025,
samples and holdout): **20 of 120 exports move, and only these 20**.
They are the 17 Revit 2025 roof models whose walls stand under a sloped
roof (`02_1Slope` to `17_Rooms_Stairs_Spiral`, less `02_..._Overhang`,
`03_2Slope` and the models with no sloped roof), and `rac_basic`'s 2025,
2026 and 2027 saves. Diagnostics are 102 of 102 equal. No `qtos_vs_ifc`
or `psets_vs_ifc` row moves on any model: the wall `Height` keeps its
value through the cut. The one scorer line that moves is `schema.txt`'s
count of swept solids placed apart from their product, which drops on
each moved model (on Gable from 5 to 4) as the cut walls stop being
plain extrusions. The same-project gates pass, holding `rac_basic`'s
2026 and 2027 saves to its 2025 save.

What the walls do against Revit's, `wall_top_cover_vs_ifc` on the 20
(Measure
[43554259332](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43554259332),
same head and base):

| | walls | equal to Revit's over the plan | plan points taller than
Revit's |
|---|---:|---:|---:|
| main | 138 | 105 | 10,815 |
| this PR | 138 | 136 | 705 |

Every one of the 17 moved Revit 2025 models goes to every wall equal
over its plan, 10,465 taller points to 0 (for example
`08_LShapedHipRoof` from 2 of 7 walls to 7 of 7, `09` and `10` from 1 of
7 to 7 of 7). No point is lower than Revit's on either side. The 705
left are one wall each on `02_1Slope_Rafter2SquareCut_Overhang` (350)
and `03_2Slope_Rafter2SquareCut` (355), whose exports this PR does not
move, and they stay on #1478. `rac_basic`'s saves have no Revit export
to score.

After #1974 landed, main was merged in (`1e8829f9`): `plate_roofs` is
now keyed on the Roof record and `sloped_roofs` sits beside it, and a
sloped roof still gives no level cut. Its Measure is
[43555026485](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43555026485).

## Audit-honesty checklist

- [x] No claim beyond what the run shows; gated to Revit 2025 to 2027.
2025 is measured against Revit's exports of puzzbobb's 20 models (run
43542785440); 2026 and 2027 have no Revit export to score and are held
to `rac_basic`'s 2025 save by the same-project gate. `rac_basic` has no
Revit export on any release.
- [x] A changelog fragment.
- [x] No private paths or emojis.

## Legal and contribution hygiene

- [x] Apache-2.0; no Autodesk source; no fixtures.

Part of #1478.
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