remove_product to remove object placement too

previously it wasn't deleting object placement when you removed the objects (and related elements like IfcDirections etc) and working on project long enough you might had a bunch of orphaned data in it
This commit is contained in:
Andrej730
2023-08-03 14:46:59 +05:00
parent 8908011ecf
commit 2446479d82
2 changed files with 33 additions and 0 deletions
@@ -65,6 +65,11 @@ class Usecase:
representations = self.settings["product"].Representation.Representations or []
else:
representations = []
object_placement = self.settings["product"].ObjectPlacement
if object_placement and self.file.get_total_inverses(object_placement) == 1:
self.settings["product"].ObjectPlacement = None # remove the inverse for remove_deep2 to work
ifcopenshell.util.element.remove_deep2(self.file, object_placement)
elif self.settings["product"].is_a("IfcTypeProduct"):
representations = [rm.MappedRepresentation for rm in self.settings["product"].RepresentationMaps or []]
for representation in representations: