ifcopenshell.api.library.assign_reference#

Module Contents#

class ifcopenshell.api.library.assign_reference.Usecase(file, product=None, reference=None)#

Associates a product with a library reference

A product may be associated with zero, one, or many references across multiple libraries. See ifcopenshell.api.library.add_reference for more detail about how references work.

Parameters
Returns

The IfcRelAssociatesLibrary relationship entity

Return type

ifcopenshell.entity_instance.entity_instance

Example:

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

# Let's create a reference to a single AHU in our Brickschema dataset
reference = ifcopenshell.api.run("library.add_reference", model, library=library)
ifcopenshell.api.run("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.run("root.create_entity", model,
    ifc_class="IfcUnitaryEquipment", predefined_type="AIRHANDLER")

# And now assign the IFC model's AHU with its Brickschema counterpart
ifcopenshell.api.run("library.assign_reference", model, reference=reference, product=ahu)
execute(self)#
get_ifc2x3_rels(self)#