Arch: Fixed display bug in BuildingPart

This commit is contained in:
Yorik van Havre
2018-12-19 16:33:48 -02:00
parent b1e3ad9015
commit d012178482

View File

@@ -508,7 +508,7 @@ class ViewProviderBuildingPart:
self.Object = vobj.Object
from pivy import coin
self.sep = coin.SoSeparator()
self.sep = coin.SoGroup()
self.mat = coin.SoMaterial()
self.sep.addChild(self.mat)
self.dst = coin.SoDrawStyle()
@@ -527,7 +527,7 @@ class ViewProviderBuildingPart:
self.txt.justification = coin.SoText2.LEFT
self.txt.string.setValue("level")
self.sep.addChild(self.txt)
vobj.addDisplayMode(coin.SoSeparator(),"Default")
vobj.addDisplayMode(self.sep,"Default")
self.onChanged(vobj,"ShapeColor")
self.onChanged(vobj,"FontName")
self.onChanged(vobj,"ShowLevel")
@@ -615,17 +615,7 @@ class ViewProviderBuildingPart:
self.lco.point.setValues([[b.x-fs,b.y,b.z],[b.x+fs,b.y,b.z],[b.x,b.y-fs,b.z],[b.x,b.y+fs,b.z],[b.x,b.y,b.z-fs],[b.x,b.y,b.z+fs]])
else:
self.lco.point.setValues([[-fs,0,0],[fs,0,0],[0,-fs,0],[0,fs,0],[0,0,-fs],[0,0,fs]])
elif prop in ["ShowLevel","ShowLabel"]:
if hasattr(vobj,"ShowLevel") and hasattr(vobj,"ShowLabel"):
rn = vobj.RootNode
if vobj.ShowLevel or vobj.ShowLabel:
if rn.findChild(self.sep) == -1:
rn.addChild(self.sep)
self.onChanged(vobj,"ShowUnit")
else:
if rn.findChild(self.sep) != -1:
rn.removeChild(self.sep)
if prop in ["OverrideUnit","ShowUnit","ShowLevel","ShowLabel"]:
elif prop in ["OverrideUnit","ShowUnit","ShowLevel","ShowLabel"]:
if hasattr(vobj,"OverrideUnit") and hasattr(vobj,"ShowUnit") and hasattr(vobj,"ShowLevel") and hasattr(vobj,"ShowLabel"):
z = vobj.Object.Placement.Base.z + vobj.Object.LevelOffset.Value
q = FreeCAD.Units.Quantity(z,FreeCAD.Units.Length)