Skip to content

feat(ifc): a flat roof written as a slab carries its Qto_SlabBaseQuantities.Perimeter where its outline is square-cornered (#1208) - #1785

Merged
DrunkOnJava merged 10 commits into
mainfrom
feat/1208-roof-perimeter-2
Nov 12, 2026
Merged

DrunkOnJava merged 10 commits into
mainfrom
feat/1208-roof-perimeter-2

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

On the BIM4LCA office as built Revit's export writes Qto_SlabBaseQuantities.Perimeter on 29 objects where rvt-rs writes none. Thirteen of the office's 42 slab perimeters are already counted apart as Revit's feet-unscaled defect (RE-235 §5, REVIT_DEFECTS in tools/re/qtos_vs_ifc.py); the other 29 are scored missing. Reading the 42 values against the profile each slab's body extrudes splits them cleanly in two, and the split is the element's class: every .ROOF. slab's value is the outline's length in the file's unit, and every floor's, base slab's and stair landing's is that same length in feet. This writes the roof ones — 10 of the 29 — and leaves the rest out with the reason stated.

Evidence

I mapped each of the 42 Qto_SlabBaseQuantities sets of revit.ifc to its IfcSlab (through its IFCRELDEFINESBYPROPERTIES) and to the GrossArea written beside its Perimeter, then read the profile the slab's body extrudes. The two readings of one value differ by 304.8, so each of the 42 is unambiguous against its area:

as the file's unit (mm) as feet
the 10 .ROOF. slabs 4.7 to 197.9 m, 1.00 to 3.06 times 4*sqrt(area) 1,429 to 60,315 m
the 32 .FLOOR./.BASESLAB./.LANDING. slabs 0.020 to 0.87 m, far under 2*sqrt(pi*area) 5.8 to 264 m, 0.8 to 1.9 times 4*sqrt(area)

Checked to the last digit where the profile is a plain outline in the export:

  • Basic Roof:KA-1 1461758 (area 261.2999 m²): outline 188,699.718 mm of lines plus two quarter arcs of radius 2925 mm, 197,888.88 mm against Revit's 197,888.87629548809.
  • Basic Roof:YP-1 2991742 (area 614.7886): 158,585.00 mm against 158,584.9999999993.
  • Basic Roof:YP-4 3165182 (area 491.8956): a 26,385 by 18,643 rectangle, 90,056.00 mm against 90,056.0000000018.
  • Floor:VP-1 1384047 (area 1017.0252): outline 174,303.6 mm plus its 6 holes 42,700.7 mm, 217,004 mm, against 743.65029082242927 read as feet, 226,664 mm — the export counts a hole's outline in its value.
  • Floor:AP-2 1439250 (a landing, area 16.6319): 2×(2,760.48 + 6,025) = 17,570.95 mm, against 57.64750022310872 ft = 17,571 mm.

So the rule is narrowed to the class the evidence carries: a roof whose GrossArea the export writes (the scope add_slab_gross_area already uses for a flat roof: drawn as one extrusion of its sketch's outline, not sloped, its type's layers filling its body) and whose profile has no holes gets its Perimeter, the length of that outline. Arcs are tessellated at the profile's own 0.0005 ft (Ka-1's two arcs make 4.6% of the outline, so the polygon reads within 1e-6 of the arc length, well inside the census's 1e-5).

What stays without, and why:

  • the 32 floors, base slabs and stair landings: Revit's value there is the length in feet, unscaled (five of them verified above and by the scorer), so writing the length would make 19 values different and 13 still counted apart;
  • the one Non-Monolithic Landing 3058084, whose value is the outline in mm (4,688.14 mm for 1.3804 m²): rvt-rs writes no Qto_SlabBaseQuantities on a landing at all (RE-295), so there is nothing to add it to;
  • a roof whose profile has holes: whether the export counts a hole's outline in the value is unmeasured (the office's 10 roofs have no holes; the housing has 2 roofs with holes, RE-413), so profile_outline_length returns None for ArbitraryWithVoids.

