Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Draft: Fixed bug in line UI - fixes #2860
  • Loading branch information
yorikvanhavre committed Jan 15, 2017
1 parent c6144c2 commit 17c6921
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Mod/Draft/DraftGui.py
Expand Up @@ -251,6 +251,7 @@ def __init__(self):
self.mask = None
self.alock = False
self.angle = None
self.avalue = None
self.x = 0
self.y = 0
self.z = 0
Expand Down Expand Up @@ -1791,16 +1792,24 @@ def changeSTrackValue(self,d):

def changeLengthValue(self,d):
v = FreeCAD.Vector(self.x,self.y,self.z)
if not v.Length:
if self.angle:
v = FreeCAD.Vector(self.angle)
else:
v = FreeCAD.Vector(FreeCAD.DraftWorkingPlane.u)
if self.avalue:
v = DraftVecUtils.rotate(v,math.radians(d),FreeCAD.DraftWorkingPlane.axis)
v = DraftVecUtils.scaleTo(v,d)
self.xValue.setText(displayExternal(v.x,None,'Length'))
self.yValue.setText(displayExternal(v.y,None,'Length'))
self.zValue.setText(displayExternal(v.z,None,'Length'))

def changeAngleValue(self,d):
self.avalue = d
v = FreeCAD.Vector(self.x,self.y,self.z)
a = DraftVecUtils.angle(v,FreeCAD.DraftWorkingPlane.u,FreeCAD.DraftWorkingPlane.axis)
a = math.radians(d)+a
v=DraftVecUtils.rotate(v,a,FreeCAD.DraftWorkingPlane.axis)
v = DraftVecUtils.rotate(v,a,FreeCAD.DraftWorkingPlane.axis)
self.angle = v
self.xValue.setText(displayExternal(v.x,None,'Length'))
self.yValue.setText(displayExternal(v.y,None,'Length'))
Expand Down

0 comments on commit 17c6921

Please sign in to comment.