mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Fix #6033. Add tools for generate slab from wall and vice versa in the toolbox. Still needs a nice icon.
This commit is contained in:
@@ -164,7 +164,8 @@ class RepresentationsData:
|
||||
if not obj.data:
|
||||
return []
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
active_representation_id = obj.data.BIMMeshProperties.ifc_definition_id
|
||||
if not (active_representation_id := obj.data.BIMMeshProperties.ifc_definition_id):
|
||||
return [] # Maybe in profile editing mode
|
||||
base_representation = tool.Ifc.get().by_id(active_representation_id)
|
||||
|
||||
# shape aspects matching context of the active representation
|
||||
|
||||
@@ -66,6 +66,7 @@ class AuthoringData:
|
||||
cls.data["relating_type_id_current"] = cls.relating_type_id_current()
|
||||
cls.data["relating_type_name"] = cls.relating_type_name()
|
||||
cls.data["relating_type_description"] = cls.relating_type_description()
|
||||
cls.data["relating_type_material_usage"] = cls.relating_type_material_usage()
|
||||
cls.data["predefined_type"] = cls.predefined_type()
|
||||
# Make sure .type_elements_filtered() was run before next lines
|
||||
cls.data["total_types"] = cls.total_types()
|
||||
@@ -231,17 +232,13 @@ class AuthoringData:
|
||||
|
||||
@classmethod
|
||||
def active_class(cls):
|
||||
if active_object := tool.Blender.get_active_object():
|
||||
element = tool.Ifc.get_entity(active_object)
|
||||
if element:
|
||||
return element.is_a()
|
||||
if (obj := tool.Blender.get_active_object()) and (element := tool.Ifc.get_entity(obj)):
|
||||
return element.is_a()
|
||||
|
||||
@classmethod
|
||||
def active_material_usage(cls):
|
||||
if active_object := tool.Blender.get_active_object():
|
||||
element = tool.Ifc.get_entity(active_object)
|
||||
if element:
|
||||
return tool.Model.get_usage_type(element)
|
||||
if (obj := tool.Blender.get_active_object()) and (element := tool.Ifc.get_entity(obj)):
|
||||
return tool.Model.get_usage_type(element)
|
||||
|
||||
@classmethod
|
||||
def is_representation_item_active(cls) -> bool:
|
||||
@@ -315,6 +312,11 @@ class AuthoringData:
|
||||
if relating_type_id := cls.data["relating_type_id_current"]:
|
||||
return tool.Ifc.get().by_id(int(relating_type_id)).Description or "No description"
|
||||
|
||||
@classmethod
|
||||
def relating_type_material_usage(cls):
|
||||
if relating_type_id := cls.data["relating_type_id_current"]:
|
||||
return tool.Model.get_usage_type(tool.Ifc.get().by_id(int(relating_type_id)))
|
||||
|
||||
@classmethod
|
||||
def predefined_type(cls):
|
||||
relating_type_id = tool.Blender.get_enum_safe(cls.props, "relating_type_id")
|
||||
|
||||
@@ -723,11 +723,29 @@ class EditObjectUI:
|
||||
)
|
||||
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)
|
||||
if AuthoringData.data["relating_type_material_usage"] == "LAYER3":
|
||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||
add_layout_hotkey_operator(
|
||||
row,
|
||||
"Add From Closed Loop",
|
||||
"S_A",
|
||||
"Generate an element from selected closed walls",
|
||||
ui_context,
|
||||
)
|
||||
|
||||
elif AuthoringData.data["active_material_usage"] == "LAYER3":
|
||||
if "LAYER2" in AuthoringData.data["selected_material_usages"]:
|
||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||
add_layout_hotkey_operator(cls.layout, "Extend Wall To Slab", "S_E", "", ui_context)
|
||||
if AuthoringData.data["relating_type_material_usage"] == "LAYER2":
|
||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||
add_layout_hotkey_operator(
|
||||
row,
|
||||
"Add From Perimeter",
|
||||
"S_A",
|
||||
"Generate elements along the perimeter of the selected element",
|
||||
ui_context,
|
||||
)
|
||||
|
||||
elif AuthoringData.data["active_material_usage"] == "PROFILE":
|
||||
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
|
||||
|
||||
Reference in New Issue
Block a user