rename in PyMel

29 views
Skip to first unread message

bartlomi...@northumbria.ac.uk

unread,
Oct 28, 2016, 8:46:51 PM10/28/16
to Python Programming for Autodesk Maya
Hi

I have a question. I want to create in pymel a 'while True' loop
how can I add variable to my rename object?

example

i = 1
while True:
pm.rename('group' i '|old_name, 'new_name')



so for example i = 1 so my 'group' should be 'group1'. I am not sure how can I make it. How to add variable input into the name of the object?

Justin Israel

unread,
Oct 28, 2016, 9:24:29 PM10/28/16
to python_in...@googlegroups.com
You can use string formatting, to create a string with variable values:

    pm.rename('group{0}'.format(i), '|old_name, 'new_name')

Out of curiousity, what breaks you out of your 'while True' loop? Or was this only a partial example of what you intend to do?



--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/debb1b4e-9e16-46d5-8f8b-f5c6a5003b38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages