mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
small add_constr_type_instance refactor
ifc_class removed as it was never used - ifc_class was always figured either from BIMModelProperties.relating_type_id or operator.relating_type_id
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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="")
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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}"))
|
||||
|
||||
Reference in New Issue
Block a user