From 401d9ae4e397110b18fdfb041c2f473242af01fc Mon Sep 17 00:00:00 2001 From: paul <40677073+paullee0@users.noreply.github.com> Date: Mon, 14 Jul 2025 23:23:14 +0800 Subject: [PATCH] [ArchWindow] subVolume Support Multi-Material (bug fix) (#22279) * [ArchWindow] subVolume Support Multi-Material (bug fix) Fix #21640 BIM: Automatic hole depth for windows issue (new window depth algorithm cannot determine the width of the wall when using multimaterial) * [ArchWindow] subVolume Support Multi-Material (bug fix) / Further fix (Fix problem found by Github CodeQL - Local variable 'totalThk' may be used before it is initialized) Fix #21640 BIM: Automatic hole depth for windows issue (new window depth algorithm cannot determine the width of the wall when using multimaterial) --- src/Mod/BIM/ArchWindow.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Mod/BIM/ArchWindow.py b/src/Mod/BIM/ArchWindow.py index 84ba0d9fd4..361811cb14 100644 --- a/src/Mod/BIM/ArchWindow.py +++ b/src/Mod/BIM/ArchWindow.py @@ -639,6 +639,19 @@ class _Window(ArchComponent.Component): widths = host.OverrideWidth elif host.Width: widths = [host.Width.Value] + + # TODO Below codes copied and adopted from ArchWall.py. + # Consider adding a variable to store the layer's + # thickness as deduced, so the figure there could be + # used directly without re-calculated here below. + if hasattr(host,"Material"): + if host.Material: + if hasattr(host.Material,"Materials"): + thicknesses = [abs(t) for t in host.Material.Thicknesses] + totalThk = sum(thicknesses) + # Append totalThk to widths, find max below + widths.append(totalThk) + if widths: width = max(widths) # +100mm to ensure subtract is through at the moment