I'm trying to delete some Property Sets from multiple objects, but I have yet to find a way to do this properly.
Currently I'm trying the following, but this leaves me with a corrupted ifc file.
ifc = ifcopenshell.open(filepath)
all_elements = ifc.by_type(element_type)
for element in all_elements:
if element.is_a('IfcTypeObject'):
if element.HasPropertySets:
for definition in element.HasPropertySets:
if SOME CONDITION:
ifc.remove(definition)
else:
for relationship in element.IsDefinedBy:
if relationship.is_a('IfcRelDefinesByProperties'):
definition = relationship.RelatingPropertyDefinition
if SOME CONDITION:
ifc.remove(ifc.by_guid(definition.GlobalId))
If I save this ifc file and try to get the psets of elements with ifcopenshell.util.element.get_psets(element), I get multiple empty definitions back ( Like remains of the Psets that I wanted to delete).
In my final Code I want to only delete some Psets (f.e. based on name)
How would I go about cleanly removing complete Psets.
Thank you!
I'm trying to delete some Property Sets from multiple objects, but I have yet to find a way to do this properly.
Currently I'm trying the following, but this leaves me with a corrupted ifc file.
If I save this ifc file and try to get the psets of elements with ifcopenshell.util.element.get_psets(element), I get multiple empty definitions back ( Like remains of the Psets that I wanted to delete).
In my final Code I want to only delete some Psets (f.e. based on name)
How would I go about cleanly removing complete Psets.
Thank you!