diff --git a/src/blenderbim/blenderbim/bim/module/model/product.py b/src/blenderbim/blenderbim/bim/module/model/product.py index 2904c8d2ca..f9c8d28a7d 100644 --- a/src/blenderbim/blenderbim/bim/module/model/product.py +++ b/src/blenderbim/blenderbim/bim/module/model/product.py @@ -113,7 +113,6 @@ class AddConstrTypeInstance(bpy.types.Operator): bl_label = "Add" bl_options = {"REGISTER", "UNDO"} bl_description = "Add Type Instance to the model" - ifc_class: bpy.props.StringProperty() relating_type_id: bpy.props.IntProperty() from_invoke: bpy.props.BoolProperty(default=False) @@ -232,15 +231,13 @@ class AddConstrTypeInstance(bpy.types.Operator): bpy.ops.bim.add_filled_opening(voided_obj=building_obj.name, filling_obj=obj.name) else: if collection_obj and tool.Ifc.get_entity(collection_obj): - obj.location[2] = collection_obj.location[2] - min([v[2] for v in obj.bound_box]) + obj.location.z = collection_obj.location.z - tool.Blender.get_object_bounding_box(obj)["min_z"] unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get()) for port in ifcopenshell.util.system.get_ports(relating_type): - mat = ifcopenshell.util.placement.get_local_placement(port.ObjectPlacement) - mat[0][3] *= unit_scale - mat[1][3] *= unit_scale - mat[2][3] *= unit_scale - mat = obj.matrix_world @ mathutils.Matrix(mat) + mat = Matrix(ifcopenshell.util.placement.get_local_placement(port.ObjectPlacement)) + mat.translation *= unit_scale + mat = obj.matrix_world @ mat new_port = tool.Ifc.run("root.create_entity", ifc_class="IfcDistributionPort") tool.Ifc.run("system.assign_port", element=element, port=new_port) tool.Ifc.run("geometry.edit_object_placement", product=new_port, matrix=mat, is_si=True) diff --git a/src/blenderbim/blenderbim/bim/module/model/ui.py b/src/blenderbim/blenderbim/bim/module/model/ui.py index b559b8ae78..9ff0b0a282 100644 --- a/src/blenderbim/blenderbim/bim/module/model/ui.py +++ b/src/blenderbim/blenderbim/bim/module/model/ui.py @@ -125,7 +125,6 @@ class LaunchTypeManager(bpy.types.Operator): text = f"Add {relating_type['predefined_type']}" if relating_type["predefined_type"] else "Add" op = row.operator("bim.add_constr_type_instance", icon="ADD", text=text) op.from_invoke = True - op.ifc_class = relating_type["ifc_class"] op.relating_type_id = relating_type["id"] op = row.operator("bim.rename_type", icon="GREASEPENCIL", text="") diff --git a/src/blenderbim/blenderbim/bim/module/model/workspace.py b/src/blenderbim/blenderbim/bim/module/model/workspace.py index 1434c68e4f..94d6137cd2 100644 --- a/src/blenderbim/blenderbim/bim/module/model/workspace.py +++ b/src/blenderbim/blenderbim/bim/module/model/workspace.py @@ -411,7 +411,6 @@ class BimToolUI: row.label(text="", icon="EVENT_A") op = row.operator("bim.add_constr_type_instance", text="Add") op.from_invoke = True - op.ifc_class = cls.props.ifc_class if cls.props.relating_type_id.isnumeric(): op.relating_type_id = int(cls.props.relating_type_id) @@ -463,7 +462,6 @@ class BimToolUI: row.label(text="", icon="EVENT_A") op = row.operator("bim.add_constr_type_instance", text="Add") op.from_invoke = True - op.ifc_class = cls.props.ifc_class if cls.props.relating_type_id.isnumeric(): op.relating_type_id = int(cls.props.relating_type_id) diff --git a/src/blenderbim/test/bim/test_feature.py b/src/blenderbim/test/bim/test_feature.py index 8fcc687c2d..050eeeb229 100644 --- a/src/blenderbim/test/bim/test_feature.py +++ b/src/blenderbim/test/bim/test_feature.py @@ -754,7 +754,7 @@ def i_display_the_construction_type_browser(): @when("I add the construction type") def i_add_the_active_construction_type(): props = bpy.context.scene.BIMModelProperties - bpy.ops.bim.add_constr_type_instance(ifc_class=props.ifc_class, relating_type_id=int(props.relating_type_id)) + bpy.ops.bim.add_constr_type_instance(relating_type_id=int(props.relating_type_id)) @then(parsers.parse("construction type is {relating_type_name}"))