Code: Select all
from math import degrees
doc = App.ActiveDocument
arc = doc.addObject("Part::Circle","Arc")
arc.Radius=10.0000
arc.Angle1 =25.0000
arc.Angle2=55.0000
doc.recompute()
Code: Select all
edge = arc.Shape.Edge1
curve = edge.Curve.trim(*arc.Shape.ParameterRange)
nurbs = curve.toNurbs() # or nurbs = curve.toNurbs(*arc.Shape.ParameterRange)
print(' Arc Nurbs')
print(f'Start Points {curve.StartPoint} {nurbs.StartPoint}')
print(f'End Points {curve.EndPoint} {nurbs.EndPoint}')
arcangle = degrees(curve.StartPoint.getAngle(curve.EndPoint))
nurbsangle = degrees(nurbs.StartPoint.getAngle(nurbs.EndPoint))
print(f'Subtend {arcangle} {nurbsangle}')
Code: Select all
>>> print(' Arc Nurbs')
Arc Nurbs
>>> print(f'Start Points {curve.StartPoint} {nurbs.StartPoint}')
Start Points Vector (9.063077870366499, 4.2261826174069945, 0.0) Vector (9.063077870366499, 4.2261826174069945, 0.0)
>>> print(f'End Points {curve.EndPoint} {nurbs.EndPoint}')
End Points Vector (5.735764363510461, 8.191520442889917, 0.0) Vector (6.740463181335613, 7.386890827747417, 0.0)
>>> arcangle = degrees(curve.StartPoint.getAngle(curve.EndPoint))
>>> nurbsangle = degrees(nurbs.StartPoint.getAngle(nurbs.EndPoint))
>>> print(f'Subtend {arcangle} {nurbsangle}')
Subtend 30.000000000000004 22.619864948040433
>>>
EDIT:
FWIW I also tried this with a spiral arc - no problem.
It also works for ellipses, elliptic arcs and parabolic arcs. So far only circular arcs are a problem.