Skip to content

feat(ifc): write the base quantities of a door's opening in a second wall (#1165) - #1749

Closed
DrunkOnJava wants to merge 1 commit into
mainfrom
pilot/16-openingelement-height-width
Closed

DrunkOnJava wants to merge 1 commit into
mainfrom
pilot/16-openingelement-height-width

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Revit's IFC4 export writes Qto_OpeningElementBaseQuantities (Width, Height and Depth) on the opening a door cuts in a wall besides the one it is hosted in. rvt-rs writes that opening (RE-321, RE-338) but no quantity set on it, because door_cut sets quantities: false. This change writes the set, with Revit's values and with Revit's own assignment of the three names: Width the wall's thickness, Height the opening's height, Depth its extent along the wall.

On the office as built that closes Qto_OpeningElementBaseQuantities.Height and .Width on 25 of the 56 objects the census reports missing, and .Depth on 25 of its 25 missing (the same openings). What stays without is stated below.

Evidence

The task is real for these objects. The 56 are not the door openings RE-235 §5 already leaves out: the census counts those apart (187 of Height and 187 of Width, REVIT_DEFECTS, keyed by the class of what fills the opening, docs/counted-apart.md qto-known-wrong). The 152 scored objects split as

  • 96 equal: the 30 rectangular wall openings + 39 fire hose cabinets + 27 curtain-wall cuts, whose Width = the outline's extent along the wall and Height = its height are already written (step_writer.rs, the WallCutOpening block; RE-321 §3, RE-338);
  • 56 missing: 31 rectangular floor-sketch voids (VoidOpening, RE-151) + the 25 openings rvt-rs writes for a door cutting a second wall (RE-338).

The split is confirmed by the same file's other lines: .Depth is missing on exactly 25 objects (the floor voids have no Depth in Revit's export, and Depth missing 25 = the 25 door openings), .Area is missing on 5 (the 5 floor voids whose loop is not a rectangle, out of the 36 of RE-321 §1), and unfilled_openings_vs_ifc.txt writes 25 of the 39 IfcDoor in IfcWall openings, so exactly those 25 are census-visible.

The rule, from the office's two IFC files (matched by Tag). Revit's opening for a door in a second wall is a box: Tools/re-free reading of the STEP, four openings of three doors:

door second wall Width Height Depth
1728679 (1.21 m wide) in 1726266 and 1728013 300 mm 300 2100 1210
1383546 (0.81 m) in 1352055 100 mm 100 2100 810
1447102 (0.81 m) in 1435142 100 mm 100 2100 810

The body there is the wall's section (thickness × height, IFCARBITRARYCLOSEDPROFILEDEF 300 × 2100 in #147548) swept along the door's width (depth 1210 in #147553), and Width/Height are that profile's X and Y extents while Depth is the extrusion's depth. rvt-rs's Cut for the same opening holds exactly those three extents (along = the door's width, left = the wall's thickness, up = the height), and its IfcOpeningElement matches Revit's box within 0.01 ft on all 25 (unfilled_openings_vs_ifc.txt). So Width = thickness_feet, Height = the outline's Y extent, Depth = its X extent, which is the same three numbers as the rectangle layout with Width and Depth exchanged.

A second construction exists and contradicts nothing here: on door 1436505's openings in walls 1493966 and 3490093 Revit writes Width 1210 (the door's width), Height 2100 and Depth 3048, ten feet across about a plane nothing read gives (RE-338 §5, door_second_wall_parallel_to_door_wall). Those openings are not written by rvt-rs at all, so they stay out of both the rule and the census's scored objects.

