Remove empty IfcDocumentInformationRelationship #3581

This commit is contained in:
Andrej730
2023-08-14 11:04:55 +05:00
parent ed4abacd1e
commit 793b28e43b
2 changed files with 20 additions and 0 deletions
@@ -46,10 +46,17 @@ class Usecase:
def execute(self):
for reference in self.settings["information"].HasDocumentReferences or []:
ifcopenshell.api.run("document.remove_reference", self.file, reference=reference)
for rel in self.settings["information"].IsPointer or []:
for information in rel.RelatedDocuments:
ifcopenshell.api.run("document.remove_information", self.file, information=information)
self.file.remove(rel)
# remove IfcDocumentInformationRelationship so it won't become invalid
for rel in self.settings["information"].IsPointedTo or []:
if rel.RelatedDocuments == (self.settings["information"],):
self.file.remove(rel)
for rel in self.settings["information"].DocumentInfoForObjects or []:
self.file.remove(rel)
self.file.remove(self.settings["information"])