Skip to content

Commit

Permalink
Arch: small fix in sectionplane - fixes #1836
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Nov 23, 2014
1 parent 3c61d41 commit 58a84d2
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/Mod/Arch/ArchSectionPlane.py
Expand Up @@ -107,8 +107,12 @@ def __init__(self,obj):

def execute(self,obj):
import Part
l = obj.ViewObject.DisplayLength.Value
h = obj.ViewObject.DisplayHeight.Value
if hasattr(obj.ViewObject,"DisplayLength"):
l = obj.ViewObject.DisplayLength.Value
h = obj.ViewObject.DisplayHeight.Value
else:
l = 1
h = 1
p = Part.makePlane(l,l,Vector(l/2,-l/2,0),Vector(0,0,-1))
# make sure the normal direction is pointing outwards, you never know what OCC will decide...
if p.normalAt(0,0).getAngle(obj.Placement.Rotation.multVec(FreeCAD.Vector(0,0,1))) > 1:
Expand Down Expand Up @@ -206,12 +210,19 @@ def onChanged(self,vobj,prop):
if hasattr(vobj,"Transparency"):
self.mat2.transparency.setValue(vobj.Transparency/100.0)
elif prop in ["DisplayLength","DisplayHeight","ArrowSize"]:
ld = vobj.DisplayLength.Value/2
hd = vobj.DisplayHeight.Value/2
if hasattr(vobj,"DisplayLength"):
ld = vobj.DisplayLength.Value/2
hd = vobj.DisplayHeight.Value/2
else:
ld = 1
hd = 1
verts = []
fverts = []
for v in [[-ld,-hd],[ld,-hd],[ld,hd],[-ld,hd]]:
l1 = vobj.ArrowSize.Value if vobj.ArrowSize.Value > 0 else 0.1
if hasattr(vobj,"ArrowSize"):
l1 = vobj.ArrowSize.Value if vobj.ArrowSize.Value > 0 else 0.1
else:
l1 = 0.1
l2 = l1/3
pl = FreeCAD.Placement(vobj.Object.Placement)
p1 = pl.multVec(Vector(v[0],v[1],0))
Expand Down

0 comments on commit 58a84d2

Please sign in to comment.