the error you're getting is telling you that root_LOC is a list of strings.
the move command wants what's  IN the list. Not the list itself. Just the
first item in the list.
what the spaceLocator command is returning is a list of strings

[u'root_LOC'] # <-- see how this is a list

root_JNT # and this isn't

[u'root_CTL', u'makeNurbCircle1'] # <- the circle keeps its construction
history as the second in the list so there are two items.


you can fix it quick by adding [0] to the end of your command like this:
root_LOC=cmds.spaceLocator (n = 'root_LOC', r = 2)[0]

and to the root_CTL command like this:
root_CTL=cmds.circle(n = 'root_CTL', r = 2)[0]

this lets you "index into" the the first item in the list that the
spaceLocator (or any) command returns.
you'll still need to DE SELECT the locator first before making the joint or
the joint will end up inside the locator.

BUT...
another way is to use pymel which is a whole lot simpler (in my opinion):

>
import pymel.core as pm
def blah():
    """ put your notes here.  inside TRIPLE quotes you can put anything!!
"""

    # CREATE A SPACE LOCATOR
    root_LOC=pm.spaceLocator(n='root_LOC')

    # MOVE IT IN SPACE TO SOME LOCATION
    root_LOC.setTranslation((0, 18.485, -2.815))
    print(root_LOC)

    # DESELECT IT OR THE JOINT WILL BE A CHILD OF THE LOCATOR
    pm.select(d=True)

    # MAKE THE JOINT
    root_JNT=pm.joint(n='root_JNT')

    # MOVE IT TO THE SAME POSITION AS THE root_LOC by getting the
root_LOC's translation
    root_JNT.setTranslation(   root_LOC.getTranslation()   )
    print(root_JNT)

    # MAKE A NURBS CURVE
    root_CTL=pm.circle(n='root_CTL')[0]

    # MOVE THAT NURBS CURVE TO THE SAME SPOT AS THE JOINT
    root_CTL.setTranslation(   root_JNT.getTranslation()   )
    print(root_CTL)

blah()

Hope this was helpful. It's worth the struggle to learn python!



On Wed, Apr 24, 2013 at 10:01 PM, DayDreamer <[email protected]>wrote:

> Edit:-
> The Move command should be
> cmds.move (0, 18.485, -2.815, root_LOC[0], relative=True)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to