From 3848a2113622b32ca9827f7ae4ae6f47fb2b768b Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Sat, 27 Apr 2024 11:31:39 -0500 Subject: [PATCH] fix #4361: Have the aggregate empty turn on too, if at least one object in the aggregate, is turned on as well --- src/blenderbim/blenderbim/tool/drawing.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/blenderbim/blenderbim/tool/drawing.py b/src/blenderbim/blenderbim/tool/drawing.py index b013e62854..4a417c52b2 100644 --- a/src/blenderbim/blenderbim/tool/drawing.py +++ b/src/blenderbim/blenderbim/tool/drawing.py @@ -1657,8 +1657,21 @@ class Drawing(blenderbim.core.tool.Drawing): base_elements = set(ifc_file.by_type("IfcElement") + ifc_file.by_type("IfcSpatialElement")) elements = {e for e in (elements & base_elements) if e.is_a() != "IfcSpace"} - # exclude annotations to avoid including annotations from other drawings - elements = {i for i in elements if not i.is_a("IfcAnnotation")} + + updated_set = set() + + for i in elements: + # exclude annotations to avoid including annotations from other drawings + if not i.is_a("IfcAnnotation"): + updated_set.add(i) + #add aggregate too, if element is host by one + if i.Decomposes: + aggregate = i.Decomposes[0].RelatingObject + updated_set.add(aggregate) + + # After the iteration is complete, update elements with updated set + elements.update(updated_set) + # add annotations from the current drawing annotations = tool.Drawing.get_group_elements(tool.Drawing.get_drawing_group(drawing)) elements.update(annotations) @@ -1836,8 +1849,8 @@ class Drawing(blenderbim.core.tool.Drawing): has_context = True break - # Don't hide IfcAnnotations as some of them might exist without representations - if has_context or element.is_a("IfcAnnotation"): + # Don't hide IfcAnnotations or Aggregates as some of them might exist without representations + if has_context or element.is_a("IfcAnnotation") or element.IsDecomposedBy: element_obj_names.add(obj.name) # Note that render visibility is only set on drawing generation time for speed.