Module Contents

ifcopenshell.api.project.unassign_declaration.unassign_declaration(file: ifcopenshell.file, definitions: list[ifcopenshell.entity_instance], relating_context: ifcopenshell.entity_instance) None

Unassigns a list of objects from a project or project library

Typically used to remove an asset from a project library.

  • definitions (list[ifcopenshell.entity_instance]) – The list of objects you want to undeclare. Typically a list of assets.

  • relating_context (ifcopenshell.entity_instance) – The IfcProject, or more commonly the IfcProjectLibrary that you want the object to no longer be part of.



Return type:



# Programmatically generate a library. You could do this visually too.
library = ifcopenshell.api.run("project.create_file")
root = ifcopenshell.api.run("root.create_entity", library, ifc_class="IfcProject", name="Demo Library")
context = ifcopenshell.api.run("root.create_entity", library,
    ifc_class="IfcProjectLibrary", name="Demo Library")

# It's necessary to say our library is part of our project.
ifcopenshell.api.run("project.assign_declaration", library, definitions=[context], relating_context=root)

# Remove the library from our project
ifcopenshell.api.run("project.unassign_declaration", library, definitions=[context], relating_context=root)