Hey Everyone, I am converting some scripts from MEL to Python. The script working on right now creates a curve based off the selected Objects
I am having trouble converting the last the last bit of code(put notes in the scripts).
Anyone know the proper way to write it in python?
Here is the working MEL script
global proc CurveFromObjs () {
string $jnt[] = `ls -sl`;
vector $storePositions[];
int $x = 0;
for ($i in $jnt)
{
$storePositions[$x] = `xform -query -worldSpace -translation $i`;
$x++;
}
int $degree = 3; //<-- incase u want to change the degree type
//area that needs to be converted to python correctly
string $buildCurve = ("curve -d " + $degree);
for ($each in $storePositions)
{
$buildCurve += (" -p " + $each);
}
eval $buildCurve;
}
Here is the Python Code I have so far
import maya.cmds as cmds
selObj = cmds.ls(selection = True)
selObjSize = len(selObj)
storePositions= []
crvDegree = 3
##get positions
for i in selObj:
sp = cmds.xform (i ,query= True, worldSpace=True,translation=True )
print storePositions
#area I am having trouble with
for each in storePositions:
buildCurve = cmds.curve(d = crvDegree,p=[( each, each, each )])