import Blender from Blender import * boneName = 'Bone.001' arm = Armature.Get('Armature') theBone = arm.bones[boneName] parentBone = theBone.parent boneTail = theBone.tail['ARMATURESPACE'] boneHead = theBone.head['ARMATURESPACE'] parentBoneHead = parentBone.head['ARMATURESPACE'] theNormal = Mathutils.TriangleNormal(boneTail, boneHead, parentBoneHead) theRoll = Mathutils.Vector(0, 0, 1)*theBone.matrix['BONESPACE'] theAngle = Mathutils.AngleBetweenVecs(theNormal, theRoll) arm.makeEditable() arm.bones[boneName].roll = theAngle arm.update() print theAngle