[Arch] suggested feature: add the ability to choose whether an Arch BuildingPart transmits its height value to children

This commit is contained in:
Francesco Fantoni
2019-10-12 09:05:58 +02:00
committed by Yorik van Havre
parent ac0e74b220
commit 1b212feffb
2 changed files with 8 additions and 4 deletions

View File

@@ -334,6 +334,9 @@ class BuildingPart(ArchIFC.IfcProduct):
pl = obj.PropertiesList
if not "Height" in pl:
obj.addProperty("App::PropertyLength","Height","BuildingPart",QT_TRANSLATE_NOOP("App::Property","The height of this object"))
if not "HeightPropagate" in pl:
obj.addProperty("App::PropertyBool","HeightPropagate","Children",QT_TRANSLATE_NOOP("App::Property","If true, the height value propagates to contained objects"))
obj.HeightPropagate = True
if not "LevelOffset" in pl:
obj.addProperty("App::PropertyLength","LevelOffset","BuildingPart",QT_TRANSLATE_NOOP("App::Property","The level of the (0,0,0) point of this level"))
if not "Area" in pl:
@@ -376,7 +379,7 @@ class BuildingPart(ArchIFC.IfcProduct):
self.svgcache = None
self.shapecache = None
if (prop == "Height") and obj.Height.Value:
if (prop == "Height" or prop == "HeightPropagate") and obj.Height.Value:
self.touchChildren(obj)
elif prop == "Placement":
@@ -466,7 +469,7 @@ class BuildingPart(ArchIFC.IfcProduct):
if not child.Height.Value:
print("Executing ",child.Label)
child.Proxy.execute(child)
elif Draft.getType(child) in ["Group"]:
elif Draft.getType(child) in ["Group","BuildingPart"]:
self.touchChildren(child)

View File

@@ -276,8 +276,9 @@ class Component(ArchIFC.IfcProduct):
for parent in obj.InList:
if Draft.getType(parent) in ["Floor","BuildingPart"]:
if obj in parent.Group:
if parent.Height.Value:
return parent.Height.Value
if parent.HeightPropagate:
if parent.Height.Value:
return parent.Height.Value
# not found? get one level higher
for parent in obj.InList:
if hasattr(parent,"Group"):