Fixing confusing UI #3357

It was showing "Edit Profile" when you have slab and wall selected when it will actually extend the wall to the slab.
This commit is contained in:
Andrej730
2023-07-14 09:47:15 +05:00
parent 69fa12423d
commit 2fa7cbaabf
2 changed files with 23 additions and 1 deletions
@@ -67,6 +67,7 @@ class AuthoringData:
cls.data["active_material_usage"] = cls.active_material_usage()
cls.data["active_representation_type"] = cls.active_representation_type()
cls.data["boundary_class"] = cls.boundary_class()
cls.data["selected_material_usages"] = cls.selected_material_usages()
@classmethod
def boundary_class(cls):
@@ -238,6 +239,23 @@ class AuthoringData:
return [(str(e.id()), e.Name or "Unnamed", e.Description or "") for e in results]
return []
@classmethod
def selected_material_usages(cls):
selected_usages = {}
for obj in bpy.context.selected_objects:
element = tool.Ifc.get_entity(obj)
if not element:
continue
usage = tool.Model.get_usage_type(element)
if not usage:
representation = tool.Geometry.get_active_representation(obj)
if representation and representation.RepresentationType == "SweptSolid":
usage = "SWEPTSOLID"
else:
continue
selected_usages.setdefault(usage, []).append(obj)
return selected_usages
class ArrayData:
data = {}
@@ -176,7 +176,11 @@ class BimToolUI:
row.operator("bim.join_wall", icon="X", text="").join_type = ""
elif AuthoringData.data["active_material_usage"] == "LAYER3":
add_layout_hotkey_operator(cls.layout, "Edit Profile", "S_E", "")
if len(context.selected_objects) == 1:
add_layout_hotkey_operator(cls.layout, "Edit Profile", "S_E", "")
elif "LAYER2" in AuthoringData.data["selected_material_usages"]:
add_layout_hotkey_operator(cls.layout, "Extend Wall To Slab", "S_E", "")
row = cls.layout.row(align=True)
row.prop(data=cls.props, property="x_angle", text="X Angle")