diff --git a/src/blenderbim/blenderbim/bim/import_ifc.py b/src/blenderbim/blenderbim/bim/import_ifc.py index da786c33a2..8c53d924b2 100644 --- a/src/blenderbim/blenderbim/bim/import_ifc.py +++ b/src/blenderbim/blenderbim/bim/import_ifc.py @@ -314,7 +314,7 @@ class IfcImporter: for spatial_element in leaf_spatial_elements: while True: results.add(spatial_element) - spatial_element = ifcopenshell.util.element.get_aggregate(spatial_element) + spatial_element = ifcopenshell.util.element.get_relating_object(spatial_element) if not spatial_element or spatial_element.is_a("IfcContext"): break return results @@ -1190,7 +1190,7 @@ class IfcImporter: self.collections[element.GlobalId] = collection for global_id, aggregate in aggregates.items(): - parent = ifcopenshell.util.element.get_aggregate(aggregate["element"]) + parent = ifcopenshell.util.element.get_relating_object(aggregate["element"]) if parent: self.collections[parent.GlobalId].children.link(aggregate["collection"]) continue @@ -1278,7 +1278,7 @@ class IfcImporter: collection.name = obj.name return collection.objects.link(obj) elif getattr(element, "Decomposes", None): - aggregate = ifcopenshell.util.element.get_aggregate(element) + aggregate = ifcopenshell.util.element.get_relating_object(element) return self.collections[aggregate.GlobalId].objects.link(obj) else: return self.place_object_in_spatial_decomposition_collection(element, obj) diff --git a/src/blenderbim/blenderbim/bim/module/aggregate/operator.py b/src/blenderbim/blenderbim/bim/module/aggregate/operator.py index bea50b2494..e02047220f 100644 --- a/src/blenderbim/blenderbim/bim/module/aggregate/operator.py +++ b/src/blenderbim/blenderbim/bim/module/aggregate/operator.py @@ -111,7 +111,7 @@ class BIM_OT_add_aggregate(bpy.types.Operator): aggregate = self.create_aggregate(context) tool.Collector.sync(obj) - current_aggregate = ifcopenshell.util.element.get_aggregate(element) + current_aggregate = ifcopenshell.util.element.get_relating_object(element) current_container = ifcopenshell.util.element.get_container(element) if current_aggregate: core.assign_object( diff --git a/src/blenderbim/blenderbim/bim/module/project/operator.py b/src/blenderbim/blenderbim/bim/module/project/operator.py index 2276c57ef8..d7b127fa11 100644 --- a/src/blenderbim/blenderbim/bim/module/project/operator.py +++ b/src/blenderbim/blenderbim/bim/module/project/operator.py @@ -65,7 +65,9 @@ class CreateProject(bpy.types.Operator): if self.file.schema == "IFC2X3": person = blenderbim.core.owner.add_person(tool.Ifc) organisation = blenderbim.core.owner.add_organisation(tool.Ifc) - user = blenderbim.core.owner.add_person_and_organisation(tool.Ifc, person=person, organisation=organisation) + user = blenderbim.core.owner.add_person_and_organisation( + tool.Ifc, person=person, organisation=organisation + ) blenderbim.core.owner.set_user(tool.Owner, user=user) project = bpy.data.objects.new(self.get_name("IfcProject", "My Project"), None) @@ -624,7 +626,7 @@ class LoadProjectElements(bpy.types.Operator): container = self.file.by_id(filter_category.ifc_definition_id) while container: containers.add(container) - container = ifcopenshell.util.element.get_aggregate(container) + container = ifcopenshell.util.element.get_relating_object(container) if self.file.schema == "IFC2X3" and container.is_a("IfcProject"): container = None elif self.file.schema != "IFC2X3" and container.is_a("IfcContext"): diff --git a/src/blenderbim/blenderbim/tool/collector.py b/src/blenderbim/blenderbim/tool/collector.py index 3a122fee25..9e052b20cf 100644 --- a/src/blenderbim/blenderbim/tool/collector.py +++ b/src/blenderbim/blenderbim/tool/collector.py @@ -157,7 +157,7 @@ class Collector(blenderbim.core.tool.Collector): if grid_obj: return bpy.data.collections.get(grid_obj.name) - aggregate = ifcopenshell.util.element.get_aggregate(element) + aggregate = ifcopenshell.util.element.get_relating_object(element) if aggregate: aggregate_obj = tool.Ifc.get_object(aggregate) if aggregate_obj: diff --git a/src/blenderbim/blenderbim/tool/misc.py b/src/blenderbim/blenderbim/tool/misc.py index 9f34572784..a957f257c5 100644 --- a/src/blenderbim/blenderbim/tool/misc.py +++ b/src/blenderbim/blenderbim/tool/misc.py @@ -41,7 +41,7 @@ class Misc(blenderbim.core.tool.Misc): @classmethod def get_storey_height_in_si(cls, storey, total_storeys): - building = ifcopenshell.util.element.get_aggregate(storey) + building = ifcopenshell.util.element.get_relating_object(storey) related_objects = [] for rel in building.IsDecomposedBy: if rel.is_a("IfcRelAggregates"): diff --git a/src/blenderbim/test/tool/test_collector.py b/src/blenderbim/test/tool/test_collector.py index 390c07da7c..b3d749a275 100644 --- a/src/blenderbim/test/tool/test_collector.py +++ b/src/blenderbim/test/tool/test_collector.py @@ -235,4 +235,4 @@ class TestSync(NewFile): bpy.data.collections.get("IfcBuilding/My Building").children.link(col) col.objects.link(obj) subject.sync(obj) - assert ifcopenshell.util.element.get_aggregate(element).is_a("IfcBuilding") + assert ifcopenshell.util.element.get_relating_object(element).is_a("IfcBuilding") diff --git a/src/ifcopenshell-python/ifcopenshell/api/spatial/assign_container.py b/src/ifcopenshell-python/ifcopenshell/api/spatial/assign_container.py index 6daecafa29..85d63d3ace 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/spatial/assign_container.py +++ b/src/ifcopenshell-python/ifcopenshell/api/spatial/assign_container.py @@ -38,7 +38,7 @@ class Usecase: if contains_elements and contained_in_structure and contained_in_structure[0] == contains_elements[0]: return - aggregate = ifcopenshell.util.element.get_aggregate(self.settings["product"]) + aggregate = ifcopenshell.util.element.get_relating_object(self.settings["product"]) if aggregate: ifcopenshell.api.run( "aggregate.unassign_object", self.file, relating_object=aggregate, product=self.settings["product"] diff --git a/src/ifcopenshell-python/ifcopenshell/util/element.py b/src/ifcopenshell-python/ifcopenshell/util/element.py index 603f0af989..82f2dc27ff 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/element.py +++ b/src/ifcopenshell-python/ifcopenshell/util/element.py @@ -157,7 +157,7 @@ def get_container(element, should_get_direct=False): if hasattr(element, "ContainedInStructure") and element.ContainedInStructure: return element.ContainedInStructure[0].RelatingStructure else: - aggregate = get_aggregate(element) + aggregate = get_relating_object(element) if aggregate: return get_container(aggregate, should_get_direct) if hasattr(element, "ContainedInStructure") and element.ContainedInStructure: @@ -178,7 +178,7 @@ def get_decomposition(element): return results -def get_aggregate(element): +def get_relating_object(element): if hasattr(element, "Decomposes") and element.Decomposes: return element.Decomposes[0].RelatingObject diff --git a/src/ifcopenshell-python/test/api/aggregate/test_assign_object.py b/src/ifcopenshell-python/test/api/aggregate/test_assign_object.py index f4d23bfc69..8d434d1808 100644 --- a/src/ifcopenshell-python/test/api/aggregate/test_assign_object.py +++ b/src/ifcopenshell-python/test/api/aggregate/test_assign_object.py @@ -29,7 +29,7 @@ class TestAssignObject(test.bootstrap.IFC4): element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcSite") subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding") rel = ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=element) - assert ifcopenshell.util.element.get_aggregate(subelement) == element + assert ifcopenshell.util.element.get_relating_object(subelement) == element assert rel.is_a("IfcRelAggregates") def test_doing_nothing_if_the_aggregate_is_already_assigned(self): diff --git a/src/ifcopenshell-python/test/api/aggregate/test_unassign_object.py b/src/ifcopenshell-python/test/api/aggregate/test_unassign_object.py index de44b0727e..ea51fad67a 100644 --- a/src/ifcopenshell-python/test/api/aggregate/test_unassign_object.py +++ b/src/ifcopenshell-python/test/api/aggregate/test_unassign_object.py @@ -28,7 +28,7 @@ class TestUnassignObject(test.bootstrap.IFC4): subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding") ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=element) ifcopenshell.api.run("aggregate.unassign_object", self.file, product=subelement) - assert ifcopenshell.util.element.get_aggregate(subelement) is None + assert ifcopenshell.util.element.get_relating_object(subelement) is None def test_the_rel_is_kept_if_there_are_more_decomposed_elements(self): element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcSite") diff --git a/src/ifcopenshell-python/test/api/spatial/test_assign_container.py b/src/ifcopenshell-python/test/api/spatial/test_assign_container.py index 11f1e03401..929496d6ee 100644 --- a/src/ifcopenshell-python/test/api/spatial/test_assign_container.py +++ b/src/ifcopenshell-python/test/api/spatial/test_assign_container.py @@ -118,4 +118,4 @@ class TestAssignContainer(test.bootstrap.IFC4): subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall") ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=aggregate) ifcopenshell.api.run("spatial.assign_container", self.file, product=subelement, relating_structure=element) - assert not ifcopenshell.util.element.get_aggregate(subelement) + assert not ifcopenshell.util.element.get_relating_object(subelement) diff --git a/src/ifcopenshell-python/test/util/test_element.py b/src/ifcopenshell-python/test/util/test_element.py index 5536effdcb..61ac76534b 100644 --- a/src/ifcopenshell-python/test/util/test_element.py +++ b/src/ifcopenshell-python/test/util/test_element.py @@ -365,7 +365,7 @@ class TestGetAggregateIFC4(test.bootstrap.IFC4): element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall") subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcCovering") ifcopenshell.api.run("aggregate.assign_object", self.file, product=subelement, relating_object=element) - assert subject.get_aggregate(subelement) == element + assert subject.get_relating_object(subelement) == element class TestReplaceAttributeIFC4(test.bootstrap.IFC4):