From 2318132ea2356e48f2452df108feab80e561a519 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Mon, 10 Mar 2025 08:23:50 +1100 Subject: [PATCH] Minor refactor add_constr_type_instance is now add_occurrence --- .../bonsai/bim/module/covering/workspace.py | 8 +++---- .../bonsai/bim/module/model/__init__.py | 2 +- src/bonsai/bonsai/bim/module/model/mep.py | 6 ++--- src/bonsai/bonsai/bim/module/model/product.py | 12 +++++----- .../bonsai/bim/module/model/workspace.py | 2 +- src/bonsai/bonsai/bim/module/type/ui.py | 2 +- src/bonsai/test/bim/feature/covering.feature | 15 +++++++------ src/bonsai/test/bim/feature/geometry.feature | 18 +++++++-------- src/bonsai/test/bim/feature/model.feature | 22 +++++++++---------- src/bonsai/test/bim/feature/spatial.feature | 2 +- src/bonsai/test/bim/feature/system.feature | 10 ++++----- src/bonsai/test/bim/test_feature.py | 2 +- src/bonsai/test/tool/test_model.py | 6 ++--- src/bonsai/test/tool/test_root.py | 6 ++--- 14 files changed, 57 insertions(+), 56 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/covering/workspace.py b/src/bonsai/bonsai/bim/module/covering/workspace.py index 302f6d3c34..e0b0195b83 100644 --- a/src/bonsai/bonsai/bim/module/covering/workspace.py +++ b/src/bonsai/bonsai/bim/module/covering/workspace.py @@ -87,7 +87,7 @@ class CoveringToolUI: row = cls.layout.row(align=True) row.label(text="", icon="EVENT_SHIFT") row.label(text="", icon="EVENT_A") - row.operator("bim.add_constr_type_instance", text="Add") + row.operator("bim.add_occurrence", text="Add") row = cls.layout.row(align=True) row.label(text="", icon="EVENT_SHIFT") @@ -179,16 +179,16 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator): elif container: bpy.ops.bim.add_instance_flooring_covering_from_cursor() else: - bpy.ops.bim.add_constr_type_instance() + bpy.ops.bim.add_occurrence() elif AuthoringData.data["relating_type_data"].get("predefined_type") == "CEILING": if element and bpy.context.selected_objects and element.is_a("IfcWall"): bpy.ops.bim.add_instance_ceiling_coverings_from_walls() elif container: bpy.ops.bim.add_instance_ceiling_covering_from_cursor() else: - bpy.ops.bim.add_constr_type_instance() + bpy.ops.bim.add_occurrence() else: - bpy.ops.bim.add_constr_type_instance() + bpy.ops.bim.add_occurrence() def hotkey_S_G(self): active_obj = bpy.context.active_object diff --git a/src/bonsai/bonsai/bim/module/model/__init__.py b/src/bonsai/bonsai/bim/module/model/__init__.py index afd360d937..32573c6856 100644 --- a/src/bonsai/bonsai/bim/module/model/__init__.py +++ b/src/bonsai/bonsai/bim/module/model/__init__.py @@ -55,12 +55,12 @@ classes = ( array.Input3DCursorXArray, array.Input3DCursorYArray, array.Input3DCursorZArray, - product.AddConstrTypeInstance, product.AddDefaultType, product.AddEmptyType, product.AddOccurrence, product.AlignProduct, product.ChangeTypePage, + product.DrawOccurrence, product.LoadTypeThumbnails, product.MirrorElements, product.SetActiveType, diff --git a/src/bonsai/bonsai/bim/module/model/mep.py b/src/bonsai/bonsai/bim/module/model/mep.py index f4c00fb53b..72d7a8e2f7 100644 --- a/src/bonsai/bonsai/bim/module/model/mep.py +++ b/src/bonsai/bonsai/bim/module/model/mep.py @@ -580,7 +580,7 @@ class MEPGenerator: profile_joiner = DumbProfileJoiner() # create obstruction occurrence and setup it's length and port # NOTE: at this point we loose current blender objects selection - bpy.ops.bim.add_constr_type_instance(relating_type_id=obstruction_type.id()) + bpy.ops.bim.add_occurrence(relating_type_id=obstruction_type.id()) obstruction_obj = bpy.context.active_object obstruction_obj.matrix_world = segment_matrix @@ -859,7 +859,7 @@ class MEPAddTransition(bpy.types.Operator, tool.Ifc.Operator): # NOTE: at this point we loose current blender objects selection # create transition element - bpy.ops.bim.add_constr_type_instance(relating_type_id=transition_type.id()) + bpy.ops.bim.add_occurrence(relating_type_id=transition_type.id()) transition_obj = bpy.context.active_object # adjust transition segment rotation and location @@ -1210,7 +1210,7 @@ class MEPAddBend(bpy.types.Operator, tool.Ifc.Operator): # NOTE: at this point we loose current blender objects selection # create transition element - bpy.ops.bim.add_constr_type_instance(relating_type_id=bend_type.id()) + bpy.ops.bim.add_occurrence(relating_type_id=bend_type.id()) fitting_obj = bpy.context.active_object # adjust fitting object rotation and location diff --git a/src/bonsai/bonsai/bim/module/model/product.py b/src/bonsai/bonsai/bim/module/model/product.py index 04446deaeb..f0e82a7272 100644 --- a/src/bonsai/bonsai/bim/module/model/product.py +++ b/src/bonsai/bonsai/bim/module/model/product.py @@ -155,9 +155,9 @@ class AddDefaultType(bpy.types.Operator, tool.Ifc.Operator): bpy.ops.bim.add_element() -class AddOccurrence(bpy.types.Operator, PolylineOperator, tool.Ifc.Operator): - bl_idname = "bim.add_occurrence" - bl_label = "Add Occurrence" +class DrawOccurrence(bpy.types.Operator, PolylineOperator, tool.Ifc.Operator): + bl_idname = "bim.draw_occurrence" + bl_label = "Draw Occurrence" bl_options = {"REGISTER", "UNDO"} @classmethod @@ -194,7 +194,7 @@ class AddOccurrence(bpy.types.Operator, PolylineOperator, tool.Ifc.Operator): context.scene.cursor.location = Vector((point.x, point.y, point.z)) tool.Polyline.clear_polyline() - bpy.ops.bim.add_constr_type_instance("INVOKE_DEFAULT") + bpy.ops.bim.add_occurrence("INVOKE_DEFAULT") if snap_obj: snap_obj.select_set(False) @@ -265,8 +265,8 @@ class AddOccurrence(bpy.types.Operator, PolylineOperator, tool.Ifc.Operator): return {"RUNNING_MODAL"} -class AddConstrTypeInstance(bpy.types.Operator, tool.Ifc.Operator): - bl_idname = "bim.add_constr_type_instance" +class AddOccurrence(bpy.types.Operator, tool.Ifc.Operator): + bl_idname = "bim.add_occurrence" bl_label = "Add Type Occurrence" bl_options = {"REGISTER", "UNDO"} bl_description = "Add Type Instance" diff --git a/src/bonsai/bonsai/bim/module/model/workspace.py b/src/bonsai/bonsai/bim/module/model/workspace.py index bf56626160..b2f0220582 100644 --- a/src/bonsai/bonsai/bim/module/model/workspace.py +++ b/src/bonsai/bonsai/bim/module/model/workspace.py @@ -1136,7 +1136,7 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator): "IfcPileType", ): return bpy.ops.bim.draw_polyline_profile("INVOKE_DEFAULT") - return bpy.ops.bim.add_occurrence("INVOKE_DEFAULT") + return bpy.ops.bim.draw_occurrence("INVOKE_DEFAULT") def hotkey_S_Q(self): if not bpy.context.selected_objects: diff --git a/src/bonsai/bonsai/bim/module/type/ui.py b/src/bonsai/bonsai/bim/module/type/ui.py index 340662cb3a..291c37f1ba 100644 --- a/src/bonsai/bonsai/bim/module/type/ui.py +++ b/src/bonsai/bonsai/bim/module/type/ui.py @@ -97,4 +97,4 @@ class BIM_PT_type(Panel): def add_object_button(self, context): - self.layout.operator("bim.add_constr_type_instance", icon="PLUGIN") + self.layout.operator("bim.add_occurrence", icon="PLUGIN") diff --git a/src/bonsai/test/bim/feature/covering.feature b/src/bonsai/test/bim/feature/covering.feature index 0800e0edb5..4eb97649da 100644 --- a/src/bonsai/test/bim/feature/covering.feature +++ b/src/bonsai/test/bim/feature/covering.feature @@ -9,26 +9,27 @@ Scenario: Execute generate flooring coverings from walls And the variable "element_type" is "[e for e in {ifc}.by_type('IfcWallType') if e.Name == 'WAL100'][0].id()" And I set "scene.BIMModelProperties.relating_type_id" to "{element_type}" # 1st wall - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And the object "IfcWall/Wall" is selected And I press "bim.change_layer_length(length=3.6)" # 2nd wall And the cursor is at "3.6,0.1,3" And I set "scene.BIMModelProperties.length" to "2.0" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" # 3rd wall And the cursor is at "3.5,2.1,3" And I set "scene.BIMModelProperties.length" to "3.5" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" # 4th wall And the cursor is at "0,2.0,0" And I set "scene.BIMModelProperties.length" to "1.9" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" # add_instance_flooring_coverings_from_walls is expecting FLOORING predefined type. And the object "IfcCoveringType/COV30" is selected - And I press "bim.enable_editing_attributes(obj='IfcCoveringType/COV30')" - And I set "active_object.BIMAttributeProperties.attributes[6].enum_value" to "FLOORING" - And I press "bim.edit_attributes(obj='IfcCoveringType/COV30')" + And I look at the "Attributes" panel + And I click "Edit" + And I set the "PredefinedType" property to "FLOORING" + And I click "Save Attributes" # Run the operator. When the object "IfcWall/Wall" is selected And additionally the object "IfcWall/Wall.001" is selected diff --git a/src/bonsai/test/bim/feature/geometry.feature b/src/bonsai/test/bim/feature/geometry.feature index 50e6e5fdbb..eeda85681f 100644 --- a/src/bonsai/test/bim/feature/geometry.feature +++ b/src/bonsai/test/bim/feature/geometry.feature @@ -33,8 +33,8 @@ Scenario: Add representation - add a new representation to a typed instance And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType" And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType" And I press "bim.assign_class" - And I press "bim.add_constr_type_instance" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" + And I press "bim.add_occurrence" Then the object "IfcWall/Wall" data is a "Tessellation" representation of "Model/Body/MODEL_VIEW" And the object "IfcWall/Wall.001" data is a "Tessellation" representation of "Model/Body/MODEL_VIEW" When the object "IfcWall/Wall" is selected @@ -127,8 +127,8 @@ Scenario: Remove representation - remove an instanced representation from an act And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType" And the variable "cube" is "{ifc}.by_type('IfcWallType')[0].id()" And I set "scene.BIMModelProperties.relating_type_id" to "{cube}" - And I press "bim.add_constr_type_instance" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" + And I press "bim.add_occurrence" And the object "IfcWallType/Cube" is selected When the variable "representation_body" is "{ifc}.by_type('IfcWallType')[0].RepresentationMaps[0].MappedRepresentation.id()" And I press "bim.remove_representation(representation_id={representation_body})" @@ -146,8 +146,8 @@ Scenario: Remove representation - remove an instanced representation from an act And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType" And the variable "cube" is "{ifc}.by_type('IfcWallType')[0].id()" And I set "scene.BIMModelProperties.relating_type_id" to "{cube}" - And I press "bim.add_constr_type_instance" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" + And I press "bim.add_occurrence" And the object "IfcWall/Wall" is selected When the variable "representation_body" is "{ifc}.by_type('IfcWall')[0].Representation.Representations[0].id()" And I press "bim.remove_representation(representation_id={representation_body})" @@ -339,7 +339,7 @@ Scenario: Override duplicate move - copying a type instance with a representatio And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType" And the variable "cube" is "{ifc}.by_type('IfcWallType')[0].id()" And I set "scene.BIMModelProperties.relating_type_id" to "{cube}" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And the object "IfcWall/Wall" is selected When I duplicate the selected objects Then the object "IfcWall/Wall.001" exists @@ -425,14 +425,14 @@ Scenario: Override duplicate move - copying objects with connection And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType" And the variable "element_type" is "[e for e in {ifc}.by_type('IfcWallType') if e.Name == 'WAL100'][0].id()" And I set "scene.BIMModelProperties.relating_type_id" to "{element_type}" - When I press "bim.add_constr_type_instance" + When I press "bim.add_occurrence" Then the object "IfcWall/Wall" is an "IfcWall" And the object "IfcWall/Wall" dimensions are "1,0.1,3" And the object "IfcWall/Wall" bottom left corner is at "0,0,0" When I set "scene.BIMModelProperties.ifc_class" to "IfcSlabType" And the variable "element_type" is "[e for e in {ifc}.by_type('IfcSlabType') if e.Name == 'FLR200'][0].id()" And I set "scene.BIMModelProperties.relating_type_id" to "{element_type}" - When I press "bim.add_constr_type_instance" + When I press "bim.add_occurrence" Then the object "IfcSlab/Slab" is an "IfcSlab" When the object "IfcSlab/Slab" is selected And the object "IfcSlab/Slab" is moved to "0,0,4" diff --git a/src/bonsai/test/bim/feature/model.feature b/src/bonsai/test/bim/feature/model.feature index 7467d6af86..04a08c1445 100644 --- a/src/bonsai/test/bim/feature/model.feature +++ b/src/bonsai/test/bim/feature/model.feature @@ -11,7 +11,7 @@ Scenario: Add type instance - add from a mesh And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType" And the variable "cube" is "{ifc}.by_type('IfcWallType')[0].id()" And I set "scene.BIMModelProperties.relating_type_id" to "{cube}" - When I press "bim.add_constr_type_instance" + When I press "bim.add_occurrence" Then the object "IfcWall/Wall" exists Scenario: Add type instance - add from an empty @@ -24,7 +24,7 @@ Scenario: Add type instance - add from an empty And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType" And the variable "empty" is "{ifc}.by_type('IfcWallType')[0].id()" And I set "scene.BIMModelProperties.relating_type_id" to "{empty}" - When I press "bim.add_constr_type_instance" + When I press "bim.add_occurrence" Then the object "IfcWall/Wall" exists Scenario: Add type instance - add a mesh where existing instances have changed context @@ -37,14 +37,14 @@ Scenario: Add type instance - add a mesh where existing instances have changed c And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType" And the variable "cube" is "{ifc}.by_type('IfcWallType')[0].id()" And I set "scene.BIMModelProperties.relating_type_id" to "{cube}" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And the object "IfcWall/Wall" data is a "Tessellation" representation of "Model/Body/MODEL_VIEW" And the object "IfcWall/Wall" is selected And the variable "context" is "[c for c in {ifc}.by_type('IfcGeometricRepresentationSubContext') if c.ContextType == 'Plan' and c.ContextIdentifier == 'Body' and c.TargetView == 'PLAN_VIEW'][0].id()" And I set "active_object.BIMGeometryProperties.contexts" to "{context}" And I press "bim.add_representation" And the object "IfcWall/Wall" data is a "Annotation2D" representation of "Plan/Body/PLAN_VIEW" - When I press "bim.add_constr_type_instance" + When I press "bim.add_occurrence" Then the object "IfcWall/Wall" data is a "Annotation2D" representation of "Plan/Body/PLAN_VIEW" And the object "IfcWall/Wall.001" data is a "Annotation2D" representation of "Plan/Body/PLAN_VIEW" @@ -72,7 +72,7 @@ Scenario: Add a wall And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType" And the variable "element_type" is "[e for e in {ifc}.by_type('IfcWallType') if e.Name == 'WAL100'][0].id()" And I set "scene.BIMModelProperties.relating_type_id" to "{element_type}" - When I press "bim.add_constr_type_instance" + When I press "bim.add_occurrence" Then the object "IfcWall/Wall" is an "IfcWall" And the object "IfcWall/Wall" dimensions are "1,0.1,3" And the object "IfcWall/Wall" bottom left corner is at "0,0,0" @@ -525,11 +525,11 @@ Scenario: Create a MEP transition And I set "scene.BIMModelProperties.ifc_class" to "IfcDuctSegmentType" And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/RectSegment" And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[1]" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/CircleSegment" And the object "IfcDuctSegment/RectSegment" is moved to "0,0,0" @@ -555,11 +555,11 @@ Scenario: Create a MEP bend between intersecting with different locations And I set "scene.BIMModelProperties.ifc_class" to "IfcDuctSegmentType" And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]" And I set "scene.BIMModelProperties.extrusion_depth" to "5.0" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg1" And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg2" And the object "IfcDuctSegment/Seg2" is rotated by "0,0,90" deg @@ -585,11 +585,11 @@ Scenario: Create a MEP bend between intersecting segments at the same location And I set "scene.BIMModelProperties.ifc_class" to "IfcDuctSegmentType" And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]" And I set "scene.BIMModelProperties.extrusion_depth" to "5.0" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg1" And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg2" And the object "IfcDuctSegment/Seg2" is rotated by "0,0,90" deg diff --git a/src/bonsai/test/bim/feature/spatial.feature b/src/bonsai/test/bim/feature/spatial.feature index c7b932c308..604159f002 100644 --- a/src/bonsai/test/bim/feature/spatial.feature +++ b/src/bonsai/test/bim/feature/spatial.feature @@ -112,7 +112,7 @@ Scenario: Execute generate spaces from walls And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType" And the variable "element_type" is "[e for e in {ifc}.by_type('IfcWallType') if e.Name == 'WAL100'][0].id()" And I set "scene.BIMModelProperties.relating_type_id" to "{element_type}" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And the object "IfcWall/Wall" is selected When I press "bim.generate_spaces_from_walls" Then nothing happens diff --git a/src/bonsai/test/bim/feature/system.feature b/src/bonsai/test/bim/feature/system.feature index f671b1009b..f9ebbcf915 100644 --- a/src/bonsai/test/bim/feature/system.feature +++ b/src/bonsai/test/bim/feature/system.feature @@ -139,13 +139,13 @@ Scenario: Connect MEP elements And I set "scene.BIMModelProperties.ifc_class" to "IfcDuctSegmentType" And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]" And I set "scene.BIMModelProperties.extrusion_depth" to "5.0" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg1" # actuator And I set "scene.BIMModelProperties.ifc_class" to "IfcActuatorType" And I set "scene.BIMModelProperties.relating_type_id" to "{actuator_type_id}" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And the object "IfcActuator/Actuator" is moved to "10,0,0" # connect actuator @@ -169,12 +169,12 @@ Scenario: Connect MEP elements and regenerate And I set "scene.BIMModelProperties.ifc_class" to "IfcDuctSegmentType" And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]" And I set "scene.BIMModelProperties.extrusion_depth" to "5.0" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg1" # segment2 And I set "scene.BIMModelProperties.relating_type_id" to "{segment_types}[0]" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/Seg2" And the object "IfcDuctSegment/Seg2" is rotated by "0,0,90" deg @@ -186,7 +186,7 @@ Scenario: Connect MEP elements and regenerate # actuator And I set "scene.BIMModelProperties.ifc_class" to "IfcActuatorType" And I set "scene.BIMModelProperties.relating_type_id" to "{actuator_type_id}" - And I press "bim.add_constr_type_instance" + And I press "bim.add_occurrence" And the object "IfcActuator/Actuator" is moved to "10,0,0" # connect actuator diff --git a/src/bonsai/test/bim/test_feature.py b/src/bonsai/test/bim/test_feature.py index 7385543ff9..c5e084e031 100644 --- a/src/bonsai/test/bim/test_feature.py +++ b/src/bonsai/test/bim/test_feature.py @@ -1248,7 +1248,7 @@ def i_display_the_construction_type_browser(): @when("I add the construction type") def i_add_the_active_construction_type(): props = tool.Model.get_model_props() - bpy.ops.bim.add_constr_type_instance(relating_type_id=int(props.relating_type_id)) + bpy.ops.bim.add_occurrence(relating_type_id=int(props.relating_type_id)) @then(parsers.parse("construction type is {relating_type_name}")) diff --git a/src/bonsai/test/tool/test_model.py b/src/bonsai/test/tool/test_model.py index 8056db1349..f41a4d5988 100644 --- a/src/bonsai/test/tool/test_model.py +++ b/src/bonsai/test/tool/test_model.py @@ -517,12 +517,12 @@ class TestApplyIfcMaterialChanges(NewFile): # Setup occurrences. relating_type_id = element_type.id() - bpy.ops.bim.add_constr_type_instance(relating_type_id=relating_type_id) + bpy.ops.bim.add_occurrence(relating_type_id=relating_type_id) simple = bpy.context.active_object simple.name = "Simple" # Occurrence with an opening. - bpy.ops.bim.add_constr_type_instance(relating_type_id=relating_type_id) + bpy.ops.bim.add_occurrence(relating_type_id=relating_type_id) with_opening = bpy.context.active_object with_opening.name = "With Opening" props = tool.Root.get_root_props() @@ -530,7 +530,7 @@ class TestApplyIfcMaterialChanges(NewFile): bpy.ops.bim.add_element(ifc_product="IfcFeatureElement", ifc_class="IfcOpeningElement") # Occurrence with a material override. - bpy.ops.bim.add_constr_type_instance(relating_type_id=relating_type_id) + bpy.ops.bim.add_occurrence(relating_type_id=relating_type_id) with_material = bpy.context.active_object with_material.name = "With Material" tool.Blender.set_objects_selection(bpy.context, active_object=with_material, selected_objects=[with_material]) diff --git a/src/bonsai/test/tool/test_root.py b/src/bonsai/test/tool/test_root.py index 2c89a4e5fa..b807c1ddb8 100644 --- a/src/bonsai/test/tool/test_root.py +++ b/src/bonsai/test/tool/test_root.py @@ -184,9 +184,9 @@ class TestReassignClass(NewFile): n_slab_types = len(ifc_file.by_type("IfcSlabType")) # create 3 slabs - bpy.ops.bim.add_constr_type_instance(relating_type_id=relating_type_id) - bpy.ops.bim.add_constr_type_instance(relating_type_id=relating_type_id) - bpy.ops.bim.add_constr_type_instance(relating_type_id=relating_type_id) + bpy.ops.bim.add_occurrence(relating_type_id=relating_type_id) + bpy.ops.bim.add_occurrence(relating_type_id=relating_type_id) + bpy.ops.bim.add_occurrence(relating_type_id=relating_type_id) slabs = [tool.Ifc.get_object(e) for e in ifc_file.by_type("IfcSlab")] assert len(slabs) == 3