Skip to content

fix(ifc): write a floor sketch opening's Area where its outline is not a rectangle - #1758

Closed
DrunkOnJava wants to merge 1 commit into
mainfrom
pilot/40-openingelement-area
Closed

DrunkOnJava wants to merge 1 commit into
mainfrom
pilot/40-openingelement-area

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Qto_OpeningElementBaseQuantities.Area is now written on an opening a floor's sketch makes where its outline is not a rectangle, and on no other unfilled opening. On the BIM4LCA office as built that is the 5 openings the census lists as missing, and the 31 rectangular sketch openings, on which Revit's export writes no Area, keep none.

Evidence

The census (evidence/nordic-office-as-built/qtos_vs_ifc.txt): Qto_OpeningElementBaseQuantities.Area: 5, equal 0, different 0, missing 5 (line 42), all on IfcOpeningElement x5 (line 123); 3 more on openings rvt-rs does not write (line 7) and 1 on a repeated key (line 78).

Matching the two files of the office by Tag, the 5 are the same five objects: 3190490, 3143563, 3146720, 3147725, 3151525, all named Floor:VP-1:418397 in both files, each an opening of a floor's sketch (RE-151) that rvt-rs already writes, with its box and its Reference values equal.

  • What Revit's value is. In every one of the 13 opening quantity sets of Revit's export that hold an IFCQUANTITYAREA, the Area is the area of the polygon the opening's body extrudes: e.g. 3.4096666 m2 for opening 3190490, whose profile is a 890 x 3890 mm rectangle less a 230 x 230 mm notch (3.409662 m2 from rvt-rs's own outline, read in its file's metres), and 9.634416 m2 for 3146720 against 9.634423 m2 from that outline. The same holds for the four roof hatch openings (tag 2991742), the two wall profile openings (1671974) and the door opening that cuts two walls (1623922), which this change does not touch.
  • What tells the 5 apart. rvt-rs writes 36 openings of a floor's sketch on this file. Of those, exactly 5 have an outline that is not a rectangle (a 6-corner outline with a notch, closed by a repeated last point) and 31 are 5-point rectangles — and the 5 are Revit's 5, the 31 Revit's 31, on which Revit writes Width and Height and no Area. Nothing else separates them: the 5 sit in five different floors (1384047, 1451421, 1457693, 1457785, 1474132) among openings of the same name, the same kind and the same depth.
  • A second model against the rule. The housing as built's rvt-rs export holds 11 openings of a floor's sketch (Floor:VP-2, Floor:AP-1, Floor:VP-1.OL, Floor:VP-1.KL), all 5-point rectangles, and its census misses no Area at all: the rule adds nothing there.
  • Rule. On an opening a floor's sketch makes (IfcEntity::VoidOpening, not a face-hosted cut) whose outline has more than four corners, write Area, the outline's shoelace area in square feet, as the wall profile opening's Area is written (RE-381). Read from evidence: 5 of 5 equal on the model measured, none on the 31 Revit gives none.
  • What it leaves out. A quadrilateral that is not a rectangle (no measured export has one, and nothing tells it from the 31); every other kind of unfilled opening (a roof's hatch, a curtain wall's cut, a cabinet's, a door's in a further wall, a wall's own profile opening), which have their own rules; and a door's or window's opening. It also does not touch the existing 3 Area values rvt-rs writes on the timber office where Revit writes Width and Height instead (RE-402) — that is the wall profile opening's rule, not this one.
  • --no-base-quantities. The value is written only where rvt-rs writes base quantities at all, the gate a door opening's Depth and a wall profile opening's Area have (RE-242): with the flag every Qto_ set is empty and no opening quantity is written.

Changes

  • src/ifc/step_writer.rs: in the loop that writes an opening of a floor's sketch, a boolean of whether any Qto_ set still holds quantities, and, on such an opening whose outline has more than four corners, its Area as IfcQuantityArea, the outline's area (the shoelace expression the wall profile opening's Area already uses).
  • docs/supported-profile.md, docs/evidence.md: the two sentences that list the openings' base quantities now say the floor sketch opening's Area is written.
  • changelog.d/fixed/40-floor-void-opening-area.md.

What was not checked

  • I could not compile or run anything: CI must confirm that the filter, the shoelace sum and the HashSet-free any compile under clippy -D warnings and rustfmt.
  • I could not measure. The office's export at building permit, the timber office (whose census misses 12 Areas and writes 3 that Revit omits) and every Autodesk sample are unchecked by me: Measure must confirm that the rule is right on every floor sketch opening each of them holds, and that no other census line moves. If a sketch opening there is a convex or skewed polygon with more than four corners, the rule writes an Area on it that I have no evidence for; a quadrupedal outline is left out for that reason.
  • The two committed Core Interior witness observations pin the entity counts of that export and I could not refresh them. Core Interior holds 62 openings of a floor's own sketch; if any of them is not a rectangle, IFCELEMENTQUANTITY, IFCQUANTITYAREA and IFCRELDEFINESBYPROPERTIES move on both artifacts and the observations must be regenerated by Measure before this can land. RE-151's reading of that file found its sketch holes closed by four lines apiece, which suggests none of them is, but I did not see the file and so claim nothing.
  • The 5 values are compared to Revit's within the scorer's 1e-5 relative tolerance, not exactly: rvt-rs's outline is Revit's polygon to the precision the sketch stores (1.3e-6 relative on 3190490), as on the wall profile opening (RE-381).

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 #1780: the same change on a fresh branch on today's main, with the measured rows in its body.

DrunkOnJava added a commit that referenced this pull request Nov 12, 2026
…Area where its outline is square-cornered (#1016) (#1786)

## Summary
`Qto_OpeningElementBaseQuantities.Area` is now written on an opening a
floor's sketch makes where its outline is not a rectangle, and on no
other unfilled opening. On the BIM4LCA office as built that is the 5
openings the census lists as missing, and the 31 rectangular sketch
openings, on which Revit's export writes no `Area`, keep none.

## Evidence
The census (`evidence/nordic-office-as-built/qtos_vs_ifc.txt`):
`Qto_OpeningElementBaseQuantities.Area: 5, equal 0, different 0, missing
5` (line 42), all on `IfcOpeningElement` x5 (line 123); 3 more on
openings rvt-rs does not write (line 7) and 1 on a repeated key (line
78).

Matching the two files of the office by Tag, the 5 are the same five
objects: **3190490, 3143563, 3146720, 3147725, 3151525**, all named
`Floor:VP-1:418397` in both files, each an opening of a floor's sketch
(RE-151) that rvt-rs already writes, with its box and its `Reference`
values equal.

- **What Revit's value is.** In every one of the 13 opening quantity
sets of Revit's export that hold an `IFCQUANTITYAREA`, the `Area` is the
area of the polygon the opening's body extrudes: e.g. 3.4096666 m2 for
opening 3190490, whose profile is a 890 x 3890 mm rectangle less a 230 x
230 mm notch (3.409662 m2 from rvt-rs's own outline, read in its file's
metres), and 9.634416 m2 for 3146720 against 9.634423 m2 from that
outline. The same holds for the four roof hatch openings (tag 2991742),
the two wall profile openings (1671974) and the door opening that cuts
two walls (1623922), which this change does not touch.
- **What tells the 5 apart.** rvt-rs writes 36 openings of a floor's
sketch on this file. Of those, exactly 5 have an outline that is not a
rectangle (a 6-corner outline with a notch, closed by a repeated last
point) and 31 are 5-point rectangles — and the 5 are Revit's 5, the 31
Revit's 31, on which Revit writes `Width` and `Height` and no `Area`.
Nothing else separates them: the 5 sit in five different floors
(1384047, 1451421, 1457693, 1457785, 1474132) among openings of the same
name, the same kind and the same depth.
- **A second model against the rule.** The housing as built's rvt-rs
export holds 11 openings of a floor's sketch (`Floor:VP-2`,
`Floor:AP-1`, `Floor:VP-1.OL`, `Floor:VP-1.KL`), all 5-point rectangles,
and its census misses no `Area` at all: the rule adds nothing there.
- **Rule.** On an opening a floor's sketch makes
(`IfcEntity::VoidOpening`, not a face-hosted cut) whose outline has more
than four corners, write `Area`, the outline's shoelace area in square
feet, as the wall profile opening's `Area` is written (RE-381). Read
from evidence: 5 of 5 equal on the model measured, none on the 31 Revit
gives none.
- **What it leaves out.** A quadrilateral that is not a rectangle (no
measured export has one, and nothing tells it from the 31); every other
kind of unfilled opening (a roof's hatch, a curtain wall's cut, a
cabinet's, a door's in a further wall, a wall's own profile opening),
which have their own rules; and a door's or window's opening. It also
does not touch the existing 3 `Area` values rvt-rs writes on the timber
office where Revit writes `Width` and `Height` instead (RE-402) — that
is the wall profile opening's rule, not this one.
- **`--no-base-quantities`.** The value is written only where rvt-rs
writes base quantities at all, the gate a door opening's `Depth` and a
wall profile opening's `Area` have (RE-242): with the flag every `Qto_`
set is empty and no opening quantity is written.

## Changes
- `src/ifc/step_writer.rs`: in the loop that writes an opening of a
floor's sketch, a boolean of whether any `Qto_` set still holds
quantities, and, on such an opening whose outline has more than four
corners, its `Area` as `IfcQuantityArea`, the outline's area (the
shoelace expression the wall profile opening's `Area` already uses).
- `docs/supported-profile.md`, `docs/evidence.md`: the two sentences
that list the openings' base quantities now say the floor sketch
opening's `Area` is written.
- `changelog.d/fixed/40-floor-void-opening-area.md`.

## 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.

| Model | `Qto_OpeningElementBaseQuantities.Area` equal, before | after
| different |
|---|---:|---:|---:|
| Office as built | 0 of 5 | 5 of 5 | 0 |
| Office at permit | 0 of 6 | 6 of 6 | 0 |
| Timber office as built, at permit | 0 of 12 each | 12 of 12 each | 0 |

- "quantities Revit does not write" is unchanged on every model, the
timber office's 3 included.
- Before the narrowing Core Interior gained 20 `Area` sets on floor
sketch openings that are not rectangles, which no Revit value scores
(its export writes no base quantities); after it none is written there.
- Sample saves: 12 openings gain the value, 10 in Snowdon Towers
Architectural and 2 in Structural.
- **Narrowed after the second read:** an outline with a corner that is
not a right angle now gets none. Revit takes the area from the sketch's
curves, and an arc reaches the outline as chords within 0.0005 ft, whose
polygon is short of it by more than the scorer's 1e-5 on a small radius.
The counts above, Core Interior's 20 and the samples' 12 included, are
from before the narrowing. **After it (the final run):** all four office
counts are kept (5 of 5, 6 of 6, 12 of 12, 12 of 12, none different),
and Core Interior's export is byte-identical: none of its 20 openings
passes, so no witness observation moves and no refresh is needed.
- **Tightened again:** the `Area` is written only where the outline has
more than four square corners, counted without the joints it runs
straight through, so a rectangle one of whose edges is two sketch lines
(five points, four corners) is left out: whether Revit calls that loop a
rectangle is not measured. The helper that counts them is pure and has
seven tests of the ways it can fail.

## Still open

- A rectangle gets no `Area` (Revit's export writes its `Width` and
`Height` there), and a four-cornered outline that is not a rectangle is
left out as unmeasured.

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

## 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: the eight batch changes before this
one landed, with #1769, #1771, #1791 and others. This head, `422e9432`,
is `main` at `000fc1af` merged in. The merge resolved one conflict in
`src/ifc/export_content.rs`, where this pull request's own commits
rewrite the corner helper #1785 added, by taking this branch's side; the
resolved `export_content.rs` and `step_writer.rs` are byte-equal to the
files Measure 43108424934 measured at `3f2a04c4`, and the change against
`main` is this pull request's own three commits (byte-equal outside
`docs/`, word-equal inside).
- Because a source conflict was resolved, this head has an unfiltered
Measure of its own against `main`, with kept exports: run 43133784518,
rows registered on #1636 before it is read. Its same-project verdict and
the advisory semantic verdict land on this head.
- Autodesk's sample saves have no Revit export in Measure, so nothing
scores them; the kept exports are read by element instead. In run
43113322070 (all nine batch changes on `main`) the only sample saves
that gain this value are the two Snowdon Towers 2024 saves,
Architectural 10 and Structural 2 openings, with no existing value
changed or removed. Revit's own IFC4 export of the architectural file
was made without base quantities, so those 12 `Area` values are written
where no Revit export can check them.

## 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/40-openingelement-area 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