From ece7d6b97f0446d69a5782aac2cef3874f5409a7 Mon Sep 17 00:00:00 2001 From: Richard Brice <37087370+RickBrice@users.noreply.github.com> Date: Tue, 24 Feb 2026 14:54:26 -0800 Subject: [PATCH] Fixes example in documentation --- .../ifcopenshell/api/spatial/reference_structure.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/spatial/reference_structure.py b/src/ifcopenshell-python/ifcopenshell/api/spatial/reference_structure.py index 4446971f0d..f19be2360b 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/spatial/reference_structure.py +++ b/src/ifcopenshell-python/ifcopenshell/api/spatial/reference_structure.py @@ -63,14 +63,15 @@ def reference_structure( storey1 = ifcopenshell.api.root.create_entity(model, ifc_class="IfcBuildingStorey") storey2 = ifcopenshell.api.root.create_entity(model, ifc_class="IfcBuildingStorey") storey3 = ifcopenshell.api.root.create_entity(model, ifc_class="IfcBuildingStorey") + space = ifcopenshell.api.root.create_entity(model, ifc_class="IfcSpace") # The project contains a site (note that project aggregation is a special case in IFC) ifcopenshell.api.aggregate.assign_object(model, products=[site], relating_object=project) # The site has a building, the building has a storey, and the storey has a space ifcopenshell.api.aggregate.assign_object(model, products=[building], relating_object=site) - ifcopenshell.api.aggregate.assign_object(model, products=[storey], relating_object=building) - ifcopenshell.api.aggregate.assign_object(model, products=[space], relating_object=storey) + ifcopenshell.api.aggregate.assign_object(model, products=[storey1,storey2,storey3], relating_object=building) + ifcopenshell.api.aggregate.assign_object(model, products=[space], relating_object=storey1) # Create a column, this column spans 3 storeys column = ifcopenshell.api.root.create_entity(model, ifc_class="IfcWall") @@ -80,7 +81,11 @@ def reference_structure( # And referenced in the others ifcopenshell.api.spatial.reference_structure( - model, products=[column], relating_structure=[storey2, storey3] + model, products=[column], relating_structure=storey2 + ) + + ifcopenshell.api.spatial.reference_structure( + model, products=[column], relating_structure=storey3 ) """