Toggle openings for part's aggregate as well.

This commit is contained in:
Ryan Schultz
2024-12-29 17:05:21 -06:00
parent 78afcf9c7a
commit b506b72d9f
2 changed files with 14 additions and 7 deletions
+11 -1
View File
@@ -824,7 +824,17 @@ class ShowOpenings(Operator, tool.Ifc.Operator):
def _execute(self, context):
props = bpy.context.scene.BIMModelProperties
for obj in context.selected_objects:
objs = context.selected_objects
#add the obj's aggregate, as well, to objs
for obj in objs:
element = tool.Ifc.get_entity(obj)
if element and getattr(element, "Decomposes", None):
if element.Decomposes and (aggregate := element.Decomposes[0].RelatingObject):
aggregate_obj = tool.Ifc.get_object(aggregate)
objs.append(aggregate_obj)
for obj in objs:
element = tool.Ifc.get_entity(obj)
if not element or not getattr(element, "HasOpenings", None):
continue
@@ -1258,14 +1258,11 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bpy.ops.bim.enable_editing_extrusion_axis()
def hotkey_A_O(self):
if (
AuthoringData.data["has_visible_openings"]
or not bpy.context.selected_objects
or AuthoringData.data["active_class"] == "IfcOpeningElement"
):
opening_collection = bpy.data.collections.get("IfcOpeningElement")
if opening_collection and opening_collection.objects:
bpy.ops.bim.edit_openings()
else:
bpy.ops.bim.show_openings()
bpy.ops.bim.show_openings()
custom_icon_previews = None