Skip to content

feat(ifc): a flat roof written as a slab carries its Qto_SlabBaseQuantities.Perimeter (#1208) - #1774

Closed
DrunkOnJava wants to merge 2 commits into
mainfrom
feat/1208-roof-perimeter
Closed

DrunkOnJava wants to merge 2 commits into
mainfrom
feat/1208-roof-perimeter

Conversation

@DrunkOnJava

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. The eight changes that held are stacked again on main and measured once more in full (run 43095382793, head 52e59f81, rows registered first); this description is updated when that run is read.

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.

Still open

  • A roof whose profile has holes gets none: whether Revit counts a hole's outline is not measured.
  • 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 2 of 8 measured together; each branch holds the ones before it, so its own diff is its last commits until those land. First draft: #1752.

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.

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.

@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Superseded by #1785: the stack was rebuilt after the second read (the pipe change left it and two rules were narrowed), so this change sits on new commits.

DrunkOnJava added a commit that referenced this pull request Nov 12, 2026
…tities.Perimeter where its outline is square-cornered (#1208) (#1785)

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

- 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
the six batch changes before this one landed). This head, `99db61c5`, is
`main` at `1fe64d99` merged in, with two docs lines merged word by word;
its change against `main` is this pull request's own two commits and
nothing else (byte-equal outside `docs/`, word-equal inside). 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 feat/1208-roof-perimeter 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