pymel.core.general.deleteAttr

deleteAttr(*args, **kwargs)

This command is used to delete a dynamic attribute from a node or nodes. The attribute can be specified by using either the long or short name. Only one dynamic attribute can be deleted at a time. Static attributes cannot be deleted. Children of a compound attribute cannot be deleted. You must delete the complete compound attribute. This command has no edit capabilities. The only query ability is to list all the dynamic attributes of a node. In query mode, return type is based on queried flag.

Flags:

Long Name / Short Name Argument Types Properties
attribute / at unicode ../../../_images/create.gif
  Specify either the long or short name of the attribute.
name / n unicode ../../../_images/create.gif
  The name of the node. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.deleteAttr

Example:

import pymel.core as pm

pm.createNode( 'planet', n='mars' )
# Result: nt.Unknown(u'mars') #
pm.addAttr( ln='martians', sn='mr', at='double' )
pm.addAttr( ln='greenMen', sn='gm', at='double' )

# Delete an attribute named mr/martians.
pm.deleteAttr( 'mars', at='mr' )

# Alternative syntax
pm.deleteAttr( 'mars.greenMen' )

# Query for the list of dynamic attributes.
pm.deleteAttr( 'mars', q=True )