Skip to content

feat(ifc): write a sloped floor's Qto_SlabBaseQuantities Depth and GrossVolume (#1208) - #1751

Merged
DrunkOnJava merged 5 commits into
mainfrom
pilot/21-slab-depth-grossvolume
Nov 14, 2026
Merged

DrunkOnJava merged 5 commits into
mainfrom
pilot/21-slab-depth-grossvolume

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Revit's export writes Qto_SlabBaseQuantities.Depth and GrossVolume on 42 objects of the BIM4LCA office as built; rvt-rs writes them on 23. The 19 missing are exactly the 10 level floors of several layers, the 8 sloped floors and the single Non-Monolithic Landing (13 one-layer floors + 10 several-layer + 10 roofs + 8 sloped + 1 landing = 42).

Of those 19, 8 are closable: a floor drawn along the plane of its shape-edited corners, which #1384/RE-384 already draws and gives a PitchAngle. This writes its Depth as its type's layers' total thickness times the cosine of the slope, and its GrossVolume as that times its GrossArea. The other 11 stay without (below).

Evidence

The rule. For each of the 8 sloped slabs, Revit's own export satisfies Depth = t · cos(PitchAngle) and GrossVolume = GrossArea · Depth, with t the type's layers' total thickness, which the same export writes as NetVolume / GrossArea:

Tag type PitchAngle Revit Depth (mm) t (mm) Revit GrossArea (m2) Revit GrossVolume (m3)
1994321 AP-3 3.945186 49.88151642 50 0.2349 0.01171716821
1994605 AP-3 3.945186 49.88151642 50 0.2349 0.01171716821
1994706 AP-3 1.885600 49.97292587 50 0.49277814 0.02462556558
1994714 AP-3 4.365258 49.85495444 50 0.53055000 0.02645054608
2057322 AP-1 21.637854 260.26926065 280 2.34438563 0.61017151567
2057673 AP-1 21.637941 260.26910331 280 2.34437521 0.61016843392
2058504 AP-1 24.041490 255.71019113 280 2.08475000 0.53309182096
2070694 AP-1 22.623095 258.45546668 280 2.23164562 0.57678100942

t is 50 mm for the one-layer AP-3.Reunakoroke gutter floors and 280 mm (80 + 100 + 100) for the three-layer AP-1 base slabs; on both the cosine was checked to 3e-7 relative from Revit's own PitchAngle, and GrossArea · Depth reproduces every GrossVolume above.

rvt-rs already holds the inputs. On the same 8 elements its export carries BodySource = native_slab_shape_edit (exactly 8 in the office as built), its GrossArea and NetVolume are Revit's (NetVolume / GrossArea is the same t: 0.234900 / 0.011745 for 1994321, 2.344386 / 0.656428 for 2057322), and its PitchAngle is Revit's to 2e-7 rad (RE-384). m_slab_type_thickness (SLAB_TYPE_THICKNESS_FIELD) is pushed for every floor with layers (RE-295), while m_slab_layers is pushed only where the record box equals the layers' total, so on a sloped floor, whose box is deeper, the existing level test is false and neither Depth nor GrossVolume was reached. That is the whole gap for these 8.

Why the code left them out. add_slab_gross_area wrote Depth/GrossVolume only where level held and the floor had one layer ((level && (roof || one_layer))), and level needs the record box to be the layers' total, which a sloped floor's box is not. RE-238 recorded the 8 as drawn level; #1384 and RE-384 changed that, and RE-384 §4 named the angle as "the input they need". Issue #1208 still lists "Depth of the 8 sloped floors" as not written.

What stays without, and why.

  • The 10 level floors of several layers (VP-1, VP-2, AP-1 flat). RE-298 §3 wrote them once and measured them; Revit 26.4's export of a held-out Revit 2026 house gives 2 such slabs another value, and the maintainer's standing rule (2026-10-31) leaves out a value the exporters disagree on. Not reopened.
  • The Non-Monolithic Landing (Tag 3058084), the stair landing Revit draws as a slab; its quantities are W7: single-layer slabs' Width and Length, sloped floors' Depth and the stair landings' volume (RE-295, RE-298) #1208's and RE-295 §5's, unrelated to the slope.
  • A sloped floor on which rvt-rs has not read the plane, the type's layers, or a slope (a level plane is left to the existing rule) gets nothing: the new branch is taken only where the body is drawn from the plane (BodySource native_slab_shape_edit), the floor is not a roof, the plane has a non-zero gradient, and the type's thickness is positive and finite.

