ifcopenshell.api.spatial.dereference_structure

Module Contents

ifcopenshell.api.spatial.dereference_structure.dereference_structure(file: ifcopenshell.file, products: list[ifcopenshell.entity_instance], relating_structure: ifcopenshell.entity_instance) None

Dereferences a list of products and space

Parameters:
  • products (list[ifcopenshell.entity_instance]) – The list of physical IfcElements that exists in the space.

  • relating_structure – The IfcSpatialStructureElement element, such as IfcBuilding, IfcBuildingStorey, or IfcSpace that the element exists in.

Returns:

None

Return type:

None

Example:

project = ifcopenshell.api.root.create_entity(model, ifc_class="IfcProject")
site = ifcopenshell.api.root.create_entity(model, ifc_class="IfcSite")
building = ifcopenshell.api.root.create_entity(model, ifc_class="IfcBuilding")
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")

# 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)

# Create a column, this column spans 3 storeys
column = ifcopenshell.api.root.create_entity(model, ifc_class="IfcWall")

# The column is contained in the lowermost storey
ifcopenshell.api.spatial.assign_container(model, products=[column], relating_structure=storey1)

# And referenced in the others
ifcopenshell.api.spatial.reference_structure(model, products=[column], relating_structure=storey2)
ifcopenshell.api.spatial.reference_structure(model, products=[column], relating_structure=storey3)

# Actually, it only goes up to storey 2.
ifcopenshell.api.spatial.dereference_structure(model, products=[column], relating_structure=storey3)