Pymel Angle asDegrees

I’m writing some rigging tools and I’m exclusively (so far) using pymel. I’ve run into an issue and I want to make sure I’m not just crazy or missing something. I’m trying to convert a radian values to degrees with this bit of code below.

pymel:

pm.Angle(RADIANVALUE).asDegrees()

This returns the exact same radian value I input which is wrong/incomplete.

oh also I’m in Maya 2015. Has this been resolved in newer versions?

Edit: Should have looked at the library …looks like it hasn’t been implemented … but I would still be very interested in knowing if it has been added in newer versions?

I think the reason it returns the same is because by default it pm.dt.Angle is expecting you to give it a value in degrees.

That’s where the unit flag comes in.

import pymel.core as pm
print pm.dt.Angle(RADIANVALUE, unit=1).asDegrees()

This will convert the value for you.

http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/PyMel/generated/classes/pymel.core.datatypes/pymel.core.datatypes.Angle.html?highlight=angle

Tested working in Maya 2016 Ext 1 SP 5 & Maya 2014

Thanks Cloaks!

I somehow completely missed that when looking at the docs. Thanks a lot that solved it for me!