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.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

name (n) unicode ../../../_images/create.gif
 
The name of the node.

Derived from mel command maya.cmds.deleteAttr

Example:

import pymel.core as pm

import maya.cmds as cmds

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 )

Previous topic

pymel.core.general.delete

Next topic

pymel.core.general.deleteAttrPattern

Core

Core Modules

Other Modules

This Page