[ArchWindow] getSubVolume() Bug - When HoleDepth is set but the Window is a Clone, no opening is created

getSubVolume() -

- When Windown is a Clone, no base is set
- When HoleDepth is set, no further check if there is a Clone to set its base to Clone's base
- The original code return None when no base is set
This commit is contained in:
paullee0
2020-01-19 03:54:53 +08:00
committed by Yorik van Havre
parent a322effcef
commit 98dfa25def

View File

@@ -1309,7 +1309,7 @@ class _Window(ArchComponent.Component):
if obj.Base:
base = obj.Base
width = 0
if hasattr(obj,"HoleDepth"):
if hasattr(obj,"HoleDepth"): # the code have not checked whether this is a clone and use the original's HoleDepth; if HoleDepth is set in this object, even it is a clone, the original's HoleDepth is overridden
if obj.HoleDepth.Value:
width = obj.HoleDepth.Value
if not width:
@@ -1317,13 +1317,14 @@ class _Window(ArchComponent.Component):
b = base.Shape.BoundBox
width = max(b.XLength,b.YLength,b.ZLength)
if not width:
if Draft.isClone(obj,"Window"):
if Draft.isClone(obj,"Window"): # check whether this is a clone and use the original's HoleDepth or Shape's Boundbox
if hasattr(obj,"CloneOf"):
orig = obj.CloneOf
else:
orig = obj.Objects[0]
if orig.Base:
base = orig.Base
if hasattr(orig,"HoleDepth"):
if orig.HoleDepth.Value:
width = orig.HoleDepth.Value
@@ -1333,8 +1334,17 @@ class _Window(ArchComponent.Component):
width = max(b.XLength,b.YLength,b.ZLength)
if not width:
width = 1.1112 # some weird value to have little chance to overlap with an existing face
if not base:
return None
if Draft.isClone(obj,"Window"): # if this object has not base, check whether this is a clone and use the original's base
if hasattr(obj,"CloneOf"):
orig = obj.CloneOf
else:
orig = obj.Objects[0] # not sure what is this exactly
if orig.Base:
base = orig.Base
else:
return None
# finding which wire to use to drill the hole