From b024ba05da3a5d22fe6449d9121bbd5d14e6fbea Mon Sep 17 00:00:00 2001 From: falken10vdl <33285113+falken10vdl@users.noreply.github.com> Date: Fri, 15 Aug 2025 15:36:15 +0200 Subject: [PATCH] Fix UI bug with active representation indication for occurrences (#7009) --- src/bonsai/bonsai/bim/module/geometry/data.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/geometry/data.py b/src/bonsai/bonsai/bim/module/geometry/data.py index 27670ee1d7..724b36eb64 100644 --- a/src/bonsai/bonsai/bim/module/geometry/data.py +++ b/src/bonsai/bonsai/bim/module/geometry/data.py @@ -117,16 +117,23 @@ class RepresentationsData: for representation in tool.Geometry.get_representations_iter(element): representation_type = representation.RepresentationType - if representation_type == "MappedRepresentation": - representation_type = representation.Items[0].MappingSource.MappedRepresentation.RepresentationType - representation_type += "*" + resolved_representation = ifcopenshell.util.representation.resolve_representation(representation) + + if resolved_representation != representation: + representation_type = resolved_representation.RepresentationType + "*" + + is_active = ( + representation.id() == active_representation_id + or resolved_representation.id() == active_representation_id + ) + data = { "id": representation.id(), "ContextType": representation.ContextOfItems.ContextType or "", "ContextIdentifier": "", "TargetView": "", "RepresentationType": representation_type or "", - "is_active": representation.id() == active_representation_id, + "is_active": is_active, } if representation.ContextOfItems.is_a("IfcGeometricRepresentationSubContext"): data["ContextIdentifier"] = representation.ContextOfItems.ContextIdentifier or ""