resource.remove_resource - fix issue removing resources in ifc2x3

This commit is contained in:
Andrej730
2024-06-03 12:37:56 +05:00
parent c399eb259a
commit 5fb7e6e375
2 changed files with 22 additions and 2 deletions
@@ -74,8 +74,9 @@ def remove_resource(file: ifcopenshell.file, resource: ifcopenshell.entity_insta
file.remove(inverse)
if history:
ifcopenshell.util.element.remove_deep2(file, history)
if settings["resource"].Usage:
file.remove(settings["resource"].Usage)
# Usage was added in IFC4.
if usage := getattr(settings["resource"], "Usage", None):
file.remove(usage)
if settings["resource"].BaseQuantity:
ifcopenshell.api.run(
"resource.remove_resource_quantity",