From 8657d0a377c07580181b09364a4f5e149f79e551 Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Tue, 3 Feb 2026 20:23:59 +0100 Subject: [PATCH] BIM: fix BuildingPart area calculation for indirect children (#24848) * BIM: fix BuildingPart area calculation for indirect children Fixes #24667. --- src/Mod/BIM/ArchBuildingPart.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Mod/BIM/ArchBuildingPart.py b/src/Mod/BIM/ArchBuildingPart.py index 971a3e5320..0a8522a067 100644 --- a/src/Mod/BIM/ArchBuildingPart.py +++ b/src/Mod/BIM/ArchBuildingPart.py @@ -410,14 +410,21 @@ class BuildingPart(ArchIFC.IfcProduct): def getArea(self, obj): "computes the area of this floor by adding its inner spaces" - area = 0 - if hasattr(obj, "Group"): - for child in obj.Group: - if (Draft.get_type(child) in ["Space", "BuildingPart"]) and hasattr( - child, "IfcType" - ): - area += child.Area.Value - return area + def _getArea(obj): + area = 0 + if hasattr(obj, "Group"): + for child in obj.Group: + if ( + Draft.get_type(child) in ["Space", "BuildingPart"] + and hasattr(child, "IfcType") + and hasattr(child, "Area") + ): + area += child.Area.Value + else: + area += _getArea(child) + return area + + return _getArea(obj) def getShapes(self, obj): "recursively get the shapes of objects inside this BuildingPart"