Changes

  • src/ifc/export_content.rs: add_slab_gross_area takes the shaped_floor flag the caller already computes and, on such a floor, writes Depth as m_slab_type_thickness / sqrt(1 + gradient²) (the cosine of the angle add_shaped_floor_pitch writes) and GrossVolume as GrossArea times it. Nothing else about the set changes; GrossArea and NetVolume are written as before. The call site passes shaped_floor.
  • docs/supported-profile.md, docs/evidence.md, docs/release-1.0-criteria.md, docs/format-reconnaissance.md: the sentence that states a floor's Depth and GrossVolume now states the sloped floor's, and what remains out.
  • changelog.d/added/1208-sloped-floor-depth.md: the fragment.

What was not checked

  • I could not compile, so CI must confirm the build: the new arm uses only crate::partition_schema_mvp::slab_top_plane_from_fields, SLAB_TYPE_THICKNESS_FIELD, InstanceField::Float and the existing PositiveLengthFeet / VolumeCubicFeet writers, but no compiler has seen it.
  • I could not measure. The office as built was checked element by element; the office at permit was not, though it holds the same 8 slabs (RE-384 reads PitchAngle on 62 of 62 slabs of both files) and the census has the same 19 missing on both. Measure must show, on both office files: Qto_SlabBaseQuantities.Depth equal 23 → 31 of 42 and GrossVolume 23 → 31 of 42, missing 19 → 11, different unchanged at 0, and no value rvt-rs writes that Revit's export does not; every other export should be byte-identical, since no other model holds a floor drawn along its plane (RE-384).
  • The written value is rounded to six decimals in feet, which is 3e-7 m on a 50 mm depth and 3e-7 m on a 260 mm one, inside the scorer's max(1e-6, 1e-5 · x); the measurement is the check of that.
  • Only Revit 24.0.5's exporter is evidenced: the 8 floors exist in one project's two states. If a later exporter wrote a sloped floor's Depth another way, nothing in these two files would show it; no held-out model has such a floor to test it against.

Drafted by the 2026-11-11 worker pilot; read line by line and measured by rvtDevelop (the diff of add_slab_gross_area and the run on this PR, 2026-11-14), so it goes through review as any other PR.

