Skip to content

Commit

Permalink
Draft: WorkingPlane, Pythonic style, added spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
vocx-fc authored and yorikvanhavre committed Aug 9, 2019
1 parent 92797bc commit 0decb41
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Mod/Draft/WorkingPlane.py
Expand Up @@ -115,8 +115,8 @@ def projectPointOld(self, p, direction=None):
direction = self.axis
t = Vector(direction)
#t.normalize()
a = round(t.getAngle(self.axis),DraftVecUtils.precision())
pp = round((math.pi)/2,DraftVecUtils.precision())
a = round(t.getAngle(self.axis), DraftVecUtils.precision())
pp = round((math.pi)/2, DraftVecUtils.precision())
if a == pp:
return p
t.multiply(self.offsetToPoint(p, direction))
Expand All @@ -126,20 +126,20 @@ def alignToPointAndAxis(self, point, axis, offset=0, upvec=None):
self.doc = FreeCAD.ActiveDocument
self.axis = axis
self.axis.normalize()
if axis.getAngle(Vector(1,0,0)) < 0.00001:
self.axis = Vector(1,0,0)
self.u = Vector(0,1,0)
self.v = Vector(0,0,1)
elif axis.getAngle(Vector(-1,0,0)) < 0.00001:
self.axis = Vector(-1,0,0)
self.u = Vector(0,-1,0)
self.v = Vector(0,0,1)
if axis.getAngle(Vector(1, 0, 0)) < 0.00001:
self.axis = Vector(1, 0, 0)
self.u = Vector(0, 1, 0)
self.v = Vector(0, 0, 1)
elif axis.getAngle(Vector(-1, 0, 0)) < 0.00001:
self.axis = Vector(-1, 0, 0)
self.u = Vector(0, -1, 0)
self.v = Vector(0, 0, 1)
elif upvec:
self.v = upvec
self.v.normalize()
self.u = self.v.cross(self.axis)
else:
self.v = axis.cross(Vector(1,0,0))
self.v = axis.cross(Vector(1, 0, 0))
self.v.normalize()
self.u = DraftVecUtils.rotate(self.v, -math.pi/2, self.axis)
offsetVector = Vector(axis); offsetVector.multiply(offset)
Expand Down Expand Up @@ -218,7 +218,7 @@ def alignToCurve(self, shape, offset):
else:
return False

def alignToEdges(self,edges):
def alignToEdges(self, edges):
# use a list of edges to find a plane position
if len(edges) > 2:
return False
Expand Down

0 comments on commit 0decb41

Please sign in to comment.