ifcopenshell.api.library.unassign_reference

Module Contents

ifcopenshell.api.library.unassign_reference.unassign_reference(file: ifcopenshell.file, reference: ifcopenshell.entity_instance, products: list[ifcopenshell.entity_instance]) None

Unassigns a product of products from a reference

If the product isn’t assigned to the reference, nothing will happen.

Parameters:
  • reference (ifcopenshell.entity_instance) – The IfcLibraryReference to unassign from

  • products (list[ifcopenshell.entity_instance]) – A list of IfcProduct elements to unassign from the reference

Returns:

None

Return type:

None

Example:

library = ifcopenshell.api.library.add_library(model, name="Brickschema")

# Let's create a reference to a single AHU in our Brickschema dataset
reference = ifcopenshell.api.library.add_reference(model, library=library)
ifcopenshell.api.library.edit_reference(model,
    reference=reference, attributes={"Identification": "http://example.org/digitaltwin#AHU01"})

# Let's assume we have an AHU in our model.
ahu = ifcopenshell.api.root.create_entity(model,
    ifc_class="IfcUnitaryEquipment", predefined_type="AIRHANDLER")

# And now assign the IFC model's AHU with its Brickschema counterpart
ifcopenshell.api.library.assign_reference(model, reference=reference, products=[ahu])

# Let's change our mind and unassign it.
ifcopenshell.api.library.unassign_reference(model, reference=reference, products=[ahu])