@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Measured with nine other drafts (run 43086493417, rows on #1636). On the slabs it is right: Qto_SlabBaseQuantities.Depth and GrossVolume gain 8 each on all four BIM4LCA office files (23 to 31 of 42 on the concrete office, 21 to 29 and 14 to 22 of 41 on the timber office), none different. It still does not go forward as it is: on both housing terrain models it writes the two values on floor 1455321, which Revit's export writes as an IfcGeographicElement with no slab quantities, so "values Revit does not write" goes from 6 to 8 there. The six already there are on that floor and floor 1455094, which rvt-rs writes as IfcSlab: that is #1772, and this draft waits on it (or on a rule that leaves such a floor out).

DrunkOnJava added a commit that referenced this pull request Nov 11, 2026
… (#1789)

## Summary

On the BIM4LCA housing terrain model, 23 elements carry an "Export to
IFC As" of `IfcGeographicElement` and Revit's own export writes every
one of them as that entity, while rvt-rs wrote them as `IfcFurniture`
(9), `IfcBuildingElementProxy` (12) and `IfcSlab` (2). The value was
read but not honoured: `EXPORT_OVERRIDE_TARGETS` had no
`IfcGeographicElement` entry, so `lookup_export_override_for` found
nothing and each element kept its category's entity. This adds the
target, limited to the four classes the export diagnostics name, with
the element's own or its type's "IFC Predefined Type" where that is an
`IfcGeographicElementTypeEnum` enumerator.

The two floors are the ones #1772 opened with (Tags 1455094 and 1455321,
`Floor:AP-nostopaikka.sijainti`): they are `IFCSLAB(..., '1455094',
.USERDEFINED.)` today and carry the six `Qto_SlabBaseQuantities` values
Revit does not write.

## Evidence

**The rule.** An element of class `Floor`, `Furniture`, `Planting` or
`SpecialtyEquipment` whose own or its type's "Export to IFC As" is
`IfcGeographicElement` is written as `IFCGEOGRAPHICELEMENT`, with
`PredefinedType` the element's own or its type's "IFC Predefined Type"
where that is one of IFC4's `IfcGeographicElementTypeEnum` values,
`TERRAIN`, `USERDEFINED` and `NOTDEFINED`, and `$` where it is not.

**What it covers, from `evidence/nordic-housing-terrain-concrete`**
(rvt-rs's diagnostics for the same model name exactly these 23:
"IfcGeographicElement on Furniture 9, IfcGeographicElement on Planting
9, IfcFlowTerminal on SpecialtyEquipment 3, IfcGeographicElement on
SpecialtyEquipment 3, IfcGeographicElement on Floor 2"):

- `class_sets_vs_ifc.txt`: Revit's 65 `IfcGeographicElement` are 0 same,
23 written as another class (`IfcFurniture` 9, `IfcBuildingElementProxy`
12, `IfcSlab` 2) and 42 absent. The 23 are exactly the elements carrying
the value; the 42 absent are `Toposolid` (5), `U2BicyclePost` (6) and
`Sub-Division` (31), classes rvt-rs does not map at all and which this
change does not touch.
- `predefined_types_vs_ifc.txt`: Revit's `IfcGeographicElementType`
carry `TERRAIN` 30, `USERDEFINED` 11, `NOTDEFINED` 1, and on the 23
elements Revit writes `USERDEFINED` on 20 and `NOTDEFINED` on 3. rvt-rs
reads those same values as the element's own or its type's "IFC
Predefined Type", so each of the 23 gets Revit's value: the 9 furniture,
6 planting, 3 specialty equipment and 2 floors `USERDEFINED`, the 3
planting `NOTDEFINED`. Checked in `rvt-rs.ifc`: 1421668 is
`IFCFURNITURE(..., .USERDEFINED.)`, 1414066 and 1393277 are
`IFCBUILDINGELEMENTPROXY(..., $)`, 1405092 `IFCBUILDINGELEMENTPROXY(...,
$)`, 1455094 `IFCSLAB(..., .USERDEFINED.)`.
- `qtos_vs_ifc.txt`: the six "rvt-rs quantities Revit does not write"
are all on the two floors (`Depth` 1, `GrossArea` 2, `GrossVolume` 1,
`NetVolume` 2), "Revit's Qto_SlabBaseQuantities: none". Traced in the
code: every slab quantity is gated on the entity, not the class.
`add_slab_gross_area` returns at `ifc_type != "IFCSLAB"`, `level_slab`
and `shaped_floor_body` likewise, and `add_slab_pitch` is only reached
through those two, so no slab set survives the entity change.
`Pset_SlabCommon` is not written either: `reference_set_kinds` filters
`STANDARD_PROPERTY_SETS` by `applies_to(ifc_type, ...)` and the set
applies to `IFCSLAB` alone, and `is_external_set` has no arm for the new
entity.
- `psets_vs_ifc.txt`: Revit writes no `Pset_SlabCommon` on the two
floors, no `Pset_FurnitureTypeCommon.Reference` on the 9 furniture and
no `Pset_BuildingElementProxyCommon` on the 12 proxies; all three are in
its "rvt-rs values Revit does not write" list, so they go with the
class. The measurement will give the new total (49 today).
- `type_objects_vs_ifc.txt`: "entity disagrees: 23
`IfcGeographicElement`" and "typed in ours: 501 of 501". Without a type
entity the 23 would lose their type object, so `type_entity_for` gains
`IFCGEOGRAPHICELEMENT` (tail `PredefinedType`, IFC4's
`IfcGeographicElementType` declaring nothing after `ElementType`) and
`revit_ifc_type_entity_name` gains its revit-ifc name for the hashed
GlobalId of a second type object of one type, as RE-417 did for
`IfcSolarDevice` and `IfcTransportElement` (commit 134db97). Each of
the 23 is then typed by an `IfcGeographicElementType` with `USERDEFINED`
or `NOTDEFINED`, both of which Revit writes.

**What it leaves out.** The value is acted on for the four classes only
(`OVERRIDE_CLASS_LIMITS`), because that is what is measured; revit-ifc
takes the entity from the value on any `IfcProduct`
(`ExporterUtil.GetExportType`), so the limit is the evidence's, not
Revit's. An element of those classes carrying the value but no "IFC
Predefined Type" is written with `$`: what Revit writes for one is not
measured, so the target's default is `None` rather than a guess. The 42
`IfcGeographicElement` of Revit's export that rvt-rs does not write at
all are `Toposolid`, `U2BicyclePost` and `Sub-Division`, unmapped
classes outside this task. The three `IfcFlowTerminal` on
`SpecialtyEquipment` are a different value with no target and stay
`IfcBuildingElementProxy`, as they are; the diagnostics will still count
them ("3 element(s) carry an "Export to IFC As" value the export does
not apply ... IfcFlowTerminal on SpecialtyEquipment 3").

**The body** is unchanged: geometry is chosen by the decoded class, not
the entity, so the 23 keep the bodies they have today.

**No other model moves.** The office as-built diagnostics list only
`IfcShadingDevice`, `IfcWall` and `IfcCovering` values, and the concrete
housing as-built carries no `IfcGeographicElement` value at all, so no
element of either changes class.

**The measurement this pull request must name**, on both housing terrain
models: of Revit's 65 `IfcGeographicElement`, how many rvt-rs writes as
that class (23 are written as another class today: `IfcFurniture` 9,
`IfcBuildingElementProxy` 12, `IfcSlab` 2, and 42 are absent and stay
absent), "rvt-rs quantities Revit does not write" 6 to 0, and no class
count moving on any other model.

## Changes

- `src/ifc/category_map.rs`: the `IfcGeographicElement` target, its
class limit to `Floor`, `Furniture`, `Planting` and
`SpecialtyEquipment`, the `IfcGeographicElementTypeEnum` enumerators in
`OVERRIDE_ONLY_ENUMERATORS`, and the doc comments.
- `src/ifc/step_writer.rs`: `IFCGEOGRAPHICELEMENT` typed by
`IFCGEOGRAPHICELEMENTTYPE`, and that entity's revit-ifc name for the
hashed GlobalId.
- `changelog.d/changed/1772-geographic-element.md`: the fragment.
- `docs/supported-profile.md`, `docs/evidence.md`,
`docs/support-matrix.json`: the honoured value and the evidence for it.

No unit tests added; no test pins a value this moves.

## What was not checked

I could not compile or run anything, so CI must confirm that the new
target, the class limit and the enumerator list build and pass clippy,
and that the writer emits `IFCGEOGRAPHICELEMENT(..., 'Tag',
.USERDEFINED.)` and `IFCGEOGRAPHICELEMENTTYPE(..., .USERDEFINED.)` with
the attribute counts IFC4 declares. The measurement must confirm, on
both terrain models, the class counts above, the six quantities going to
0, the `PredefinedType` of the 23 and of their type objects, the
property sets that go with the old classes, and that no other model's
class counts move. The timber terrain model's own diagnostics and export
were not in the evidence I could read: its 23 elements are assumed to be
the same as the concrete model's, and the measurement is what settles
it.

## Measured

Unfiltered Measure 43100947234 with the held-out pairs (head `4d047255`:
#1787's commit and this change's on top, against `main` at `e8a99d03`;
rows registered on #1636 before it was read; 42 shards and both
same-project gates pass). Only the four terrain models move for this
change.

| Model | Revit's `IfcGeographicElement` written as that class | written
as another class | "quantities Revit does not write" | "values Revit
does not write" |
|---|---:|---:|---:|---:|
| Housing terrain, concrete | 0 to 23 of 65 | 23 to 0 | 6 to 0 | 49 to 6
|
| Housing terrain, timber | 0 to 23 of 65 | 23 to 0 | 6 to 0 | 49 to 6 |
| Office terrain, concrete and timber | 0 to 1 of 105 each | 1 to 0 each
| unchanged | 2 to 0 each |

- `PredefinedType` same as Revit on the 20 `USERDEFINED` elements of
each housing terrain model and on the office terrain's one, differs 0;
the 3 Revit writes `NOTDEFINED` on are unset.
- "different" is unchanged in both censuses, and no value becomes
missing (1,575 and 1,578 property values equal before and after on the
housing terrain models).
- The cause was confirmed beforehand from rvt-rs's own diagnostics for
the housing terrain model: 26 elements carry an "Export to IFC As" value
the export does not apply, 23 of them `IfcGeographicElement`. The three
enumerators equal IfcOpenShell's IFC4 schema tables.

## Still open

- The 42 (housing) and 104 (office) terrain elements Revit writes as
`IfcGeographicElement` that rvt-rs does not write at all.
- The 3 elements Revit writes `NOTDEFINED` on.
- #1751 (a sloped floor's `Depth`) can come back once this lands: the
floor it tripped on is no longer a slab.

## Testing

- Built, linted and tested by CI on this head; nothing was built on a
workstation.
- Measure 43100947234 measured 4d04725, which is #1787's head 438473f
with this patch cherry-picked on top; the same-project gates verdict
(pass) and the semantic verdict are on that commit, not on this branch's
own head. #1787 has landed (`ed57e095`) and `main` is merged in here as
`7ccd202a`, a clean merge: `git diff origin/main 7ccd202 -- src` is
byte-equal to `git diff 438473f 4d04725 -- src` (index lines apart),
and the delta outside `src` is byte-equal to this branch's own commit's.
`main` also holds #1773 and #1771 since the run; neither touches
`category_map.rs` or the two lines of `step_writer.rs` this changes.
Measure 43108424934 measures this change again on `main` at `e7ac68e7`
with everything else unlanded.
- No test was added, and no pinned count moves: only the four terrain
models' exports change.

## Breaking changes

None.
…rossvolume

# Conflicts:
#	docs/evidence.md
#	docs/supported-profile.md
# Conflicts:
#	docs/evidence.md
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Unblocked and measured again. #1772 closed when #1789 landed: the housing terrain floors 1455094 and 1455321 are written as IfcGeographicElement, so this rule no longer reaches them. main is merged in (6a88622), and the PR's one doc conflict, a row of docs/evidence.md, keeps both sides.

Measure 43541440209, unfiltered against main (2b4f18b), with nordic, r2025, samples and holdout:

BIM4LCA office quantities equal different missing rvt-rs writes, Revit does not
concrete, as built 37,459 → 37,475 1 → 1 2,294 → 2,278 0 → 0
concrete, at permit 37,831 → 37,847 1 → 1 2,174 → 2,158 0 → 0
timber, as built 31,693 → 31,709 1 → 1 2,106 → 2,090 3 → 3
timber, at permit 31,502 → 31,518 1 → 1 2,165 → 2,149 3 → 3
  • That is 16 on each file: the 8 sloped floors' Qto_SlabBaseQuantities.Depth and GrossVolume, as the first run of this PR found.
  • Only these 4 exports move (116 of 120 byte for byte main's).
  • Every diagnostics.json is equal, and every held-out count is unchanged.
  • same-project gates passes on 6a88622.

The worry from the last run, two values on the housing terrain floor that Revit's export writes as IfcGeographicElement, is gone: the housing exports do not move.

@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 14, 2026 02:27
@DrunkOnJava
DrunkOnJava merged commit 837e620 into main Nov 14, 2026
37 checks passed
@DrunkOnJava
DrunkOnJava deleted the pilot/21-slab-depth-grossvolume branch November 14, 2026 03:28
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Measure 43547111516 of head 86b47eb (with the Revit 2024 gate, SLOPED_FLOOR_QUANTITIES_REVIT_VERSIONS = &[2024]) against 6a88622, the same code without the gate: 101 of 101 exports byte for byte the same, diagnostics 101 of 101 equal, no scorer output moved. The gate is output-neutral on every model measured: the sloped floors whose Depth and GrossVolume this writes are all on Revit 2024 files, and no 2025 to 2027 file in the run has one it would reach. The earlier full Measure's readings of the 2024 office stand for this head.

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