Repository navigation
feat(ifc): write a sloped floor's Qto_SlabBaseQuantities Depth and GrossVolume (#1208) - #1751
Conversation
|
Measured with nine other drafts (run 43086493417, rows on #1636). On the slabs it is right: |
… (#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
|
Unblocked and measured again. #1772 closed when #1789 landed: the housing terrain floors 1455094 and 1455321 are written as Measure 43541440209, unfiltered against
The worry from the last run, two values on the housing terrain floor that Revit's export writes as |
|
Measure 43547111516 of head 86b47eb (with the Revit 2024 gate, |
Summary
Revit's export writes
Qto_SlabBaseQuantities.DepthandGrossVolumeon 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 singleNon-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 itsDepthas its type's layers' total thickness times the cosine of the slope, and itsGrossVolumeas that times itsGrossArea. 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)andGrossVolume = GrossArea · Depth, withtthe type's layers' total thickness, which the same export writes asNetVolume / GrossArea:PitchAngleDepth(mm)t(mm)GrossArea(m2)GrossVolume(m3)tis 50 mm for the one-layerAP-3.Reunakorokegutter floors and 280 mm (80 + 100 + 100) for the three-layerAP-1base slabs; on both the cosine was checked to 3e-7 relative from Revit's ownPitchAngle, andGrossArea · Depthreproduces everyGrossVolumeabove.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), itsGrossAreaandNetVolumeare Revit's (NetVolume / GrossAreais the samet: 0.234900 / 0.011745 for 1994321, 2.344386 / 0.656428 for 2057322), and itsPitchAngleis 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), whilem_slab_layersis pushed only where the record box equals the layers' total, so on a sloped floor, whose box is deeper, the existingleveltest is false and neitherDepthnorGrossVolumewas reached. That is the whole gap for these 8.Why the code left them out.
add_slab_gross_areawroteDepth/GrossVolumeonly wherelevelheld and the floor had one layer ((level && (roof || one_layer))), andlevelneeds 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 "Depthof the 8 sloped floors" as not written.What stays without, and why.
VP-1,VP-2,AP-1flat). 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.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.BodySourcenative_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_areatakes theshaped_floorflag the caller already computes and, on such a floor, writesDepthasm_slab_type_thickness / sqrt(1 + gradient²)(the cosine of the angleadd_shaped_floor_pitchwrites) andGrossVolumeasGrossAreatimes it. Nothing else about the set changes;GrossAreaandNetVolumeare written as before. The call site passesshaped_floor.docs/supported-profile.md,docs/evidence.md,docs/release-1.0-criteria.md,docs/format-reconnaissance.md: the sentence that states a floor'sDepthandGrossVolumenow states the sloped floor's, and what remains out.changelog.d/added/1208-sloped-floor-depth.md: the fragment.What was not checked
crate::partition_schema_mvp::slab_top_plane_from_fields,SLAB_TYPE_THICKNESS_FIELD,InstanceField::Floatand the existingPositiveLengthFeet/VolumeCubicFeetwriters, but no compiler has seen it.PitchAngleon 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.Depthequal 23 → 31 of 42 andGrossVolume23 → 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).max(1e-6, 1e-5 · x); the measurement is the check of that.Depthanother 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_areaand the run on this PR, 2026-11-14), so it goes through review as any other PR.