I have a small python script that calls a MEL command to build a nurbs curve circle. The shape of the curve is then placed with a new transform node and together they generate an animation control. But nothing is being generated when the script is run and there is no error message.
import pymel.all as pm
import maya.cmds as cmds
import maya.mel as mel
# ---------------------------------------------------------------------------------
def makeHandle(name='NEW', shape='Circle'):
handle= pm.createNode('animHandle')
shape = melcmds = 'circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 1 -d 3 -ut 0 -tol 0.000328084 -s 8 -ch 1;'
mel.eval (melcmds)
for each in shape.getChildren(): pm.parent(each, handle, r=True, s=True)
newName = name + '_handle'
handle.rename(newName)
for each in handle.getChildren(): each.rename(name + '_handleShape')
pm.delete(shape)
pm.select(handle)
If you receive no error message, I'd bet you fogot to call the function with
makeHandle(). But this function would not work anyway. You are heavily mixing mel, cmds and pymel concepts. I'd recommend to stay with one approach only, e.g. pymel. This way you do not need any mel scripts or eval calls, just create a circle wihtpm.circle(c=(0,0,0)...)which returns transform and shape. btw. a shape node usually has no children and what type isanimHandle? Is this a custom node type? Doesn`t work here.