ifcopenshell.api.spatial.unassign_container

Module Contents

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

Unassigns a container from products.

Parameters:

product (list[ifcopenshell.entity_instance]) – A list of IfcProducts to remove the containment from.

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")
storey = 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)

# Create a wall
wall = ifcopenshell.api.root.create_entity(model, ifc_class="IfcWall")

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

# Not anymore!
ifcopenshell.api.spatial.unassign_container(model, products=[wall])