mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Fix bug where removing addresses and roles could leave other elements in invalid states, "IfcPersonAndOrganization"
This commit is contained in:
@@ -6,4 +6,8 @@ class Usecase:
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
for inverse in self.file.get_inverse(self.settings["address"]):
|
||||
if inverse.is_a() in ("IfcOrganization", "IfcPerson"):
|
||||
if inverse.Addresses == (self.settings["address"],):
|
||||
inverse.Addresses = None
|
||||
self.file.remove(self.settings["address"])
|
||||
|
||||
@@ -6,4 +6,11 @@ class Usecase:
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
for inverse in self.file.get_inverse(self.settings["role"]):
|
||||
if inverse.is_a() in ("IfcOrganization", "IfcPerson", "IfcPersonAndOrganization"):
|
||||
if inverse.Roles == (self.settings["role"],):
|
||||
inverse.Roles = None
|
||||
elif inverse.is_a("IfcResourceLevelRelationship") and not inverse.is_a("IfcOrganizationRelationship"):
|
||||
if inverse.RelatedResourceObjects == (self.settings["organisation"],):
|
||||
self.file.remove(inverse)
|
||||
self.file.remove(self.settings["role"])
|
||||
|
||||
Reference in New Issue
Block a user