ifcopenshell.api.library.add_reference
¶
Module Contents¶
- ifcopenshell.api.library.add_reference.add_reference(file: ifcopenshell.file, library: ifcopenshell.entity_instance) ifcopenshell.entity_instance ¶
Adds a new reference to a library
A library represents an external data source, such as a database, spreadsheet, API, or something else that contains information related to the IFC project. Within a library, there will be one or more references, such as reference to a particular table or row in a database, or a sheet and row or column in a spreadsheet, a URI in a linked data Brickschema file, 32-bit decimal BACnetObjectIdentifier in a BACnet system, IP address in a network, and so on.
These references can then be related to IFC elements. You cannot relate an IFC element directly to a library, it must be related to one of the library’s references.
- Parameters:
library (ifcopenshell.entity_instance) – The IfcLibraryInformation element to add a reference to
- Returns:
The newly created IfcLibraryReference element
- Return type:
ifcopenshell.entity_instance
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"})