mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
The BIM Tool workspace now intelligently reflects the active object
This commit is contained in:
@@ -42,6 +42,7 @@ class AuthoringData:
|
|||||||
cls.load_relating_types_browser()
|
cls.load_relating_types_browser()
|
||||||
cls.data["is_voidable_element"] = cls.is_voidable_element()
|
cls.data["is_voidable_element"] = cls.is_voidable_element()
|
||||||
cls.data["has_visible_openings"] = cls.has_visible_openings()
|
cls.data["has_visible_openings"] = cls.has_visible_openings()
|
||||||
|
cls.data["active_class"] = cls.active_class()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load_ifc_classes(cls):
|
def load_ifc_classes(cls):
|
||||||
@@ -69,6 +70,12 @@ class AuthoringData:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def active_class(cls):
|
||||||
|
element = tool.Ifc.get_entity(bpy.context.active_object)
|
||||||
|
if element:
|
||||||
|
return element.is_a()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ifc_classes(cls):
|
def ifc_classes(cls):
|
||||||
results = []
|
results = []
|
||||||
|
|||||||
@@ -134,108 +134,117 @@ class BimTool(WorkSpaceTool):
|
|||||||
if relating_type_id.isnumeric():
|
if relating_type_id.isnumeric():
|
||||||
op.relating_type_id = int(relating_type_id)
|
op.relating_type_id = int(relating_type_id)
|
||||||
|
|
||||||
if ifc_classes:
|
if AuthoringData.data["active_class"] in ("IfcWall", "IfcWallStandardCase"):
|
||||||
if ifc_class == "IfcWallType":
|
row = layout.row(align=True)
|
||||||
row = layout.row(align=True)
|
row.prop(data=props, property="extrusion_depth", text="Height")
|
||||||
row.prop(data=props, property="extrusion_depth", text="Height")
|
op = row.operator("bim.change_extrusion_depth", icon="FILE_REFRESH", text="")
|
||||||
op = row.operator("bim.change_extrusion_depth", icon="FILE_REFRESH", text="")
|
op.depth = props.extrusion_depth
|
||||||
op.depth = props.extrusion_depth
|
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(data=props, property="length", text="Length")
|
row.prop(data=props, property="length", text="Length")
|
||||||
op = row.operator("bim.change_layer_length", icon="FILE_REFRESH", text="")
|
op = row.operator("bim.change_layer_length", icon="FILE_REFRESH", text="")
|
||||||
op.length = props.length
|
op.length = props.length
|
||||||
|
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="", icon="EVENT_E")
|
||||||
|
row.operator("bim.hotkey", text="Extend").hotkey = "S_E"
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="", icon="EVENT_T")
|
||||||
|
row.operator("bim.hotkey", text="Butt").hotkey = "S_T"
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="", icon="EVENT_Y")
|
||||||
|
row.operator("bim.hotkey", text="Mitre").hotkey = "S_Y"
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="", icon="EVENT_M")
|
||||||
|
row.operator("bim.hotkey", text="Merge").hotkey = "S_M"
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="", icon="EVENT_F")
|
||||||
|
row.operator("bim.hotkey", text="Flip").hotkey = "S_F"
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="", icon="EVENT_S")
|
||||||
|
row.operator("bim.hotkey", text="Split").hotkey = "S_S"
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="", icon="EVENT_G")
|
||||||
|
row.operator("bim.hotkey", text="Regen").hotkey = "S_G"
|
||||||
|
row.operator("bim.join_wall", icon="X", text="").join_type = ""
|
||||||
|
elif AuthoringData.data["active_class"] in ("IfcSlab", "IfcSlabStandardCase"):
|
||||||
|
if not context.active_object:
|
||||||
|
pass
|
||||||
|
elif context.active_object.mode == "OBJECT":
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
row.label(text="", icon="EVENT_E")
|
row.label(text="", icon="EVENT_E")
|
||||||
row.operator("bim.hotkey", text="Extend").hotkey = "S_E"
|
row.operator("bim.hotkey", text="Edit Profile").hotkey = "S_E"
|
||||||
row = layout.row(align=True)
|
elif AuthoringData.data["active_class"] in (
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
"IfcColumn",
|
||||||
row.label(text="", icon="EVENT_T")
|
"IfcColumnStandardCase",
|
||||||
row.operator("bim.hotkey", text="Butt").hotkey = "S_T"
|
"IfcBeam",
|
||||||
row = layout.row(align=True)
|
"IfcBeamStandardCase",
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
"IfcMember",
|
||||||
row.label(text="", icon="EVENT_Y")
|
"IfcMemberStandardCase",
|
||||||
row.operator("bim.hotkey", text="Mitre").hotkey = "S_Y"
|
):
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
row.prop(data=props, property="cardinal_point", text="Axis")
|
||||||
row.label(text="", icon="EVENT_M")
|
op = row.operator("bim.change_cardinal_point", icon="FILE_REFRESH", text="")
|
||||||
row.operator("bim.hotkey", text="Merge").hotkey = "S_M"
|
op.cardinal_point = int(props.cardinal_point)
|
||||||
row = layout.row(align=True)
|
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
|
||||||
row.label(text="", icon="EVENT_F")
|
|
||||||
row.operator("bim.hotkey", text="Flip").hotkey = "S_F"
|
|
||||||
row = layout.row(align=True)
|
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
|
||||||
row.label(text="", icon="EVENT_S")
|
|
||||||
row.operator("bim.hotkey", text="Split").hotkey = "S_S"
|
|
||||||
row = layout.row(align=True)
|
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
|
||||||
row.label(text="", icon="EVENT_G")
|
|
||||||
row.operator("bim.hotkey", text="Regen").hotkey = "S_G"
|
|
||||||
row.operator("bim.join_wall", icon="X", text="").join_type = ""
|
|
||||||
if ifc_class == "IfcSlabType":
|
|
||||||
if not context.active_object:
|
|
||||||
pass
|
|
||||||
elif context.active_object.mode == "OBJECT":
|
|
||||||
row = layout.row(align=True)
|
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
|
||||||
row.label(text="", icon="EVENT_E")
|
|
||||||
row.operator("bim.hotkey", text="Edit Profile").hotkey = "S_E"
|
|
||||||
|
|
||||||
if ifc_class in ("IfcColumnType", "IfcBeamType", "IfcMemberType"):
|
row = layout.row(align=True)
|
||||||
row = layout.row(align=True)
|
label = "Height" if ifc_class == "IfcColumnType" else "Length"
|
||||||
row.prop(data=props, property="cardinal_point", text="Axis")
|
row.prop(data=props, property="extrusion_depth", text=label)
|
||||||
op = row.operator("bim.change_cardinal_point", icon="FILE_REFRESH", text="")
|
op = row.operator("bim.change_profile_depth", icon="FILE_REFRESH", text="")
|
||||||
op.cardinal_point = int(props.cardinal_point)
|
op.depth = props.extrusion_depth
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
label = "Height" if ifc_class == "IfcColumnType" else "Length"
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
row.prop(data=props, property="extrusion_depth", text=label)
|
row.label(text="", icon="EVENT_E")
|
||||||
op = row.operator("bim.change_profile_depth", icon="FILE_REFRESH", text="")
|
row.operator("bim.hotkey", text="Extend").hotkey = "S_E"
|
||||||
op.depth = props.extrusion_depth
|
row = layout.row(align=True)
|
||||||
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="", icon="EVENT_T")
|
||||||
|
row.operator("bim.hotkey", text="Butt").hotkey = "S_T"
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="", icon="EVENT_Y")
|
||||||
|
row.operator("bim.hotkey", text="Mitre").hotkey = "S_Y"
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="", icon="EVENT_R")
|
||||||
|
row.operator("bim.hotkey", text="Rotate 90").hotkey = "S_R"
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="", icon="EVENT_G")
|
||||||
|
row.operator("bim.hotkey", text="Regen").hotkey = "S_G"
|
||||||
|
row.operator("bim.extend_profile", icon="X", text="").join_type = ""
|
||||||
|
elif AuthoringData.data["active_class"] in (
|
||||||
|
"IfcWindow",
|
||||||
|
"IfcWindowStandardCase",
|
||||||
|
"IfcDoor",
|
||||||
|
"IfcDoorStandardCase",
|
||||||
|
):
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.prop(data=props, property="rl", text="RL")
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
row.label(text="", icon="EVENT_E")
|
row.label(text="", icon="EVENT_G")
|
||||||
row.operator("bim.hotkey", text="Extend").hotkey = "S_E"
|
row.operator("bim.hotkey", text="Regen").hotkey = "S_G"
|
||||||
row = layout.row(align=True)
|
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
|
||||||
row.label(text="", icon="EVENT_T")
|
|
||||||
row.operator("bim.hotkey", text="Butt").hotkey = "S_T"
|
|
||||||
row = layout.row(align=True)
|
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
|
||||||
row.label(text="", icon="EVENT_Y")
|
|
||||||
row.operator("bim.hotkey", text="Mitre").hotkey = "S_Y"
|
|
||||||
row = layout.row(align=True)
|
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
|
||||||
row.label(text="", icon="EVENT_R")
|
|
||||||
row.operator("bim.hotkey", text="Rotate 90").hotkey = "S_R"
|
|
||||||
row = layout.row(align=True)
|
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
|
||||||
row.label(text="", icon="EVENT_G")
|
|
||||||
row.operator("bim.hotkey", text="Regen").hotkey = "S_G"
|
|
||||||
row.operator("bim.extend_profile", icon="X", text="").join_type = ""
|
|
||||||
|
|
||||||
if ifc_class in ("IfcWindowType", "IfcDoorType"):
|
if props.ifc_class in (
|
||||||
row = layout.row(align=True)
|
"IfcCableCarrierSegmentType",
|
||||||
row.prop(data=props, property="rl", text="RL")
|
"IfcCableSegmentType",
|
||||||
|
"IfcDuctSegmentType",
|
||||||
row = layout.row(align=True)
|
"IfcPipeSegmentType",
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
):
|
||||||
row.label(text="", icon="EVENT_G")
|
row = layout.row(align=True)
|
||||||
row.operator("bim.hotkey", text="Regen").hotkey = "S_G"
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="Extend", icon="EVENT_E")
|
||||||
if props.ifc_class in (
|
|
||||||
"IfcCableCarrierSegmentType",
|
|
||||||
"IfcCableSegmentType",
|
|
||||||
"IfcDuctSegmentType",
|
|
||||||
"IfcPipeSegmentType",
|
|
||||||
):
|
|
||||||
row = layout.row(align=True)
|
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
|
||||||
row.label(text="Extend", icon="EVENT_E")
|
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
@@ -292,6 +301,12 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
self.props = context.scene.BIMModelProperties
|
self.props = context.scene.BIMModelProperties
|
||||||
self.has_ifc_class = True
|
self.has_ifc_class = True
|
||||||
|
|
||||||
|
self.active_class = None
|
||||||
|
element = tool.Ifc.get_entity(context.active_object)
|
||||||
|
if element:
|
||||||
|
self.active_class = element.is_a()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.has_ifc_class = bool(self.props.ifc_class)
|
self.has_ifc_class = bool(self.props.ifc_class)
|
||||||
except:
|
except:
|
||||||
@@ -321,79 +336,101 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bpy.ops.bim.add_constr_type_instance()
|
bpy.ops.bim.add_constr_type_instance()
|
||||||
|
|
||||||
def hotkey_S_C(self):
|
def hotkey_S_C(self):
|
||||||
if self.has_ifc_class and self.props.ifc_class == "IfcWallType":
|
if self.active_class in ("IfcWall", "IfcWallStandardCase"):
|
||||||
bpy.ops.bim.align_wall(align_type="CENTERLINE")
|
bpy.ops.bim.align_wall(align_type="CENTERLINE")
|
||||||
else:
|
else:
|
||||||
bpy.ops.bim.align_product(align_type="CENTERLINE")
|
bpy.ops.bim.align_product(align_type="CENTERLINE")
|
||||||
|
|
||||||
def hotkey_S_E(self):
|
def hotkey_S_E(self):
|
||||||
if not self.has_ifc_class:
|
if self.active_class in ("IfcWall", "IfcWallStandardCase"):
|
||||||
return
|
|
||||||
if self.props.ifc_class == "IfcWallType":
|
|
||||||
bpy.ops.bim.join_wall(join_type="T")
|
bpy.ops.bim.join_wall(join_type="T")
|
||||||
elif self.props.ifc_class == "IfcSlabType":
|
elif self.active_class in ("IfcSlab", "IfcSlabStandardCase"):
|
||||||
if not bpy.context.active_object:
|
if not bpy.context.active_object:
|
||||||
pass
|
pass
|
||||||
elif bpy.context.active_object.mode == "OBJECT":
|
elif bpy.context.active_object.mode == "OBJECT":
|
||||||
bpy.ops.bim.enable_editing_extrusion_profile()
|
bpy.ops.bim.enable_editing_extrusion_profile()
|
||||||
elif self.props.ifc_class in ["IfcColumnType", "IfcBeamType", "IfcMemberType"]:
|
elif self.active_class in (
|
||||||
|
"IfcColumn",
|
||||||
|
"IfcColumnStandardCase",
|
||||||
|
"IfcBeam",
|
||||||
|
"IfcBeamStandardCase",
|
||||||
|
"IfcMember",
|
||||||
|
"IfcMemberStandardCase",
|
||||||
|
):
|
||||||
bpy.ops.bim.extend_profile(join_type="T")
|
bpy.ops.bim.extend_profile(join_type="T")
|
||||||
|
|
||||||
def hotkey_S_F(self):
|
def hotkey_S_F(self):
|
||||||
if self.has_ifc_class and self.props.ifc_class == "IfcWallType":
|
if self.active_class in ("IfcWall", "IfcWallStandardCase"):
|
||||||
bpy.ops.bim.flip_wall()
|
bpy.ops.bim.flip_wall()
|
||||||
|
|
||||||
def hotkey_S_G(self):
|
def hotkey_S_G(self):
|
||||||
if self.has_ifc_class and self.props.ifc_class == "IfcWallType":
|
if self.active_class in ("IfcWall", "IfcWallStandardCase"):
|
||||||
bpy.ops.bim.recalculate_wall()
|
bpy.ops.bim.recalculate_wall()
|
||||||
elif self.props.ifc_class in ["IfcColumnType", "IfcBeamType", "IfcMemberType"]:
|
elif self.active_class in (
|
||||||
|
"IfcColumn",
|
||||||
|
"IfcColumnStandardCase",
|
||||||
|
"IfcBeam",
|
||||||
|
"IfcBeamStandardCase",
|
||||||
|
"IfcMember",
|
||||||
|
"IfcMemberStandardCase",
|
||||||
|
):
|
||||||
bpy.ops.bim.recalculate_profile()
|
bpy.ops.bim.recalculate_profile()
|
||||||
elif self.props.ifc_class in ["IfcWindowType", "IfcDoorType"]:
|
elif self.active_class in ("IfcWindow", "IfcWindowStandardCase", "IfcDoor", "IfcDoorStandardCase"):
|
||||||
bpy.ops.bim.recalculate_fill()
|
bpy.ops.bim.recalculate_fill()
|
||||||
|
|
||||||
def hotkey_S_M(self):
|
def hotkey_S_M(self):
|
||||||
if self.has_ifc_class and self.props.ifc_class == "IfcWallType":
|
if self.active_class in ("IfcWall", "IfcWallStandardCase"):
|
||||||
bpy.ops.bim.merge_wall()
|
bpy.ops.bim.merge_wall()
|
||||||
|
|
||||||
def hotkey_S_R(self):
|
def hotkey_S_R(self):
|
||||||
if not self.has_ifc_class:
|
if self.active_class in ("IfcWall", "IfcWallStandardCase"):
|
||||||
return
|
|
||||||
if self.props.ifc_class == "IfcWallType":
|
|
||||||
bpy.ops.bim.rotate_90(axis="Z")
|
bpy.ops.bim.rotate_90(axis="Z")
|
||||||
elif self.props.ifc_class == "IfcColumnType":
|
elif self.active_class in ("IfcColumn", "IfcColumnStandardCase"):
|
||||||
bpy.ops.bim.rotate_90(axis="Z")
|
bpy.ops.bim.rotate_90(axis="Z")
|
||||||
elif self.props.ifc_class in ["IfcBeamType", "IfcMemberType"]:
|
elif self.active_class in ("IfcBeam", "IfcBeamStandardCase", "IfcMember", "IfcMemberStandardCase"):
|
||||||
bpy.ops.bim.rotate_90(axis="Y")
|
bpy.ops.bim.rotate_90(axis="Y")
|
||||||
|
|
||||||
def hotkey_S_S(self):
|
def hotkey_S_S(self):
|
||||||
if self.has_ifc_class and self.props.ifc_class == "IfcWallType":
|
if self.active_class in ("IfcWall", "IfcWallStandardCase"):
|
||||||
bpy.ops.bim.split_wall()
|
bpy.ops.bim.split_wall()
|
||||||
|
|
||||||
def hotkey_S_T(self):
|
def hotkey_S_T(self):
|
||||||
if not self.has_ifc_class:
|
if self.active_class in ("IfcWall", "IfcWallStandardCase"):
|
||||||
return
|
|
||||||
if self.props.ifc_class == "IfcWallType":
|
|
||||||
bpy.ops.bim.join_wall(join_type="L")
|
bpy.ops.bim.join_wall(join_type="L")
|
||||||
elif self.props.ifc_class in ["IfcColumnType", "IfcBeamType", "IfcMemberType"]:
|
elif self.active_class in (
|
||||||
|
"IfcColumn",
|
||||||
|
"IfcColumnStandardCase",
|
||||||
|
"IfcBeam",
|
||||||
|
"IfcBeamStandardCase",
|
||||||
|
"IfcMember",
|
||||||
|
"IfcMemberStandardCase",
|
||||||
|
):
|
||||||
bpy.ops.bim.extend_profile(join_type="L")
|
bpy.ops.bim.extend_profile(join_type="L")
|
||||||
|
|
||||||
def hotkey_S_V(self):
|
def hotkey_S_V(self):
|
||||||
if self.has_ifc_class and self.props.ifc_class == "IfcWallType":
|
if self.active_class in ("IfcWall", "IfcWallStandardCase"):
|
||||||
bpy.ops.bim.align_wall(align_type="INTERIOR")
|
bpy.ops.bim.align_wall(align_type="INTERIOR")
|
||||||
else:
|
else:
|
||||||
bpy.ops.bim.align_product(align_type="POSITIVE")
|
bpy.ops.bim.align_product(align_type="POSITIVE")
|
||||||
|
|
||||||
def hotkey_S_X(self):
|
def hotkey_S_X(self):
|
||||||
if self.has_ifc_class and self.props.ifc_class == "IfcWallType":
|
if self.active_class in ("IfcWall", "IfcWallStandardCase"):
|
||||||
if bpy.ops.bim.align_wall.poll():
|
if bpy.ops.bim.align_wall.poll():
|
||||||
bpy.ops.bim.align_wall(align_type="EXTERIOR")
|
bpy.ops.bim.align_wall(align_type="EXTERIOR")
|
||||||
else:
|
else:
|
||||||
bpy.ops.bim.align_product(align_type="NEGATIVE")
|
bpy.ops.bim.align_product(align_type="NEGATIVE")
|
||||||
|
|
||||||
def hotkey_S_Y(self):
|
def hotkey_S_Y(self):
|
||||||
if self.props.ifc_class == "IfcWallType":
|
if self.active_class in ("IfcWall", "IfcWallStandardCase"):
|
||||||
bpy.ops.bim.join_wall(join_type="V")
|
bpy.ops.bim.join_wall(join_type="V")
|
||||||
elif self.props.ifc_class in ["IfcColumnType", "IfcBeamType", "IfcMemberType"]:
|
elif self.active_class in (
|
||||||
|
"IfcColumn",
|
||||||
|
"IfcColumnStandardCase",
|
||||||
|
"IfcBeam",
|
||||||
|
"IfcBeamStandardCase",
|
||||||
|
"IfcMember",
|
||||||
|
"IfcMemberStandardCase",
|
||||||
|
):
|
||||||
bpy.ops.bim.extend_profile(join_type="V")
|
bpy.ops.bim.extend_profile(join_type="V")
|
||||||
|
|
||||||
def hotkey_S_O(self):
|
def hotkey_S_O(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user