Not a settled question: the maintainer's RE-235 §5 leaves out "a floor's Perimeter" only, issue #1208 (open) lists Perimeter among the slab quantities not written with the reason "Revit writes Perimeter in feet in a millimetre file", which holds for the floors and not for the roofs; no report or decision covers a roof's, and no merged pull request writes it.

Changes

  • src/ifc/export_content.rs: add_slab_gross_area pushes Perimeter (as PropertyValue::PositiveLengthFeet) on a roof; a new profile_outline_length returns the length of a closed polyline profile and None for a profile with voids or another shape. The function's comment now says a floor's is left out and a roof's is written, with what stays without.
  • changelog.d/added/1208-roof-perimeter.md: the new fragment.
  • docs/supported-profile.md, docs/evidence.md: the roof's Perimeter in the two lists of the base quantities written.

No test pins the set (rg Qto_SlabBaseQuantities tests/ finds nothing), so no test is edited.

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_SlabBaseQuantities.Perimeter equal, before after different
Office as built 0 of 29 10 of 29 0
Office at permit 0 of 29 10 of 29 0
Timber office as built 0 of 28 8 of 28 0
Timber office at permit 0 of 28 1 of 28 0
Concrete housing as built, at permit 0 of 24, 0 of 20 1 of 24, 4 of 20 0
Timber housing as built, at permit 0 of 28 each 3 of 28 each 0
  • The draft predicted the office's 10 and left the timber office and the housing open: they read equal too, and no model gains a value Revit's export does not write, the held-out pairs included.
  • Sample saves: none gains a value from this change.
  • Narrowed after the second read: a roof whose outline has a corner that is not a right angle now gets none. A sketch arc reaches the outline as chords within 0.0005 ft, whose length is short of the arc's by about a third of sagitta over radius; no corner between two chords is square, so a square-cornered outline holds no arc. The counts above are from before the narrowing. After it (the final run): 9 of 29 on each concrete office file, one fewer, and every other count as above (8 and 1 of 28, 1 of 24, 4 of 20, 3 and 3 of 28), none different. The one roof that fell on each office file read equal before, so its outline has a slanted straight edge, not an arc.

Still open

  • A roof whose profile has holes gets none: whether Revit counts a hole's outline is not measured.
  • A roof whose outline has a slanted straight edge is left out with the arcs. Carrying the sketch's arcs to the outline and taking their length exactly would reach both.
  • A floor's Perimeter stays out: Revit's export writes it in feet in a file whose unit is millimetres (RE-235 section 5).

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

Testing

Audit-honesty checklist

  • Docs state what this change writes and what it leaves out
  • A changelog fragment under changelog.d/
  • No emojis, private paths or personal data in committed files
  • Limits are in the body above and in the code's doc comments

Legal and contribution hygiene

  • Apache-2.0
  • 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.
  • No fixture with real-world personal data

Breaking changes

None.

…t too (#1165)

Read on Revit's export of the BIM4LCA office as built: on the four such
openings read, Width, Height and Depth are 100/2100/810 and 300/2100/1210 mm,
the same way round as on any rectangular opening. Height is the outline's
(2.1000 m on all four). Width is left out: the outline along the wall is
0.1000 and 0.3002 m, 0.2 mm off Revit's on two of the four.
… gets no Perimeter (#1208)

A sketch arc reaches the outline as chords within 0.0005 ft of it, so the
polygon's length is short of the arc's by about a third of sagitta over
radius, which the measurement would read as different wherever arcs are more
than a small share of the loop. No corner between two chords is square, so an
outline whose corners are all right angles holds no arc. Found by the second
read; no measured roof has an arc.
…ter-2

# Conflicts:
#	docs/evidence.md
#	docs/supported-profile.md
@DrunkOnJava
DrunkOnJava merged commit 000fc1a into main Nov 12, 2026
36 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/1208-roof-perimeter-2 branch November 12, 2026 01:18
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.
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