Hey Segmoria, I know you posted this years ago but I wanted to say a huge thanks. Im learning rigging and python and needed a way of creating a specified number of joints in a chain that would work with squash and strecth etc. I had a more complicated way that worked but not with the scaling for squash... i looked for ages all over the net for alternatives, then saw yours and it works so well, its less code and clean. I reproduced this in Python here:
import maya.cmds as mc
side = "center"
limb = "spine"
startPos = mc.xform('startPositioner', q=1, ws=0, t=1)
endPos = mc.xform('endPositioner', q=1, ws=0, t=1)#define the end position
numJoints = 4
print startPos
#Creating a curve between them
mc.curve (d=1, n= 'curve_body', p=[(startPos[0],startPos[1],startPos[2]),(endPos[0],endPos[1],endPos[2])])
mc.rebuildCurve(ch=1, rpo=1, rt=0, end=1, kr=1, kcp=0, kep=1, kt=0, s=numJoints, d=1, tol=0.01, n='curve_body')
#Evenly spacing joints according to the curve
cvPos = 0
k=0
while k <= (numJoints):
cvPos = mc.pointPosition( 'curve_body.cv[' + str(k) + ']', w=1)
getJoints = mc.joint(n=('center_spine_0' + str(k+1)+'_jnt'), p=cvPos)
k=k+1
print cvPos
#Set the rotation order
r=0
while r < (numJoints):
mc.joint(('center_spine_0' + str(r+1)+'_jnt'), e=True, oj='xyz' , sao='yup' )
r=r+1
mc.select(cl=1)
mc.delete ('curve_body')
HUGE thanks again !!!!