Skip to content

fix(ifc): a family instance whose Export to IFC As is IfcSpace is an IfcSpace typed by an IfcSpaceType of its type (#763) - #863

Merged
DrunkOnJava merged 5 commits into
mainfrom
fix/763-family-spaces
Oct 20, 2026
Merged

DrunkOnJava merged 5 commits into
mainfrom
fix/763-family-spaces

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

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 Space family instances carry "Export to IFC As" IfcSpace, with USERDEFINED as their own predefined type. Revit's export writes them as IfcSpace. rvt-rs wrote them as proxies contained in the room around them.

  • category_map::EXPORT_OVERRIDE_TARGETS gains IfcSpace. A class that is a space already (Room, Area, Space) keeps its own mapping, so no room changes.
  • An element written as a space through its value takes its own predefined type where it is an IfcSpaceTypeEnum enumerator (category_map::space_predefined_type_for). Rooms are not looked up, because their own value is not measured against Revit's export.
  • Such a space gets Pset_SpaceCommon with its type's name as Reference, and IsExternal where it is read.
  • In contain_in_spaces it holds no furniture; the furniture around it stays in its room.
  • The writer types it by an IfcSpaceType named after the type alone, as Revit's export does. Rooms keep their own IfcSpaceType (B78).
  • One divergence from Revit, on purpose. Revit's export places these spaces in no spatial structure. IFC4's IfcSpatialStructureElement.WR41 requires 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.py comes from the research branch re/763-family-spaces, and Measure runs it. It finds Revit's family spaces by their Family:Type:ElementId name 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:

  • The 42 spaces (tagged_spaces_vs_ifc). Every one is now an IfcSpace. Name, LongName, ObjectType, PredefinedType, type object (entity, name, predefined type), Pset_SpaceCommon.Reference and Pset_SpaceCommon.IsExternal are equal to Revit's on 42 of 42. The spatial relation differs on 42, as above.
  • Spaces paired by class (class_sets_vs_ifc). IfcSpace goes from 264 to 306 of Revit's 308. The 2 left are the VOLUME masses, which rvt-rs does not write (BIM4LCA office: 2 mass instances Revit writes as IfcSpace are not written (VOLUME / OFFICE, VOLUME / GARAGE) #864).
  • GlobalIds (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.
  • Property sets (psets_vs_ifc).
    • Pset_SpaceCommon.Reference and IsExternal are equal on 296 of 296.
    • Values rvt-rs writes that Revit does not drop from 621 to 495: the 42 proxies' Pset_BuildingElementProxyCommon and Pset_EnvironmentalImpactIndicators sets are gone.
  • Types (type_objects_vs_ifc). Elements typed in rvt-rs's export but not in Revit's go from 83 to 41.
  • Storeys (storeys_vs_ifc). The 42 are on the storey their record names, and Revit's are on none.
  • Validation (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.

…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.
…ances, run by Measure (#763)

(cherry picked from commit 63a5ddd)
…Family:Type:ElementId name, since IfcSpace has no Tag (#763)

(cherry picked from commit b76c130)
@DrunkOnJava
DrunkOnJava force-pushed the fix/763-family-spaces branch from 14a81fa to 2453577 Compare October 20, 2026 04:41
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 20, 2026 04:41
@DrunkOnJava
DrunkOnJava merged commit 9716389 into main Oct 20, 2026
30 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/763-family-spaces branch October 20, 2026 04:45

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/ifc/step_writer.rs
"IFCDOOR" | "IFCWINDOW" => format!("{pt},.NOTDEFINED.,$,$"),
"IFCFURNITURE" => format!(".NOTDEFINED.,{pt}"),
// #763: a family instance written as a space; `LongName` follows.
"IFCSPACE" => format!("{pt},$"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

DrunkOnJava added a commit that referenced this pull request Oct 20, 2026
…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.
DrunkOnJava added a commit that referenced this pull request Oct 20, 2026
… 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.
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 31, 2026
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.

Nordic LCA office: Revit's export has 44 family instances as IfcSpace (their own Export to IFC As) that rvt-rs writes as proxies

1 participant