Repository navigation
fix(ifc): a family instance whose Export to IFC As is IfcSpace is an IfcSpace typed by an IfcSpaceType of its type (#763) - #863
Conversation
43fe1de to
14a81fa
Compare
…IfcSpace typed by an IfcSpaceType of its type (#763) IfcSpace joins the export override targets, with the element's own predefined type where it is an IfcSpaceTypeEnum enumerator (category_map::space_predefined_type_for; rooms are not looked up, as their own value is not measured). A class that is a space already keeps its own mapping. Such a space gets Pset_SpaceCommon with its type's name as Reference, holds no furniture in contain_in_spaces, and is typed by an IfcSpaceType named after the type alone, as Revit's export of the BIM4LCA office writes its 42 Turning Free Space instances (Measure run 39188949275). Revit places them in no spatial structure; IFC4 WR41 requires one, so they are aggregated under their storey as rooms are.
…alues agree with Revit's (#763)
14a81fa to
2453577
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 245357762e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "IFCDOOR" | "IFCWINDOW" => format!("{pt},.NOTDEFINED.,$,$"), | ||
| "IFCFURNITURE" => format!(".NOTDEFINED.,{pt}"), | ||
| // #763: a family instance written as a space; `LongName` follows. | ||
| "IFCSPACE" => format!("{pt},$"), |
There was a problem hiding this comment.
Populate ElementType for USERDEFINED space types
For the targeted family spaces, predefined is USERDEFINED, but this tail is appended after the type emitter has already hard-coded the inherited ElementType slot to $, so each resulting IfcSpaceType has .USERDEFINED. with no ElementType. IFC4's CorrectPredefinedType rule explicitly requires ElementType whenever an IfcSpaceType is USERDEFINED (buildingSMART IFC4 specification); consequently the new exports are formally schema-invalid despite having the correct arity. Thread the family type name into ElementType for this case instead of leaving the slot null.
Useful? React with 👍 / 👎.
…lan union of its upward faces, so a sloped top counts whole (#824) (#866) Part of #824. `tools/re/plan_profiles_vs_ifc.py` kept only the upward faces at a body's highest level. Revit writes a layered floor as one solid per layer, so that filter stopped each layer from being counted. On a tilted floor, though, the faces at the highest level are one triangle of the top's two. So the BIM4LCA office's 8 sloped floors read as exactly twice Revit's area, and looked like triangles (#824, the comment of 2026-10-20). The scorer now takes the plan union of every upward face. That still counts a stacked layer's outline once, and it keeps a sloped top whole. Points and the outline come from all upward faces. ## Measured Measure run [39370597357](https://github.com/DrunkOnJava/rvt-rs/actions/runs/39370597357) scored the same exports as main's latest run. Main's own exports did not change between the two (#861 and #863 touched no slab). | model | area off (before → after) | outline off | vertices off | |---|---|---|---| | office, as built | 31 → 23 | 31 → 23 | 35 → 29 | | office, permit | 32 → 24 | 33 → 25 | 37 → 31 | | Core Interior | unchanged (80 of 80) | unchanged | unchanged | | RE1 Architecture | unchanged | unchanged | unchanged | The 8 slabs that move are the sloped floors. Their outline was always Revit's: the gap is their slope, which rvt-rs does not read and this scorer does not compare. Tooling only; no export changes.
… it, as Revit's export writes the office's VOLUME masses (#867) ## Summary Closes #864. rvt-rs read no mass instances, because `OST_Mass` was not one of the element-record categories. The BIM4LCA office's two `VOLUME` masses carry "Export to IFC As" `IfcSpace`, and Revit's export writes them as `IfcSpace`. - `OST_Mass` joins `PRODUCT_RECORD_CATEGORIES` and `RECOVERED_CATEGORIES`. - A mass is written only where its own "Export to IFC As" names an entity. Revit's exporter does not write the mass category by default. Measured: one decoded mass on Autodesk's 2019 basic sample carries no value and is not written. - With #863's `IfcSpace` target, the two masses become `IfcSpace` with their own predefined types (`NOTDEFINED`, `PARKING`) and `IfcSpaceType`s. ## Measured Measure A/B against main with the office files and the sample projects, run [39372962012](https://github.com/DrunkOnJava/rvt-rs/actions/runs/39372962012). On each office file: - `tagged_spaces_vs_ifc`: on 44 of 44 family spaces, Name, LongName, ObjectType, PredefinedType, type object, `Pset_SpaceCommon.Reference` and `IsExternal` equal Revit's (42 before). The two masses have no storey, so they are aggregated under the building rather than placed in nothing, as IFC4 WR41 requires (see #863). - `class_sets_vs_ifc`: `IfcSpace` pairs 308 of 308. - `global_ids_vs_ifc`: all 308 spaces equal one of Revit's. - The validator and the IFC4 property set check give 0 findings. Only the two office exports change. The samples' diagnostics count the decoded masses: the 2019 basic sample has one, and it is not written.
Summary
Closes #763 for its 42 family instances; the 2 masses Revit also writes as spaces are now #864. On the BIM4LCA office files, 42
Turning Free Spacefamily instances carry "Export to IFC As"IfcSpace, withUSERDEFINEDas their own predefined type. Revit's export writes them asIfcSpace. rvt-rs wrote them as proxies contained in the room around them.category_map::EXPORT_OVERRIDE_TARGETSgainsIfcSpace. A class that is a space already (Room, Area, Space) keeps its own mapping, so no room changes.IfcSpaceTypeEnumenumerator (category_map::space_predefined_type_for). Rooms are not looked up, because their own value is not measured against Revit's export.Pset_SpaceCommonwith its type's name asReference, andIsExternalwhere it is read.contain_in_spacesit holds no furniture; the furniture around it stays in its room.IfcSpaceTypenamed after the type alone, as Revit's export does. Rooms keep their ownIfcSpaceType(B78).IfcSpatialStructureElement.WR41requires every spatial structure element except the root to be aggregated in the project or another spatial element. So rvt-rs aggregates each under its storey, as it does rooms.tools/re/tagged_spaces_vs_ifc.pycomes from the research branchre/763-family-spaces, and Measure runs it. It finds Revit's family spaces by theirFamily:Type:ElementIdname and now counts which of each space's values agree.Measured
Measure A/B against main with the office files and the sample projects, run 39368663999. On each office file, as built and permit:
tagged_spaces_vs_ifc). Every one is now anIfcSpace. Name, LongName, ObjectType, PredefinedType, type object (entity, name, predefined type),Pset_SpaceCommon.ReferenceandPset_SpaceCommon.IsExternalare equal to Revit's on 42 of 42. The spatial relation differs on 42, as above.class_sets_vs_ifc).IfcSpacegoes from 264 to 306 of Revit's 308. The 2 left are theVOLUMEmasses, which rvt-rs does not write (BIM4LCA office: 2 mass instances Revit writes as IfcSpace are not written (VOLUME / OFFICE, VOLUME / GARAGE) #864).global_ids_vs_ifc). All 306 spaces now equal one of Revit's, where 264 did before. The 42 elements that were "not in Revit's export" are gone.psets_vs_ifc).Pset_SpaceCommon.ReferenceandIsExternalare equal on 296 of 296.Pset_BuildingElementProxyCommonandPset_EnvironmentalImpactIndicatorssets are gone.type_objects_vs_ifc). Elements typed in rvt-rs's export but not in Revit's go from 83 to 41.storeys_vs_ifc). The 42 are on the storey their record names, and Revit's are on none.schema.txt). The IfcOpenShell validator and the IFC4 property set check give 0 findings on both files.The reference models and the sample projects export byte-identically.