mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
geometry.edit_object_placement was producing orphaned placements
It was producing orphaned IfcLocalPlacement if placement was parent to some other one. During edit_object_placement we were replacing all parent references with the new placement but wasn't removing the old one.
This commit is contained in:
@@ -49,15 +49,14 @@ class Usecase:
|
||||
old_placement = self.settings["product"].ObjectPlacement
|
||||
|
||||
if old_placement:
|
||||
inverses = self.file.get_inverse(old_placement)
|
||||
if len(inverses) == 1:
|
||||
for inverse in self.file.get_inverse(old_placement):
|
||||
if inverse.is_a("IfcLocalPlacement"):
|
||||
ifcopenshell.util.element.replace_attribute(inverse, old_placement, new_placement)
|
||||
|
||||
if self.file.get_total_inverses(old_placement) == 1:
|
||||
self.settings["product"].ObjectPlacement = None
|
||||
old_placement.PlacementRelTo = None
|
||||
ifcopenshell.util.element.remove_deep2(self.file, old_placement)
|
||||
else:
|
||||
for inverse in inverses:
|
||||
if inverse.is_a("IfcLocalPlacement"):
|
||||
ifcopenshell.util.element.replace_attribute(inverse, old_placement, new_placement)
|
||||
ifcopenshell.util.element.remove_deep(self.file, old_placement)
|
||||
|
||||
new_placement.PlacementRelTo = placement_rel_to
|
||||
self.settings["product"].ObjectPlacement = new_placement
|
||||
@@ -97,7 +96,6 @@ class Usecase:
|
||||
elif getattr(self.settings["product"], "ContainedInStructure", None):
|
||||
return self.settings["product"].ContainedInStructure[0].RelatingStructure.ObjectPlacement
|
||||
|
||||
|
||||
def get_children_settings(self, placement):
|
||||
if not placement:
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user