Skip to content

Commit

Permalink
Draft: small bugfix in wires
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Feb 1, 2016
1 parent c255952 commit 704d3ca
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Mod/Draft/Draft.py
Expand Up @@ -4413,14 +4413,15 @@ def updateData(self, obj, prop):
self.coords.translation.setValue((p.x,p.y,p.z))
if len(obj.Points) >= 2:
v1 = obj.Points[-2].sub(obj.Points[-1])
v1.normalize()
import DraftGeomUtils
v2 = DraftGeomUtils.getNormal(obj.Shape)
if DraftVecUtils.isNull(v2):
v2 = Vector(0,0,1)
v3 = v1.cross(v2).negative()
q = FreeCAD.Placement(DraftVecUtils.getPlaneRotation(v1,v3,v2)).Rotation.Q
self.coords.rotation.setValue((q[0],q[1],q[2],q[3]))
if not DraftVecUtils.isNull(v1):
v1.normalize()
import DraftGeomUtils
v2 = DraftGeomUtils.getNormal(obj.Shape)
if DraftVecUtils.isNull(v2):
v2 = Vector(0,0,1)
v3 = v1.cross(v2).negative()
q = FreeCAD.Placement(DraftVecUtils.getPlaneRotation(v1,v3,v2)).Rotation.Q
self.coords.rotation.setValue((q[0],q[1],q[2],q[3]))
return

def onChanged(self, vobj, prop):
Expand Down

0 comments on commit 704d3ca

Please sign in to comment.