Skip to content

Commit

Permalink
[Arch] suggested feature: add the ability to choose whether an Arch B…
Browse files Browse the repository at this point in the history
…uildingPart transmits its height value to children
  • Loading branch information
hvfrancesco authored and yorikvanhavre committed Oct 14, 2019
1 parent 1b044e9 commit 61435b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/Mod/Arch/ArchBuildingPart.py
Expand Up @@ -334,6 +334,9 @@ def setProperties(self,obj):
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:
Expand Down Expand Up @@ -376,7 +379,7 @@ def onChanged(self,obj,prop):
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":
Expand Down Expand Up @@ -466,7 +469,7 @@ def touchChildren(self,obj):
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)


Expand Down
5 changes: 3 additions & 2 deletions src/Mod/Arch/ArchComponent.py
Expand Up @@ -276,8 +276,9 @@ def getParentHeight(self,obj):
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"):
Expand Down

0 comments on commit 61435b3

Please sign in to comment.