I tried to use your case and did an update, and it failed badly...
Even so, my method was wrong to begin with, i think. It already fails if I
am trying to do the counter in the middle of the naming
def uniqueNamePattern(base=""):
i = 1
customRepl = base.format('x') != base
if customRepl:
name = base.format(i)
else:
name = base
while cmds.objExists(name):
i += 1
base = base + "{0:0>3}".format(1)
if customRepl:
name = base
print "name1 : ", name
else:
name = "{0}{1}".format(base, i)
print "name2 : ", name
return name
cmds.group(name=uniqueNamePattern("test_"))
--
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/9f1441a6-53ca-43b9-9e7d-c8fc3c27b6e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.