Skip to content

IfcSpace is written into its storey's IfcRelContainedInSpatialStructure instead of IfcRelAggregates (SPS002, SPS007) #743

Closed

Description

@helenkwok

Description

rvt-ifc lists every room's IfcSpace among the elements of its storey's IfcRelContainedInSpatialStructure. In IFC4 that relation holds elements, grids and annotations; a space is a spatial element and belongs in the spatial decomposition through IfcRelAggregates. As written, no IfcSpace has a parent in the spatial tree:

  • buildingSMART's validation rules flag it: SPS002 (each IfcSpatialElement aggregated as per the spatial composition table) and SPS007 ("All other IFC entities must not be contained within a spatial structure").
  • IfcOpenShell finds no container or aggregate for the space (IfcSpace has no ContainedInStructure inverse in IFC4), so a reader that walks the tree finds no storey for the room, nor for anything contained in it.

The second point became visible with B63: on main, furniture, fixtures and equipment are contained in their room's space, so they lose their storey too. Measured on Autodesk's Snowdon Towers Sample Architectural (Revit 2024; built with #737 so the file reads) against a Revit 2024 IFC4 Reference View export of the same file (build 24.3.50.51), matching by Tag: 5,945 elements in both; with v0.4.0, 5,581 sit on Revit's storey; on main + #737, 4,813, and 785 are in an IfcSpace that has no storey.

Reproduce

rvt-ifc 2024_Core_Interior.rvt -o ci.ifc       # magnetar-io corpus
python -c "import ifcopenshell, ifcopenshell.util.element as ue; f=ifcopenshell.open('ci.ifc'); \
print(sum(1 for s in f.by_type('IfcSpace') if ue.get_aggregate(s)), 'of', len(f.by_type('IfcSpace')), 'spaces have a parent')"
# 0 of 116

A pull request with a fix follows: each space is aggregated into its storey, or into the building where no storey join reached it.

Activity

  1. added a commit that references this issue on Oct 18, 2026
    b88b543
  2. DrunkOnJava commented on Oct 18, 2026

    @DrunkOnJava
    Owner

    This shipped in v0.5.0 with your #744: each IfcSpace is aggregated into its storey. The changelog's "Upgrading from 0.4" covers it for anyone reading rooms from the containment relation. v0.5.1 is the latest release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions