mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 21:53:40 +00:00
resource.remove_resource - fix issue removing resources in ifc2x3
This commit is contained in:
@@ -74,8 +74,9 @@ def remove_resource(file: ifcopenshell.file, resource: ifcopenshell.entity_insta
|
|||||||
file.remove(inverse)
|
file.remove(inverse)
|
||||||
if history:
|
if history:
|
||||||
ifcopenshell.util.element.remove_deep2(file, history)
|
ifcopenshell.util.element.remove_deep2(file, history)
|
||||||
if settings["resource"].Usage:
|
# Usage was added in IFC4.
|
||||||
file.remove(settings["resource"].Usage)
|
if usage := getattr(settings["resource"], "Usage", None):
|
||||||
|
file.remove(usage)
|
||||||
if settings["resource"].BaseQuantity:
|
if settings["resource"].BaseQuantity:
|
||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"resource.remove_resource_quantity",
|
"resource.remove_resource_quantity",
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# IfcOpenShell - IFC toolkit and geometry engine
|
||||||
|
# Copyright (C) 2024 Dion Moult <dion@thinkmoult.com>
|
||||||
|
#
|
||||||
|
# This file is part of IfcOpenShell.
|
||||||
|
#
|
||||||
|
# IfcOpenShell is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# IfcOpenShell is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
|
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# remove_resource tests is partially covered by test_add_resource_quantity.
|
||||||
Reference in New Issue
Block a user