mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
owner.remove_person to remove IfcInventory in ifc2x3
This commit is contained in:
@@ -24,6 +24,8 @@ def remove_person(file, person=None) -> None:
|
||||
|
||||
All roles and addresses assigned to the person will also be
|
||||
removed.
|
||||
In IFC2X3 will also remove related inventories if `person` was
|
||||
the only responsile person for them.
|
||||
|
||||
:param person: The IfcPerson to remove
|
||||
:type person: ifcopenshell.entity_instance
|
||||
@@ -52,7 +54,9 @@ def remove_person(file, person=None) -> None:
|
||||
inverse.Creators = None
|
||||
elif inverse.is_a("IfcInventory"):
|
||||
if inverse.ResponsiblePersons == (settings["person"],):
|
||||
inverse.ResponsiblePersons = None
|
||||
# in IFC2X3 ResponsiblePersons is not optional and without it IfcInventory is not valid
|
||||
if file.schema == "IFC2X3":
|
||||
ifcopenshell.api.run("root.remove_product", file, product=inverse)
|
||||
elif inverse.is_a("IfcDocumentInformation"):
|
||||
if inverse.Editors == (settings["person"],):
|
||||
inverse.Editors = None
|
||||
|
||||
Reference in New Issue
Block a user