What stays out, and why.

  • The 31 rectangular floor-sketch voids. Revit does write Width and Height on them, and they are the extents of the hole's profile (Tag 1420820: Revit Width 3455.14, Height 5609.77 mm against the loop's two extents), but in the profile frame of that opening: for that opening the extrusion's placement has ref direction (0,-1,0) (#82775), so its Width is the loop's Y extent, while the notched void beside it (Tag 3190490) has ref direction (1,0,0) (#82792) and so would read the loop's X extent. Both hosts' IfcLocalPlacements are world-aligned, so the rotation is Revit's per-opening choice, and rvt-rs's own outline for the void lies in its identity frame (step_writer.rs, the VoidOpening block). Nothing rvt-rs reads gives that rotation, so a rule here would be right on some openings and swapped on others. Left out; it needs the opening's profile frame, which is not read.
  • The 5 notched ones. Revit writes Area only (Tag 3190490: 3.4096666 m², the loop's area), not Width/Height, and rvt-rs writes neither. Which of Revit's floor voids takes Width/Height and which Area is seen on two of the 36 only, so no discriminator is proposed.
  • The 14 remaining doors in a second wall (39 − 25) and the 4 roof-hatch openings: not written by rvt-rs, counted apart as qto-openings-unwritten (Unfilled openings Revit's export writes and rvt-rs does not: a door's further cuts, curtain-wall cuts and fire hose cabinets (591 values on the office) #1165).

No maintainer decision leaves these 25 out: docs/counted-apart.md counts them apart only until #1165 writes them ("written where the measurement is exact and its values counted in W7"), and RE-338 §3 records them as missing, not as a Revit defect.

Changes

  • src/ifc/wall_cut_openings.rs: door_cut sets quantities: true (with the reason), so the opening it builds gets Revit's set.
  • src/ifc/step_writer.rs: the WallCutOpening quantities block picks the door's layout when the cutter at reference_from is an IfcDoor (only that kind has a door there — a rectangular opening's is its wall, a cabinet's and a curtain wall's their own element) and writes Width = the wall's thickness, Height = the outline's height, Depth = its extent along the wall; every other kind keeps the layout it had. The lookup is model.entities.get(..).is_some_and(..), so a missing index writes nothing.
  • src/ifc/entities.rs: the quantities field's doc says which of the two layouts the opening gets.
  • changelog.d/added/door-second-wall-opening-quantities.md: the new fragment.
  • docs/supported-profile.md: the one sentence that says what an opening a door cuts in a second wall gets now names the quantity set.

Not touched: no test pins these values (tests/unfilled_openings.rs compares Tags and hosts only, and the witness observations are Core Interior's, not the office's), so tests/ is unchanged.

What was not checked

  • Nothing was compiled or run. CI must confirm the edit builds under edition 2024 / MSRV 1.87 and passes clippy -D warnings: the new code is a matches! with a guard inside is_some_and on Option<&IfcEntity>, and an if/else producing one Vec<Property>.
  • Three of the 25 openings were read by hand, from three distinct doors and two wall thicknesses; the other 22 are unverified, and so is the office at permit (33 openings), the timber office, the housing files and every sample. Measure must show different still 0 for Qto_OpeningElementBaseQuantities.Height, .Width and .Depth, no width/depth/height extra (rvt-rs quantities Revit does not write), and the missing counts falling by 25 on the office as built (56 → 31 for Height and Width, 25 → 0 for Depth). If any of the 25 is Revit's ten-foot construction or sits in a wall turned off the model axes, its value will differ, and the rule will have to be narrowed further.
  • The census totals in docs/release-1.0-criteria.md are a previous measurement's and were not re-based; this change's Measure run is the one to publish.

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

DrunkOnJava commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner Author

Closing in favour of #1755, which covers the same openings (#1165).

Read against Revit's export of the BIM4LCA office as built, on the openings a door cuts in a wall across its own:

Opening (door's Tag) Host wall, its own Width Revit: Width / Height / Depth, mm rvt-rs's outline along the wall x up, m rvt-rs extrudes it by
1383546 Basic Wall:VS-2:1352055, 150 mm 100 / 2100 / 810 0.1000 x 2.1000 0.810 m
1447102 Basic Wall:VS-2:1435142, 150 mm 100 / 2100 / 810 0.1000 x 2.1000 0.810 m
1728679 Basic Wall:VS-4:1726266, 200 mm 300 / 2100 / 1210 0.3002 x 2.1000 1.210 m
1728679 Basic Wall:VS-4:1728013, 200 mm 300 / 2100 / 1210 0.3002 x 2.1000 1.210 m

So on these four Revit's three quantities are the ones the existing rule for a rectangular opening already computes, unswapped: Width the outline's extent along the host wall (the thickness of the wall the door stands in, not the host's), Height the outline's height, Depth the extrusion across the host, which is the door's width. This branch swaps them and would write Width 810 where Revit has 100, and a Depth of 100 where Revit has 810. #1755 writes Depth from the extrusion and leaves the other two out, which matches the four.

Follow-up for #1755 once its Depth is measured: the same four say Width and Height can be written as they are for any other rectangular opening. The outline is 0.2 mm wider than Revit's Width on the two VS-4 openings, which the measurement has to judge.

(Edited: the first version of this comment called Revit's Width the host wall's thickness. It is not: the hosts are 150 and 200 mm.)

DrunkOnJava added a commit that referenced this pull request Nov 12, 2026
… and Height (#1165) (#1784)

## Summary

The 25 openings of the BIM4LCA office as built whose
`Qto_OpeningElementBaseQuantities.Depth` Revit's export writes and
rvt-rs's does not are the openings rvt-rs writes for a door that also
cuts a second wall (`ifc::wall_cut_openings`'s `door_cut`, `quantities:
false` since RE-338). They are written with no quantity set at all. This
change writes their `Depth`, the extent the opening is extruded across
that wall by, and leaves their `Width` and `Height` out.

## Evidence

- `evidence/nordic-office-as-built/qtos_vs_ifc.txt`: `Depth: 308, equal
283, different 0, missing 25`, all 25 `on IfcOpeningElement x25`; a
further 59 openings rvt-rs does not write are counted apart, and `rvt-rs
quantities Revit does not write: 0`.
- `evidence/nordic-office-as-built/unfilled_openings_vs_ifc.txt`, by
kind of cutter and host: `IfcCurtainWall in IfcWall` 27 of 27,
`IfcFireSuppressionTerminal in IfcWall` 39 of 39, `none in IfcWall` 30
of 30, `none in IfcSlab` 36 of 36 and `IfcSlab in IfcSlab` 1 have `Depth
equal`; `IfcDoor in IfcWall` is the one kind with `revit: 39, written:
25` and `Depth in Revit's: 25` but no `Depth equal` line — rvt-rs writes
those 25 openings and no `Depth` on any.
- The counts close exactly: 283 equal = 187 openings of a door or window
whose symbol cuts an outline (the filled openings, whose `Depth` the
writer already writes) + 96 of the 99 wall-cut openings it writes (three
curtain walls are written that Revit's export lacks); 283 + 25 = 308. So
the 25 are precisely the door-in-second-wall openings, and Revit writes
`Depth` on every one of them.
- What Revit's value is. RE-321 §3 (the rectangular, cabinet and
curtain-wall openings, all 96 equal) and RE-244 (the 187) find `Depth`
to be the extrusion's depth, i.e. the extent the opening passes through
the wall by, which is what `thickness_feet` already is for a wall-cut
opening. On a door's second-wall opening that extent is the door's own
width: `revit.ifc`'s opening `#77141` (Tag 1383546, unfilled, voiding
`Basic Wall:VS-2:1352055`) carries `Width` 100, `Height` 2100, `Depth`
810 mm — the profile is the second wall's plane (the door's own wall
thickness by the door's height) extruded 810 mm across it, and 810 mm is
the door's own opening's across extent, which RE-338 §3 measured as the
door's own opening box (equal to rvt-rs's box within 0.01 ft on 25 of 28
as built, and on all 25 these openings are the ones written). `Depth` =
3048 mm on exactly the 11 openings where the second wall runs *along*
the door's wall, which rvt-rs leaves out
(`door_second_wall_parallel_to_door_wall`, 9 of the 14 it leaves out of
the 39).
- Rule, and what stays out: `Depth` is written on every wall-cut opening
whose host holds that quantity (all 607 walls that rvt-rs writes hold a
`Width` here, and with `--no-base-quantities` the list is empty and
nothing is written). `Width` and `Height` stay missing on the 25:
Revit's export swaps them on a door's opening (RE-244, RE-235 §5) and
nothing read says it does not on this one, even though `#77141`'s are
the rectangle's extents. So `Width` 152 (missing 56) and `Height` 152
(missing 56) are unchanged, and the 14 door openings rvt-rs does not
write are untouched.

## Changes

- `src/ifc/step_writer.rs`: the wall-cut opening's quantity set is now
written where its host holds the quantity, not only where `Width` and
`Height` are written too; `Width` and `Height` are still pushed only for
the rectangular, cabinet and curtain-wall openings, so their output is
byte for byte what it was, and a door's second-wall opening gains a set
holding `Depth` alone.
- `src/ifc/entities.rs`, `src/ifc/wall_cut_openings.rs`: the doc
comments of `quantities` say why that opening takes only its `Depth`.
- `docs/supported-profile.md` and `docs/release-1.0-criteria.md`: the
sentences listing what an opening a door cuts in a second wall carries
gain the `Depth`, and say that its `Width` and `Height` stay out.
- `changelog.d/added/1165-door-second-wall-opening-depth.md`: new
fragment.

## Measured

One Measure run scored this change together with nine others it was
drafted beside (run 43086493417, head `f5f54467`, base `5e3ac5b0`: every
model, with the BIM4LCA office and housing, the Revit 2025 models,
Autodesk's samples of every release, rac_advanced, BIMcollab and the
held-out pairs; every shard and both same-project gates passed; rows
registered on #1636 before it was read). Each change writes a value of a
different name, so the rows below are this change's alone. Both sides'
exports were kept, and the 58 sample saves, which no Revit export
scores, were compared value by value. After the second read the stack
was rebuilt on `main` as seven changes (the pipe change left it, and the
roof and floor-opening rules were narrowed to square-cornered outlines)
and measured once more in full (run 43100937918, head `53c19487` against
`e8a99d03`, rows registered first, read on #1636): all shards and both
same-project gates pass, "different" and "values Revit does not write"
are unchanged on every model, and the rows below repeat except where a
line says otherwise.

The first draft wrote `Depth` alone. `Height` was added after reading
four such openings in Revit's export of the office (Width, Height and
Depth 100 / 2100 / 810 and 300 / 2100 / 1210 mm, the same way round as
on any rectangular opening; the table is in the last comment on #1749).

| Model | `Depth` equal, before | after | `Height` equal, before | after
| newly different |
|---|---:|---:|---:|---:|---:|
| Office as built | 283 of 308 | 308 of 308 | 96 of 152 | 121 of 152 | 0
|
| Office at permit | 262 of 295 | 295 of 295 | 75 of 137 | 108 of 137 |
0 |
| Timber office as built | 286 of 302 | 302 of 302 | 101 of 142 | 117 of
142 | 0 |
| Timber office at permit | 247 of 281 | 263 of 281 | 74 of 121 | 90 of
121 | 0 |
| Concrete housing as built, at permit | 72, 62 of 79 | 75, 65 of 79 |
18, 6 of 35 | 21, 9 of 35 | 0 |
| Timber housing as built, at permit | 67 of 68 each | 68 of 68 each | 7
of 19 each | 8 of 19 each | 0 |

- The timber office at permit read 9 `Depth` values different before and
reads the same 9 after.
- Sample saves: one opening in each rac_basic save of 2024 to 2027 gains
the two values.

## Still open

- `Width`, which Revit's export writes too, stays out: Revit's is the
thickness of the wall the door stands in, and rvt-rs's outline is 0.2 mm
wider than that on two of the four openings read, which the scorer would
count as different.
- A second wall that runs along the door's wall is still not written.

Stack: this is change 5 of 7; each branch holds the ones before it, so
its own diff is its last commits until those land. First draft: #1755,
then #1779.

## 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=e8a99d03be8a76a2c8871ea8cc28d036653ec6e2 -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.
- `main` has moved since those runs (#1769 re-meshes trimmed faces, and
#1771, #1773, #1781, #1782, #1787 and #1789 landed). This head,
`44bafde9`, is built on #1783's merged head `0f82cb8e`, so until #1783
lands its diff against `main` also shows #1783's change; its own change
(`0f82cb8e..44bafde`) is this pull request's two commits and nothing
else (byte-equal outside `docs/`, word-equal inside). It is armed only
after #1783 has merged. Measure 43108424934 measured the nine batch
changes together on `main` with #1769 (`3f2a04c4` against `e7ac68e7`,
rows registered on #1636 first): every count above repeats, and the
same-project gates pass.

## 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/16-openingelement-height-width 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