Remove orphaned IfcPropertyEnumeration

Noticed a couple hundreds of orphaned IfcPropertyEnumeration in my .ifc like below 😁

IFCPROPERTYENUMERATION('Status',(IFCLABEL('NEW'),IFCLABEL('EXISTING'),IFCLABEL('DEMOLISH'),IFCLABEL('TEMPORARY'),IFCLABEL('OTHER'),IFCLABEL('NOTKNOWN'),IFCLABEL('UNSET')),$);
This commit is contained in:
Andrej730
2023-09-18 12:07:19 +05:00
parent 7b28bc9c68
commit 19345ff538
2 changed files with 31 additions and 2 deletions
@@ -65,8 +65,13 @@ class Usecase:
elif self.settings["pset"].is_a() in ("IfcMaterialProperties", "IfcProfileProperties"):
properties = self.settings["pset"].Properties or []
for prop in properties:
if self.file.get_total_inverses(prop) == 1:
self.file.remove(prop)
if self.file.get_total_inverses(prop) != 1:
continue
if prop.is_a("IfcPropertyEnumeratedValue"):
enumeration = prop.EnumerationReference
if self.file.get_total_inverses(enumeration) == 1:
self.file.remove(enumeration)
self.file.remove(prop)
self.file.remove(self.settings["pset"])
for element in to_purge:
self.file.remove(element)