pymel.core.general.renameAttr

renameAttr(*args, **kwargs)

Renames the given user-defined attribute to the name given in the string argument. If the new name conflicts with an existing name then this command will fail. Note that it is not legal to rename an attribute to the empty string.

Derived from mel command maya.cmds.renameAttr

Example:

import pymel.core as pm

pm.sphere( n='sph' )
# Result: [nt.Transform(u'sph'), nt.MakeNurbSphere(u'makeNurbSphere1')] #
pm.addAttr( sn='ms', ln='mass', dv=1.0, min=0.001, max=10000 )
# Rename the long and short names separately
pm.renameAttr( 'sph.mass', 'length' )
# Result: u'length' #
pm.renameAttr( 'sph.ms', 'ln' )
# Result: u'ln' #