mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +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:
|
if not obj.data:
|
||||||
return []
|
return []
|
||||||
element = tool.Ifc.get_entity(obj)
|
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)
|
base_representation = tool.Ifc.get().by_id(active_representation_id)
|
||||||
|
|
||||||
# shape aspects matching context of the active representation
|
# 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_id_current"] = cls.relating_type_id_current()
|
||||||
cls.data["relating_type_name"] = cls.relating_type_name()
|
cls.data["relating_type_name"] = cls.relating_type_name()
|
||||||
cls.data["relating_type_description"] = cls.relating_type_description()
|
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()
|
cls.data["predefined_type"] = cls.predefined_type()
|
||||||
# Make sure .type_elements_filtered() was run before next lines
|
# Make sure .type_elements_filtered() was run before next lines
|
||||||
cls.data["total_types"] = cls.total_types()
|
cls.data["total_types"] = cls.total_types()
|
||||||
@@ -231,17 +232,13 @@ class AuthoringData:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def active_class(cls):
|
def active_class(cls):
|
||||||
if active_object := tool.Blender.get_active_object():
|
if (obj := tool.Blender.get_active_object()) and (element := tool.Ifc.get_entity(obj)):
|
||||||
element = tool.Ifc.get_entity(active_object)
|
return element.is_a()
|
||||||
if element:
|
|
||||||
return element.is_a()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def active_material_usage(cls):
|
def active_material_usage(cls):
|
||||||
if active_object := tool.Blender.get_active_object():
|
if (obj := tool.Blender.get_active_object()) and (element := tool.Ifc.get_entity(obj)):
|
||||||
element = tool.Ifc.get_entity(active_object)
|
return tool.Model.get_usage_type(element)
|
||||||
if element:
|
|
||||||
return tool.Model.get_usage_type(element)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_representation_item_active(cls) -> bool:
|
def is_representation_item_active(cls) -> bool:
|
||||||
@@ -315,6 +312,11 @@ class AuthoringData:
|
|||||||
if relating_type_id := cls.data["relating_type_id_current"]:
|
if relating_type_id := cls.data["relating_type_id_current"]:
|
||||||
return tool.Ifc.get().by_id(int(relating_type_id)).Description or "No description"
|
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
|
@classmethod
|
||||||
def predefined_type(cls):
|
def predefined_type(cls):
|
||||||
relating_type_id = tool.Blender.get_enum_safe(cls.props, "relating_type_id")
|
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
|
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)
|
||||||
|
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":
|
elif AuthoringData.data["active_material_usage"] == "LAYER3":
|
||||||
if "LAYER2" in AuthoringData.data["selected_material_usages"]:
|
if "LAYER2" in AuthoringData.data["selected_material_usages"]:
|
||||||
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(cls.layout, "Extend Wall To Slab", "S_E", "", ui_context)
|
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":
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user