pymel.core.general.delete

delete(*args, **kwargs)

This command is used to delete selected objects, or all objects, or objects specified along with the command. Flags are available to filter the type of objects that the command acts on. At times, more than just specified items will be deleted. For example, deleting two CVs in the same “row” on a NURBS surface will delete the whole row.

Modifications:
  • the command will not fail on an empty list
Flags:
Long name (short name) Argument Types Properties
all (all) bool ../../../_images/create.gif
 
Remove all objects of specified kind, in the scene. This flag is to be used in conjunction with the following flags.
attribute (at) unicode ../../../_images/create.gif
 
List of attributes to select
channels (c) bool ../../../_images/create.gif
 
Remove animation channels in the scene. Either all channels can be removed, or the scope can be narrowed down by specifying some of the above mentioned options.
constraints (cn) bool ../../../_images/create.gif
 

Remove selected constraints and constraints attached to the selected nodes, or remove all constraints in the scene.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

constructionHistory (ch) bool ../../../_images/create.gif
 
Remove the construction history on the objects specified or selected.
controlPoints (cp) bool ../../../_images/create.gif
 

This flag explicitly specifies whether or not to include the control points of a shape (see “-s” flag) in the list of attributes. Default: false. (Not valid for “pasteKey” cmd.)

expressions (e) bool ../../../_images/create.gif
 
Remove expressions in the scene. Either all expressions can be removed, or the scope can be narrowed down by specifying some of the above mentioned options.
hierarchy (hi) unicode ../../../_images/create.gif
 
Hierarchy expansion options. Valid values are “above,” “below,” “both,” and “none.” (Not valid for “pasteKey” cmd.)
| .. |
icn)** | bool | .. image:: /images/create.gif |
 

Break input connection to specified attribute and delete all unconnected nodes that are left behind. The graph will be traversed until a node that cannot be deleted is encountered.

motionPaths (mp) bool  
   
shape (s) bool ../../../_images/create.gif
 
Consider attributes of shapes below transforms as well, except “controlPoints”. Default: true. (Not valid for “pasteKey” cmd.)
staticChannels (sc) bool ../../../_images/create.gif
 

Remove static animation channels in the scene. Either all static channels can be removed, or the scope can be narrowed down by specifying some of the above mentioned options.

timeAnimationCurves (tac) bool ../../../_images/create.gif
 

Modifies the -c/channels and -sc/staticChannels flags. When true, only channels connected to time-input animation curves (for instance, those created by ‘setKeyframe’ will be deleted. When false, no time-input animation curves will be deleted. Default: true.

| .. |
uac)** | bool | .. image:: /images/create.gif |
 

Modifies the -c/channels and -sc/staticChannels flags. When true, only channels connected to unitless-input animation curves (for instance, those created by ‘setDrivenKeyframe’ will be deleted. When false, no unitless-input animation curves will be deleted. Default: true.

Derived from mel command maya.cmds.delete

Example:

import pymel.core as pm

import maya.cmds as cmds

# To delete selected objects use:
pm.delete()

# To delete a few specific objects like surfaceShape1, surface1 and
# paramCurve1 use:
pm.delete( 'surfaceShape1', 'surface1', 'paramCurve1' )

# To delete all channels in the scene:
pm.delete( all=True, c=True )

# To delete static channels connected to selected nodes:
pm.delete( sc=True )

# To delete motion path nodes connected to selected nodes:
pm.delete( mp=True )

# To delete all expressions in the scene:
pm.delete( all=True, e=True )

# To delete selected constraints and constraints attached to selected nodes:
pm.delete( cn=True )

# Notes:

# The at, h, s and cp flags only apply when either c/channels
# or sc/staticChannels or e/expressions options are specified.

Previous topic

pymel.core.general.cycleCheck

Next topic

pymel.core.general.deleteAttr

Core

Core Modules

Other Modules

This Page