Hi;
for i in range (len(mySel)):
cmds.rename(mySel[i],newName + "_%d" % i)
I think you didn't define the object you need to rename, mySel[i] is you need
rename object!
Sent from my iPhone
> On 2014年1月6日, at 6:45, [email protected] wrote:
>
> Hey All,
>
> I am just getting started out trying to understand Python (and programming in
> general). I'm trying to make a simple script that renames all my selected
> objects. Obviously this should be super simple, but when I run what I have
> so far, it only renames one object regardless of what is selected.
>
> import maya.cmds as cmds
>
> def renameFun ():
>
> mySel = cmds.ls (selection = True)
> newName = "Test_Name"
>
> for i in range (len(mySel)):
> cmds.rename(newName + "_%d" % i)
>
> I am calling the function when I run it in Maya. Any help would be very
> appreciated!
>
> Aren
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/3de1aeeb-93d6-4d26-a15d-d94e0d43eb0a%40googlegroups.com.
> 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 view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/79697A2A-64FE-4277-9278-36A483BBA46D%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.