diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/assign_representation.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/assign_representation.py index 50ef13ba40..6c15038858 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/assign_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/assign_representation.py @@ -1,3 +1,6 @@ +import ifcopenshell.api.owner.update_owner_history as update_owner_history + + class Usecase: def __init__(self, file, settings={}): self.file = file @@ -32,3 +35,4 @@ class Usecase: ) ) self.settings["product"].RepresentationMaps = maps + update_owner_history.Usecase(self.file, {"element": self.settings["product"]}).execute() diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/edit_object_placement.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/edit_object_placement.py index bf50407a0b..62c0a23321 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/edit_object_placement.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/edit_object_placement.py @@ -1,6 +1,7 @@ import numpy as np import ifcopenshell.util.element import ifcopenshell.util.placement +import ifcopenshell.api.owner.update_owner_history as update_owner_history class Usecase: @@ -46,6 +47,8 @@ class Usecase: ifcopenshell.util.element.remove_deep(self.file, old) self.settings["product"].ObjectPlacement = placement + update_owner_history.Usecase(self.file, {"element": self.settings["product"]}).execute() + for settings in dependent_objects: self.settings = settings self.execute() diff --git a/src/ifcopenshell-python/ifcopenshell/api/spatial/assign_container.py b/src/ifcopenshell-python/ifcopenshell/api/spatial/assign_container.py index 6c1f7b5d47..327ba37666 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/spatial/assign_container.py +++ b/src/ifcopenshell-python/ifcopenshell/api/spatial/assign_container.py @@ -1,4 +1,6 @@ import ifcopenshell +import ifcopenshell.api.owner.create_owner_history as create_owner_history +import ifcopenshell.api.owner.update_owner_history as update_owner_history class Usecase: @@ -23,6 +25,7 @@ class Usecase: related_elements.remove(self.settings["product"]) if related_elements: contained_in_structure[0].RelatedElements = related_elements + update_owner_history.Usecase(self.file, {"element": contained_in_structure[0]}).execute() else: self.file.remove(contained_in_structure[0]) @@ -30,12 +33,13 @@ class Usecase: related_elements = list(contains_elements[0].RelatedElements) related_elements.append(self.settings["product"]) contains_elements[0].RelatedElements = related_elements + update_owner_history.Usecase(self.file, {"element": contains_elements[0]}).execute() else: contains_elements = self.file.create_entity( "IfcRelContainedInSpatialStructure", **{ "GlobalId": ifcopenshell.guid.new(), - # TODO "OwnerHistory": None + "OwnerHistory": create_owner_history.Usecase(self.file).execute(), "RelatedElements": [self.settings["product"]], "RelatingStructure": self.settings["relating_structure"], } diff --git a/src/ifcopenshell-python/ifcopenshell/api/spatial/remove_container.py b/src/ifcopenshell-python/ifcopenshell/api/spatial/remove_container.py index 92b941cd51..7d64afca60 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/spatial/remove_container.py +++ b/src/ifcopenshell-python/ifcopenshell/api/spatial/remove_container.py @@ -1,4 +1,5 @@ import ifcopenshell +import ifcopenshell.api.owner.update_owner_history as update_owner_history class Usecase: @@ -16,5 +17,6 @@ class Usecase: related_elements.remove(self.settings["product"]) if related_elements: contained_in_structure[0].RelatedElements = related_elements + update_owner_history.Usecase(self.file, {"element": contained_in_structure[0]}).execute() else: self.file.remove(contained_in_structure) diff --git a/src/ifcopenshell-python/ifcopenshell/api/type/assign_type.py b/src/ifcopenshell-python/ifcopenshell/api/type/assign_type.py index 417bc81b11..b54d2b9e27 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/type/assign_type.py +++ b/src/ifcopenshell-python/ifcopenshell/api/type/assign_type.py @@ -1,4 +1,6 @@ import ifcopenshell +import ifcopenshell.api.owner.create_owner_history as create_owner_history +import ifcopenshell.api.owner.update_owner_history as update_owner_history class Usecase: @@ -32,6 +34,7 @@ class Usecase: related_objects.remove(self.settings["related_object"]) if related_objects: is_typed_by[0].RelatedObjects = related_objects + update_owner_history.Usecase(self.file, {"element": is_typed_by[0]}).execute() else: self.file.remove(is_typed_by[0]) @@ -39,12 +42,13 @@ class Usecase: related_objects = list(types[0].RelatedObjects) related_objects.append(self.settings["related_object"]) types[0].RelatedObjects = related_objects + update_owner_history.Usecase(self.file, {"element": types[0]}).execute() else: types = self.file.create_entity( "IfcRelDefinesByType", **{ "GlobalId": ifcopenshell.guid.new(), - # TODO "OwnerHistory": None + "OwnerHistory": create_owner_history.Usecase(self.file).execute(), "RelatedObjects": [self.settings["related_object"]], "RelatingType": self.settings["relating_type"], } diff --git a/src/ifcopenshell-python/ifcopenshell/api/type/unassign_type.py b/src/ifcopenshell-python/ifcopenshell/api/type/unassign_type.py index f5d288ef3a..d7c1ded6ce 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/type/unassign_type.py +++ b/src/ifcopenshell-python/ifcopenshell/api/type/unassign_type.py @@ -1,4 +1,5 @@ import ifcopenshell +import ifcopenshell.api.owner.update_owner_history as update_owner_history class Usecase: @@ -27,5 +28,6 @@ class Usecase: related_objects.remove(self.settings["related_object"]) if related_objects: is_typed_by.RelatedObjects = related_objects + update_owner_history.Usecase(self.file, {"element": is_typed_by}).execute() else: self.file.remove(is_typed_by) diff --git a/src/ifcopenshell-python/ifcopenshell/api/void/add_opening.py b/src/ifcopenshell-python/ifcopenshell/api/void/add_opening.py index 2c5a646da9..a2ce7b92fe 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/void/add_opening.py +++ b/src/ifcopenshell-python/ifcopenshell/api/void/add_opening.py @@ -1,4 +1,5 @@ import ifcopenshell +import ifcopenshell.api.owner.create_owner_history as create_owner_history class Usecase: @@ -11,6 +12,7 @@ class Usecase: def execute(self): self.file.create_entity("IfcRelVoidsElement", **{ "GlobalId": ifcopenshell.guid.new(), + "OwnerHistory": create_owner_history.Usecase(self.file).execute(), "RelatingBuildingElement": self.settings["element"], "RelatedOpeningElement": self.settings["opening"] })