import maya.api.OpenMaya as om import maya.cmds as cmds #Returns normal, tangent, at a given point on a curve, given the curve and a position in space. #result as a list of openmaya MVector() def getCurveNormal(mayaCurve, pos=[0,0,0]): selectionList = om.MSelectionList() selectionList.add(mayaCurve) dPath= selectionList.getDagPath(0) mCurve=om.MFnNurbsCurve (dPath) res=mCurve.closestPoint(om.MPoint(om.MVector(pos)),space=om.MSpace.kWorld) point=om.MVector(res[0]) param=res[1] n=mCurve.normal(param,space=om.MSpace.kWorld) t=mCurve.tangent(param,space=om.MSpace.kWorld) li=[n,t,point] return li