[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)
This commit is contained in:
paul
2025-07-14 23:23:14 +08:00
committed by GitHub
parent 0f4d25f8c6
commit 401d9ae4e3

View File

@@ -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