mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-03 21:38:12 +00:00
black .
This commit is contained in:
@@ -24,10 +24,11 @@ import ifcopenshell.util.unit
|
|||||||
from bpy.types import WorkSpaceTool
|
from bpy.types import WorkSpaceTool
|
||||||
from bonsai.bim.module.model.data import AuthoringData, RailingData, RoofData
|
from bonsai.bim.module.model.data import AuthoringData, RailingData, RoofData
|
||||||
|
|
||||||
|
|
||||||
def check_display_mode():
|
def check_display_mode():
|
||||||
global display_mode
|
global display_mode
|
||||||
try:
|
try:
|
||||||
theme = bpy.context.preferences.themes['Default']
|
theme = bpy.context.preferences.themes["Default"]
|
||||||
text_color = theme.user_interface.wcol_menu_item.text
|
text_color = theme.user_interface.wcol_menu_item.text
|
||||||
background_color = theme.user_interface.wcol_menu_item.outline
|
background_color = theme.user_interface.wcol_menu_item.outline
|
||||||
print(f"text_color = {text_color}")
|
print(f"text_color = {text_color}")
|
||||||
@@ -92,16 +93,36 @@ class CadTool(WorkSpaceTool):
|
|||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if element:
|
if element:
|
||||||
if element.is_a("IfcProfileDef"):
|
if element.is_a("IfcProfileDef"):
|
||||||
add_header_apply_button(layout, "Edit Profile", "bim.edit_arbitrary_profile", "bim.disable_editing_arbitrary_profile", ui_context)
|
add_header_apply_button(
|
||||||
|
layout,
|
||||||
|
"Edit Profile",
|
||||||
|
"bim.edit_arbitrary_profile",
|
||||||
|
"bim.disable_editing_arbitrary_profile",
|
||||||
|
ui_context,
|
||||||
|
)
|
||||||
elif element.is_a("IfcRelSpaceBoundary"):
|
elif element.is_a("IfcRelSpaceBoundary"):
|
||||||
add_header_apply_button(layout, "Edit Boundary Geometry", "bim.edit_boundary_geometry", "bim.disable_editing_boundary_geometry", ui_context)
|
add_header_apply_button(
|
||||||
|
layout,
|
||||||
|
"Edit Boundary Geometry",
|
||||||
|
"bim.edit_boundary_geometry",
|
||||||
|
"bim.disable_editing_boundary_geometry",
|
||||||
|
ui_context,
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
add_header_apply_button(layout, "Edit Profile", "bim.edit_extrusion_profile", "bim.disable_editing_extrusion_profile", ui_context)
|
add_header_apply_button(
|
||||||
|
layout,
|
||||||
|
"Edit Profile",
|
||||||
|
"bim.edit_extrusion_profile",
|
||||||
|
"bim.disable_editing_extrusion_profile",
|
||||||
|
ui_context,
|
||||||
|
)
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
add_layout_hotkey_operator(row, "Extend", "S_E", "Extends/reduces element to 3D cursor", ui_context)
|
add_layout_hotkey_operator(row, "Extend", "S_E", "Extends/reduces element to 3D cursor", ui_context)
|
||||||
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
||||||
add_layout_hotkey_operator(row, "Join", "S_T", "Joins two non-parallel paths at their intersection", ui_context)
|
add_layout_hotkey_operator(
|
||||||
|
row, "Join", "S_T", "Joins two non-parallel paths at their intersection", ui_context
|
||||||
|
)
|
||||||
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
||||||
add_layout_hotkey_operator(row, "Fillet", "S_V", "Fillet", ui_context)
|
add_layout_hotkey_operator(row, "Fillet", "S_V", "Fillet", ui_context)
|
||||||
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
||||||
@@ -120,7 +141,9 @@ class CadTool(WorkSpaceTool):
|
|||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
add_layout_hotkey_operator(row, "Extend", "S_E", "Extends/reduces element to 3D cursor", ui_context)
|
add_layout_hotkey_operator(row, "Extend", "S_E", "Extends/reduces element to 3D cursor", ui_context)
|
||||||
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
||||||
add_layout_hotkey_operator(row, "Join", "S_T", "Joins two non-parallel paths at their intersection", ui_context)
|
add_layout_hotkey_operator(
|
||||||
|
row, "Join", "S_T", "Joins two non-parallel paths at their intersection", ui_context
|
||||||
|
)
|
||||||
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
||||||
add_layout_hotkey_operator(row, "Fillet", "S_F", "Fillet", ui_context)
|
add_layout_hotkey_operator(row, "Fillet", "S_F", "Fillet", ui_context)
|
||||||
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
||||||
@@ -132,21 +155,31 @@ class CadTool(WorkSpaceTool):
|
|||||||
and RailingData.data["pset_data"]
|
and RailingData.data["pset_data"]
|
||||||
and context.active_object.BIMRailingProperties.is_editing_path
|
and context.active_object.BIMRailingProperties.is_editing_path
|
||||||
):
|
):
|
||||||
add_header_apply_button(layout, "Edit Railing Path", "bim.finish_editing_railing_path", "bim.cancel_editing_railing_path", ui_context)
|
add_header_apply_button(
|
||||||
|
layout,
|
||||||
|
"Edit Railing Path",
|
||||||
|
"bim.finish_editing_railing_path",
|
||||||
|
"bim.cancel_editing_railing_path",
|
||||||
|
ui_context,
|
||||||
|
)
|
||||||
|
|
||||||
elif (
|
elif (
|
||||||
(RoofData.is_loaded or not RoofData.load())
|
(RoofData.is_loaded or not RoofData.load())
|
||||||
and RoofData.data["pset_data"]
|
and RoofData.data["pset_data"]
|
||||||
and context.active_object.BIMRoofProperties.is_editing_path
|
and context.active_object.BIMRoofProperties.is_editing_path
|
||||||
):
|
):
|
||||||
add_header_apply_button(layout, "Edit Roof Path", "bim.finish_editing_roof_path", "bim.cancel_editing_roof_path", ui_context)
|
add_header_apply_button(
|
||||||
|
layout, "Edit Roof Path", "bim.finish_editing_roof_path", "bim.cancel_editing_roof_path", ui_context
|
||||||
|
)
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
add_layout_hotkey_operator(row, "Set Gable Roof Angle", "S_R", "Set Gable Roof Angle", ui_context)
|
add_layout_hotkey_operator(row, "Set Gable Roof Angle", "S_R", "Set Gable Roof Angle", ui_context)
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
add_layout_hotkey_operator(row, "Extend", "S_E", "Extends/reduces element to 3D cursor", ui_context)
|
add_layout_hotkey_operator(row, "Extend", "S_E", "Extends/reduces element to 3D cursor", ui_context)
|
||||||
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
||||||
add_layout_hotkey_operator(row, "Join", "S_T", "Joins two non-parallel paths at their intersection", ui_context)
|
add_layout_hotkey_operator(
|
||||||
|
row, "Join", "S_T", "Joins two non-parallel paths at their intersection", ui_context
|
||||||
|
)
|
||||||
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
||||||
add_layout_hotkey_operator(row, "Fillet", "S_V", "Fillet", ui_context)
|
add_layout_hotkey_operator(row, "Fillet", "S_V", "Fillet", ui_context)
|
||||||
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
row = row if ui_context == "TOOL_HEADER" else layout.row(align=True)
|
||||||
@@ -284,10 +317,16 @@ def add_header_apply_button(layout, text, apply_operator, cancel_operator, ui_co
|
|||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.label(text=f"{text} Mode", icon_value=custom_icon)
|
row.label(text=f"{text} Mode", icon_value=custom_icon)
|
||||||
if apply_operator in ("bim.edit_arbitrary_profile", "bim.edit_extrusion_profile"):
|
if apply_operator in ("bim.edit_arbitrary_profile", "bim.edit_extrusion_profile"):
|
||||||
row.operator("bim.align_view_to_profile", text="Align View" if ui_context!="TOOL_HEADER" else "", icon="AXIS_FRONT")
|
row.operator(
|
||||||
|
"bim.align_view_to_profile", text="Align View" if ui_context != "TOOL_HEADER" else "", icon="AXIS_FRONT"
|
||||||
|
)
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.operator(apply_operator, text="Apply" if ui_context!="TOOL_HEADER" else "", icon_value=custom_icon_previews["APPLY"].icon_id)
|
row.operator(
|
||||||
|
apply_operator,
|
||||||
|
text="Apply" if ui_context != "TOOL_HEADER" else "",
|
||||||
|
icon_value=custom_icon_previews["APPLY"].icon_id,
|
||||||
|
)
|
||||||
row.label(text="", icon="EVENT_TAB") if ui_context != "TOOL_HEADER" else row
|
row.label(text="", icon="EVENT_TAB") if ui_context != "TOOL_HEADER" else row
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
@@ -317,9 +356,6 @@ def add_layout_hotkey_operator(layout, text, hotkey, description, ui_context="")
|
|||||||
return op
|
return op
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
custom_icon_previews = None
|
custom_icon_previews = None
|
||||||
display_mode = None
|
display_mode = None
|
||||||
|
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ def add_layout_hotkey_operator(layout, text, hotkey, description, ui_context="")
|
|||||||
|
|
||||||
def format_ifc_camel_case(string):
|
def format_ifc_camel_case(string):
|
||||||
string = string.replace("Ifc", "")
|
string = string.replace("Ifc", "")
|
||||||
return ''.join(' ' + char if char.isupper() else char for char in string).strip()
|
return "".join(" " + char if char.isupper() else char for char in string).strip()
|
||||||
|
|
||||||
|
|
||||||
class CreateObjectUI:
|
class CreateObjectUI:
|
||||||
@@ -336,7 +336,11 @@ class CreateObjectUI:
|
|||||||
AuthoringData.load(ifc_element_type)
|
AuthoringData.load(ifc_element_type)
|
||||||
|
|
||||||
if ifc_element_type and context.region.type == "TOOL_HEADER":
|
if ifc_element_type and context.region.type == "TOOL_HEADER":
|
||||||
tool_name = "Multi Object Tool" if ifc_element_type == "all" else format_ifc_camel_case(ifc_element_type.removesuffix('Type')) + ' Tool'
|
tool_name = (
|
||||||
|
"Multi Object Tool"
|
||||||
|
if ifc_element_type == "all"
|
||||||
|
else format_ifc_camel_case(ifc_element_type.removesuffix("Type")) + " Tool"
|
||||||
|
)
|
||||||
cls.layout.label(text=tool_name, icon="TOOL_SETTINGS")
|
cls.layout.label(text=tool_name, icon="TOOL_SETTINGS")
|
||||||
|
|
||||||
cls.draw_type_manager_launcher(context)
|
cls.draw_type_manager_launcher(context)
|
||||||
@@ -387,7 +391,9 @@ class CreateObjectUI:
|
|||||||
row.prop(data=cls.props, property="x_angle", text="Slope") if ui_context != "TOOL_HEADER" else "A"
|
row.prop(data=cls.props, property="x_angle", text="Slope") if ui_context != "TOOL_HEADER" else "A"
|
||||||
|
|
||||||
elif cls.props.ifc_class in ("IfcSlabType", "IfcRampType", "IfcRoofType"):
|
elif cls.props.ifc_class in ("IfcSlabType", "IfcRampType", "IfcRoofType"):
|
||||||
row.prop(data=cls.props, property="x_angle", text="Slope" if ui_context != "TOOL_HEADER" else "A", icon="FILE_3D")
|
row.prop(
|
||||||
|
data=cls.props, property="x_angle", text="Slope" if ui_context != "TOOL_HEADER" else "A", icon="FILE_3D"
|
||||||
|
)
|
||||||
|
|
||||||
elif cls.props.ifc_class in ("IfcColumnType", "IfcMemberType"):
|
elif cls.props.ifc_class in ("IfcColumnType", "IfcMemberType"):
|
||||||
row.prop(data=cls.props, property="cardinal_point", text="Axis")
|
row.prop(data=cls.props, property="cardinal_point", text="Axis")
|
||||||
@@ -410,7 +416,9 @@ class CreateObjectUI:
|
|||||||
"IfcCableCarrierSegmentType",
|
"IfcCableCarrierSegmentType",
|
||||||
"IfcCableSegmentType",
|
"IfcCableSegmentType",
|
||||||
):
|
):
|
||||||
row.prop(data=cls.props, property="rl2", text="Relative Level (rl2)" if ui_context != "TOOL_HEADER" else "RL")
|
row.prop(
|
||||||
|
data=cls.props, property="rl2", text="Relative Level (rl2)" if ui_context != "TOOL_HEADER" else "RL"
|
||||||
|
)
|
||||||
|
|
||||||
### this neeeds to move
|
### this neeeds to move
|
||||||
elif cls.props.ifc_class in ("IfcSpaceType"):
|
elif cls.props.ifc_class in ("IfcSpaceType"):
|
||||||
@@ -426,12 +434,18 @@ class CreateObjectUI:
|
|||||||
prop_with_search(row, cls.props, "ifc_class", text="Type Class" if ui_context != "TOOL_HEADER" else "")
|
prop_with_search(row, cls.props, "ifc_class", text="Type Class" if ui_context != "TOOL_HEADER" else "")
|
||||||
if AuthoringData.data["relating_type_id"]:
|
if AuthoringData.data["relating_type_id"]:
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
prop_with_search(row, cls.props, "relating_type_id", text="Relating Type" if ui_context != "TOOL_HEADER" else "")
|
prop_with_search(
|
||||||
|
row, cls.props, "relating_type_id", text="Relating Type" if ui_context != "TOOL_HEADER" else ""
|
||||||
|
)
|
||||||
row.operator("bim.launch_type_manager", icon=tool.Blender.TYPE_MANAGER_ICON, text="")
|
row.operator("bim.launch_type_manager", icon=tool.Blender.TYPE_MANAGER_ICON, text="")
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
add_layout_hotkey_operator(row, "Add", "S_A", bpy.ops.bim.add_constr_type_instance.__doc__, ui_context)
|
add_layout_hotkey_operator(row, "Add", "S_A", bpy.ops.bim.add_constr_type_instance.__doc__, ui_context)
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
add_layout_hotkey_operator(row, "Draw", "S_P", bpy.ops.bim.draw_polyline_wall.__doc__, ui_context) if cls.props.ifc_class == "IfcWallType" else row
|
(
|
||||||
|
add_layout_hotkey_operator(row, "Draw", "S_P", bpy.ops.bim.draw_polyline_wall.__doc__, ui_context)
|
||||||
|
if cls.props.ifc_class == "IfcWallType"
|
||||||
|
else row
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
row.label(text="No Construction Type", icon="FILE_3D")
|
row.label(text="No Construction Type", icon="FILE_3D")
|
||||||
|
|
||||||
@@ -523,18 +537,31 @@ class EditObjectUI:
|
|||||||
op = row.operator("bim.change_cardinal_point", icon="FILE_REFRESH", text="")
|
op = row.operator("bim.change_cardinal_point", icon="FILE_REFRESH", text="")
|
||||||
op.cardinal_point = int(cls.props.cardinal_point)
|
op.cardinal_point = int(cls.props.cardinal_point)
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
label = ("Height" if AuthoringData.data["active_class"] in ("IfcColumn", "IfcColumnStandardCase") else "Length")
|
label = (
|
||||||
row.prop(data=cls.props, property="extrusion_depth", text=label if ui_context != "TOOL_HEADER" else label[0])
|
"Height" if AuthoringData.data["active_class"] in ("IfcColumn", "IfcColumnStandardCase") else "Length"
|
||||||
|
)
|
||||||
|
row.prop(
|
||||||
|
data=cls.props, property="extrusion_depth", text=label if ui_context != "TOOL_HEADER" else label[0]
|
||||||
|
)
|
||||||
op = row.operator("bim.change_profile_depth", icon="FILE_REFRESH", text="")
|
op = row.operator("bim.change_profile_depth", icon="FILE_REFRESH", text="")
|
||||||
op.depth = cls.props.extrusion_depth
|
op.depth = cls.props.extrusion_depth
|
||||||
|
|
||||||
elif AuthoringData.data["active_class"] in ("IfcWindow","IfcWindowStandardCase","IfcDoor","IfcDoorStandardCase"):
|
elif AuthoringData.data["active_class"] in (
|
||||||
|
"IfcWindow",
|
||||||
|
"IfcWindowStandardCase",
|
||||||
|
"IfcDoor",
|
||||||
|
"IfcDoorStandardCase",
|
||||||
|
):
|
||||||
if AuthoringData.data["active_class"] in ("IfcWindow", "IfcWindowStandardCase"):
|
if AuthoringData.data["active_class"] in ("IfcWindow", "IfcWindowStandardCase"):
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
row.prop(data=cls.props, property="rl2", text="Relative Level (rl2)" if ui_context != "TOOL_HEADER" else "RL")
|
row.prop(
|
||||||
|
data=cls.props, property="rl2", text="Relative Level (rl2)" if ui_context != "TOOL_HEADER" else "RL"
|
||||||
|
)
|
||||||
elif AuthoringData.data["active_class"] in ("IfcDoor", "IfcDoorStandardCase"):
|
elif AuthoringData.data["active_class"] in ("IfcDoor", "IfcDoorStandardCase"):
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
row.prop(data=cls.props, property="rl1", text="Relative Level (rl1)" if ui_context != "TOOL_HEADER" else "RL")
|
row.prop(
|
||||||
|
data=cls.props, property="rl1", text="Relative Level (rl1)" if ui_context != "TOOL_HEADER" else "RL"
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def draw_operations(cls, context):
|
def draw_operations(cls, context):
|
||||||
@@ -549,19 +576,27 @@ class EditObjectUI:
|
|||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
add_layout_hotkey_operator(row, "Extend", "S_E", "Extends/reduces element to 3D cursor", ui_context)
|
add_layout_hotkey_operator(row, "Extend", "S_E", "Extends/reduces element to 3D cursor", ui_context)
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
add_layout_hotkey_operator(row, "Butt", "S_T", "Intersects two non-parallel elements to a butt corner junction", ui_context)
|
add_layout_hotkey_operator(
|
||||||
|
row, "Butt", "S_T", "Intersects two non-parallel elements to a butt corner junction", ui_context
|
||||||
|
)
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
add_layout_hotkey_operator(row, "Mitre", "S_Y", "Intersects two non-parallel elements to a mitred corner junction", ui_context)
|
add_layout_hotkey_operator(
|
||||||
|
row, "Mitre", "S_Y", "Intersects two non-parallel elements to a mitred corner junction", ui_context
|
||||||
|
)
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
add_layout_hotkey_operator(row, "Unjoin Walls", "S_U", "", ui_context)
|
add_layout_hotkey_operator(row, "Unjoin Walls", "S_U", "", ui_context)
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
add_layout_hotkey_operator(row, "Merge", "S_M", "Merge selected Elements", ui_context)
|
add_layout_hotkey_operator(row, "Merge", "S_M", "Merge selected Elements", ui_context)
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
add_layout_hotkey_operator(row, "Split", "S_K", "Split selected Element into two Elements at the cursor location", ui_context)
|
add_layout_hotkey_operator(
|
||||||
|
row, "Split", "S_K", "Split selected Element into two Elements at the cursor location", ui_context
|
||||||
|
)
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
add_layout_hotkey_operator(row, "Rotate 90", "S_R", "Rotate the selected Element by 90 degrees", ui_context)
|
add_layout_hotkey_operator(row, "Rotate 90", "S_R", "Rotate the selected Element by 90 degrees", ui_context)
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
add_layout_hotkey_operator(row, "Flip", "S_F", "Flip Element about its local axes, keep the position", ui_context)
|
add_layout_hotkey_operator(
|
||||||
|
row, "Flip", "S_F", "Flip Element about its local axes, keep the position", ui_context
|
||||||
|
)
|
||||||
|
|
||||||
elif AuthoringData.data["active_material_usage"] == "LAYER3":
|
elif AuthoringData.data["active_material_usage"] == "LAYER3":
|
||||||
if "LAYER2" in AuthoringData.data["selected_material_usages"]:
|
if "LAYER2" in AuthoringData.data["selected_material_usages"]:
|
||||||
@@ -575,20 +610,37 @@ class EditObjectUI:
|
|||||||
add_layout_hotkey_operator(row, "Flip", "S_F", bpy.ops.bim.flip_object.__doc__, ui_context)
|
add_layout_hotkey_operator(row, "Flip", "S_F", bpy.ops.bim.flip_object.__doc__, ui_context)
|
||||||
|
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
if AuthoringData.data["active_class"] in ("IfcCableCarrierSegment","IfcCableSegment","IfcDuctSegment","IfcPipeSegment"):
|
if AuthoringData.data["active_class"] in (
|
||||||
|
"IfcCableCarrierSegment",
|
||||||
|
"IfcCableSegment",
|
||||||
|
"IfcDuctSegment",
|
||||||
|
"IfcPipeSegment",
|
||||||
|
):
|
||||||
add_layout_hotkey_operator(row, "Add Fitting", "S_Y", "", ui_context)
|
add_layout_hotkey_operator(row, "Add Fitting", "S_Y", "", ui_context)
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
row.operator("bim.mep_add_bend", text="Add Bend" if ui_context != "TOOL_HEADER" else "", icon_value=custom_icon_previews["ADD_BEND"].icon_id)
|
row.operator(
|
||||||
|
"bim.mep_add_bend",
|
||||||
|
text="Add Bend" if ui_context != "TOOL_HEADER" else "",
|
||||||
|
icon_value=custom_icon_previews["ADD_BEND"].icon_id,
|
||||||
|
)
|
||||||
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
||||||
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
||||||
|
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
row.operator("bim.mep_add_transition", text="Add Transition" if ui_context != "TOOL_HEADER" else "", icon_value=custom_icon_previews["ADD_TRANSITION"].icon_id)
|
row.operator(
|
||||||
|
"bim.mep_add_transition",
|
||||||
|
text="Add Transition" if ui_context != "TOOL_HEADER" else "",
|
||||||
|
icon_value=custom_icon_previews["ADD_TRANSITION"].icon_id,
|
||||||
|
)
|
||||||
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
||||||
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
||||||
|
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
row.operator("bim.mep_add_obstruction", text="Add Obstruction" if ui_context != "TOOL_HEADER" else "", icon_value=custom_icon_previews["IFC"].icon_id)
|
row.operator(
|
||||||
|
"bim.mep_add_obstruction",
|
||||||
|
text="Add Obstruction" if ui_context != "TOOL_HEADER" else "",
|
||||||
|
icon_value=custom_icon_previews["IFC"].icon_id,
|
||||||
|
)
|
||||||
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
||||||
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
||||||
|
|
||||||
@@ -603,7 +655,11 @@ class EditObjectUI:
|
|||||||
|
|
||||||
if PortData.data["total_ports"] > 0:
|
if PortData.data["total_ports"] > 0:
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
row.operator("bim.mep_connect_elements", text="Connect MEP Elements" if ui_context != "TOOL_HEADER" else "", icon_value=custom_icon_previews["CONNECT_MEP_ELEMENTS"].icon_id)
|
row.operator(
|
||||||
|
"bim.mep_connect_elements",
|
||||||
|
text="Connect MEP Elements" if ui_context != "TOOL_HEADER" else "",
|
||||||
|
icon_value=custom_icon_previews["CONNECT_MEP_ELEMENTS"].icon_id,
|
||||||
|
)
|
||||||
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
||||||
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
row.label(text="", icon="BLANK1") if ui_context != "TOOL_HEADER" else row
|
||||||
|
|
||||||
@@ -619,7 +675,12 @@ class EditObjectUI:
|
|||||||
op.hotkey = "S_G"
|
op.hotkey = "S_G"
|
||||||
op.description = description.strip()
|
op.description = description.strip()
|
||||||
elif AuthoringData.data["active_material_usage"] == "PROFILE":
|
elif AuthoringData.data["active_material_usage"] == "PROFILE":
|
||||||
if AuthoringData.data["active_class"] in ("IfcCableCarrierSegment","IfcCableSegment","IfcDuctSegment","IfcPipeSegment"):
|
if AuthoringData.data["active_class"] in (
|
||||||
|
"IfcCableCarrierSegment",
|
||||||
|
"IfcCableSegment",
|
||||||
|
"IfcDuctSegment",
|
||||||
|
"IfcPipeSegment",
|
||||||
|
):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
op = row.operator("bim.hotkey", text="", icon_value=custom_icon)
|
op = row.operator("bim.hotkey", text="", icon_value=custom_icon)
|
||||||
@@ -701,7 +762,9 @@ class EditObjectUI:
|
|||||||
row.separator()
|
row.separator()
|
||||||
row.label(text="Quantity Take-off") if ui_context != "TOOL_HEADER" else row
|
row.label(text="Quantity Take-off") if ui_context != "TOOL_HEADER" else row
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
add_layout_hotkey_operator(row, "Perform Quantity Take-off", "S_Q", bpy.ops.bim.perform_quantity_take_off.__doc__, ui_context)
|
add_layout_hotkey_operator(
|
||||||
|
row, "Perform Quantity Take-off", "S_Q", bpy.ops.bim.perform_quantity_take_off.__doc__, ui_context
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def draw_modes(cls, context):
|
def draw_modes(cls, context):
|
||||||
@@ -714,9 +777,15 @@ class EditObjectUI:
|
|||||||
if len(context.selected_objects) == 1:
|
if len(context.selected_objects) == 1:
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
add_layout_hotkey_operator(row, "Edit Profile", "S_E", "", ui_context)
|
add_layout_hotkey_operator(row, "Edit Profile", "S_E", "", ui_context)
|
||||||
elif (tool.Model.is_parametric_railing_active() and not context.active_object.BIMRailingProperties.is_editing_path):
|
elif (
|
||||||
|
tool.Model.is_parametric_railing_active() and not context.active_object.BIMRailingProperties.is_editing_path
|
||||||
|
):
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
row.operator("bim.enable_editing_railing_path", text="Edit Path" if ui_context != "TOOL_HEADER" else "", icon_value=custom_icon_previews["EDIT_RAILING_PATH"].icon_id)
|
row.operator(
|
||||||
|
"bim.enable_editing_railing_path",
|
||||||
|
text="Edit Path" if ui_context != "TOOL_HEADER" else "",
|
||||||
|
icon_value=custom_icon_previews["EDIT_RAILING_PATH"].icon_id,
|
||||||
|
)
|
||||||
elif AuthoringData.data["active_material_usage"] == "PROFILE":
|
elif AuthoringData.data["active_material_usage"] == "PROFILE":
|
||||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||||
add_layout_hotkey_operator(row, "Edit Axis", "A_E", "", ui_context)
|
add_layout_hotkey_operator(row, "Edit Axis", "A_E", "", ui_context)
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ class Web(bonsai.core.tool.Web):
|
|||||||
cls.send_webui_data(
|
cls.send_webui_data(
|
||||||
data=ifcopenshell.util.cost.get_cost_schedule_types(ifc_file),
|
data=ifcopenshell.util.cost.get_cost_schedule_types(ifc_file),
|
||||||
data_key="predefined_types",
|
data_key="predefined_types",
|
||||||
event="predefined_types"
|
event="predefined_types",
|
||||||
)
|
)
|
||||||
if operator_data["type"] == "addCostSchedule":
|
if operator_data["type"] == "addCostSchedule":
|
||||||
bonsai.core.cost.add_cost_schedule(
|
bonsai.core.cost.add_cost_schedule(
|
||||||
@@ -454,7 +454,13 @@ class Web(bonsai.core.tool.Web):
|
|||||||
prop_name = operator_data["propName"]
|
prop_name = operator_data["propName"]
|
||||||
if prop_name == "count":
|
if prop_name == "count":
|
||||||
prop_name = ""
|
prop_name = ""
|
||||||
bonsai.core.cost.assign_cost_item_quantity(tool.Ifc, tool.Cost, cost_item=ifc_file.by_id(operator_data["costItemId"]), related_object_type="PRODUCT", prop_name=prop_name)
|
bonsai.core.cost.assign_cost_item_quantity(
|
||||||
|
tool.Ifc,
|
||||||
|
tool.Cost,
|
||||||
|
cost_item=ifc_file.by_id(operator_data["costItemId"]),
|
||||||
|
related_object_type="PRODUCT",
|
||||||
|
prop_name=prop_name,
|
||||||
|
)
|
||||||
cost_schedule = tool.Cost.get_cost_schedule(cost_item=tool.Ifc.get().by_id(operator_data["costItemId"]))
|
cost_schedule = tool.Cost.get_cost_schedule(cost_item=tool.Ifc.get().by_id(operator_data["costItemId"]))
|
||||||
cls.load_cost_schedule_web_ui(cost_schedule)
|
cls.load_cost_schedule_web_ui(cost_schedule)
|
||||||
if operator_data["type"] == "enableEditingQuantities":
|
if operator_data["type"] == "enableEditingQuantities":
|
||||||
@@ -473,7 +479,11 @@ class Web(bonsai.core.tool.Web):
|
|||||||
cost_item = ifc_file.by_id(cost_item_id)
|
cost_item = ifc_file.by_id(cost_item_id)
|
||||||
cost_schedule = tool.Cost.get_cost_schedule(cost_item)
|
cost_schedule = tool.Cost.get_cost_schedule(cost_item)
|
||||||
physical_quantity = tool.Ifc.get().by_id(operator_data["quantityId"])
|
physical_quantity = tool.Ifc.get().by_id(operator_data["quantityId"])
|
||||||
tool.Ifc.run("cost.edit_cost_item_quantity", physical_quantity=physical_quantity, attributes=operator_data["attributes"])
|
tool.Ifc.run(
|
||||||
|
"cost.edit_cost_item_quantity",
|
||||||
|
physical_quantity=physical_quantity,
|
||||||
|
attributes=operator_data["attributes"],
|
||||||
|
)
|
||||||
cls.load_cost_schedule_web_ui(cost_schedule)
|
cls.load_cost_schedule_web_ui(cost_schedule)
|
||||||
cls.load_cost_item_quantities_ui(cost_item)
|
cls.load_cost_item_quantities_ui(cost_item)
|
||||||
if operator_data["type"] == "deleteCostItemQuantity":
|
if operator_data["type"] == "deleteCostItemQuantity":
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import ifcopenshell.util.date
|
|||||||
|
|
||||||
CostItem = dict[str, Any]
|
CostItem = dict[str, Any]
|
||||||
|
|
||||||
|
|
||||||
class ifc5D2json:
|
class ifc5D2json:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.json: str = None
|
self.json: str = None
|
||||||
|
|||||||
Reference in New Issue
Block a user