ifcopenshell.api.project.unassign_declaration#

Module Contents#

class ifcopenshell.api.project.unassign_declaration.Usecase(file, definition=None, relating_context=None)#

Unassigns an object to a project or project library

Typically used to remove an asset from a project library.

Parameters
Returns

None

Return type

None

Example:

# 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, definition=context, relating_context=root)

# Remove the library from our project
ifcopenshell.api.run("project.unassign_declaration", library, definition=context, relating_context=root)
execute(self)#