Modify using FreeCAD.Vector.getAngle()
This commit is contained in:
committed by
Yorik van Havre
parent
8e457a6694
commit
144ce0dbaf
@@ -729,29 +729,13 @@ def makeCircle(radius, placement=None, face=None, startangle=None, endangle=None
|
||||
rotOk = FreeCAD.Rotation(edge.Curve.XAxis, edge.Curve.YAxis, edge.Curve.Axis, "ZXY")
|
||||
placement.Rotation = rotOk
|
||||
if len(edge.Vertexes) > 1:
|
||||
#ref = placement.multVec(FreeCAD.Vector(1,0,0))
|
||||
#ref = ref.sub(edge.Curve.Center)
|
||||
v0 = edge.Curve.XAxis
|
||||
v1 = (edge.Vertexes[0].Point).sub(edge.Curve.Center)
|
||||
v2 = (edge.Vertexes[-1].Point).sub(edge.Curve.Center)
|
||||
#a1 = -math.degrees(DraftVecUtils.angle(v1,ref))
|
||||
#a2 = -math.degrees(DraftVecUtils.angle(v2,ref))
|
||||
v0 = (edge.Curve.XAxis).normalize()
|
||||
v1.normalize()
|
||||
v2.normalize()
|
||||
# Angle between edge.Curve.XAxis and the vector from center to start of arc
|
||||
p = (v0.x*v1.x)+(v0.y*v1.y)+(v0.z*v1.z)
|
||||
if (p > 1.0): # sometimes rounding gives errors
|
||||
p = 1.0
|
||||
elif (p < -1.0):
|
||||
p = -1.0
|
||||
a0 = math.degrees(math.acos(p))
|
||||
a0 = math.degrees(FreeCAD.Vector.getAngle(v0, v1))
|
||||
# Angle between edge.Curve.XAxis and the vector from center to end of arc
|
||||
p = (v0.x*v2.x)+(v0.y*v2.y)+(v0.z*v2.z)
|
||||
if (p > 1.0): # sometimes rounding gives errors
|
||||
p = 1.0
|
||||
elif (p < -1.0):
|
||||
p = -1.0
|
||||
a1 = math.degrees(math.acos(p))
|
||||
a1 = math.degrees(FreeCAD.Vector.getAngle(v0, v2))
|
||||
obj.FirstAngle = a0
|
||||
obj.LastAngle = a1
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user