show mep regenerate and connecte elements for non-profile based elements

This commit is contained in:
Andrej730
2023-11-10 16:17:02 +05:00
parent 944f8695c7
commit 6140e67702
@@ -26,6 +26,7 @@ from blenderbim.bim.helper import prop_with_search, close_operator_panel
from bpy.types import WorkSpaceTool from bpy.types import WorkSpaceTool
from blenderbim.bim.module.model.data import AuthoringData from blenderbim.bim.module.model.data import AuthoringData
from blenderbim.bim.module.drawing.data import DecoratorData from blenderbim.bim.module.drawing.data import DecoratorData
from blenderbim.bim.module.system.data import PortData
from blenderbim.bim.module.model.prop import get_ifc_class from blenderbim.bim.module.model.prop import get_ifc_class
@@ -218,6 +219,9 @@ class BimToolUI:
row.label(text="No IFC Project", icon="ERROR") row.label(text="No IFC Project", icon="ERROR")
return return
if not PortData.is_loaded:
PortData.load()
if not AuthoringData.is_loaded: if not AuthoringData.is_loaded:
AuthoringData.load(ifc_element_type) AuthoringData.load(ifc_element_type)
elif ifc_element_type == "all" and AuthoringData.data["ifc_element_type"] is not None: elif ifc_element_type == "all" and AuthoringData.data["ifc_element_type"] is not None:
@@ -348,14 +352,12 @@ class BimToolUI:
"IfcPipeSegment", "IfcPipeSegment",
): ):
add_layout_hotkey_operator(cls.layout, "Add Fitting", "S_F", "") add_layout_hotkey_operator(cls.layout, "Add Fitting", "S_F", "")
add_layout_hotkey_operator(
cls.layout, "Regen MEP", "S_G", bpy.ops.bim.regenerate_distribution_element.__doc__
)
if context.region.type != "TOOL_HEADER": if context.region.type != "TOOL_HEADER":
cls.layout.operator("bim.mep_add_bend") cls.layout.operator("bim.mep_add_bend")
cls.layout.operator("bim.mep_add_transition") cls.layout.operator("bim.mep_add_transition")
cls.layout.operator("bim.mep_add_obstruction") cls.layout.operator("bim.mep_add_obstruction")
cls.layout.operator("bim.mep_connect_elements")
else: else:
add_layout_hotkey_operator(cls.layout, "Edit Axis", "A_E", "") add_layout_hotkey_operator(cls.layout, "Edit Axis", "A_E", "")
add_layout_hotkey_operator(cls.layout, "Flip", "S_F", bpy.ops.bim.flip_object.__doc__) add_layout_hotkey_operator(cls.layout, "Flip", "S_F", bpy.ops.bim.flip_object.__doc__)
@@ -402,6 +404,12 @@ class BimToolUI:
row.label(text="", icon=f"EVENT_TAB") row.label(text="", icon=f"EVENT_TAB")
row.operator("bim.enable_editing_roof_path", text="Edit Roof Path") row.operator("bim.enable_editing_roof_path", text="Edit Roof Path")
if context.region.type != "TOOL_HEADER" and PortData.data["total_ports"] > 0:
add_layout_hotkey_operator(
cls.layout, "Regen MEP", "S_G", bpy.ops.bim.regenerate_distribution_element.__doc__
)
cls.layout.operator("bim.mep_connect_elements")
row = cls.layout.row(align=True) row = cls.layout.row(align=True)
row.label(text="", icon="EVENT_SHIFT") row.label(text="", icon="EVENT_SHIFT")
row.label(text="", icon="EVENT_O") row.label(text="", icon="EVENT_O")
@@ -676,21 +684,23 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bpy.ops.bim.fit_flow_segments() bpy.ops.bim.fit_flow_segments()
def hotkey_S_G(self): def hotkey_S_G(self):
obj = bpy.context.active_object
element = tool.Ifc.get_entity(obj)
if not bpy.context.selected_objects: if not bpy.context.selected_objects:
if self.props.ifc_class == "IfcSpaceType": if self.props.ifc_class == "IfcSpaceType":
bpy.ops.bim.generate_space() bpy.ops.bim.generate_space()
return return
if self.active_material_usage == "LAYER2": if self.active_material_usage == "LAYER2":
bpy.ops.bim.recalculate_wall() bpy.ops.bim.recalculate_wall()
elif tool.System.get_ports(element):
bpy.ops.bim.regenerate_distribution_element()
elif self.active_material_usage == "PROFILE": elif self.active_material_usage == "PROFILE":
if self.active_class in ( if self.active_class not in (
"IfcCableCarrierSegment", "IfcCableCarrierSegment",
"IfcCableSegment", "IfcCableSegment",
"IfcDuctSegment", "IfcDuctSegment",
"IfcPipeSegment", "IfcPipeSegment",
): ):
bpy.ops.bim.regenerate_distribution_element()
else:
bpy.ops.bim.recalculate_profile() bpy.ops.bim.recalculate_profile()
elif self.active_class in ("IfcWindow", "IfcWindowStandardCase", "IfcDoor", "IfcDoorStandardCase"): elif self.active_class in ("IfcWindow", "IfcWindowStandardCase", "IfcDoor", "IfcDoorStandardCase"):
bpy.ops.bim.recalculate_fill() bpy.ops.bim.recalculate_fill()