pymel.core.general

Contains general node and attribute functions, as well as the main PyNode base class.

For the rest of the class hierarchy, including DependNode, Transform, and Attribute, see pymel.core.nodetypes.

Functions

about This command displays version information about the application if it is executed without flags.
addAttr This command is used to add a dynamic attribute to a node or nodes.
affectedNet This command gets the list of attributes on a node or node type and creates nodes of type TdnAffect, one for each attribute, that are connected iff the source node’s attribute affects the destination node’s attribute. In query mode, return type is based on queried flag.
affects This command gets the list of attributes on a node or node type that are affected by the named attribute.
aliasAttr Allows aliases (alternate names) to be defined for any attribute of a specified node.
align Align or spread objects along X Y and Z axis.
artAttrTool The artAttrTool command manages the list of tool types which are used for attribute painting. This command supports querying the list contents as well as adding new tools to the list. Note that there is a set of built-in tools. The list of built-ins can be queried by starting Maya and doing an artAttrTool -q. The tools which are managed by this command are all intended for attribute painting via Artisan: when you create a new context via artAttrCtx you specify the tool name via artAttrCtx’s -whichToolflag. Typically the user may wish to simply use one of the built-in tools. However, if you need to have custom Properties and Values sheets asscociated with your tool, you will need to define a custom tool via artAttrTool -add toolName. For an example of a custom attribute painting tool, see the devkit example customtoolPaint.mel. In query mode, return type is based on queried flag.
attributeInfo This command lists all of the attributes that are marked with certain flags.
attributeName This command takes one node.attribute-style specifier on the command line and returns either the attribute’s long, short, or nice name.
attributeQuery attributeQuery returns information about the configuration of an attribute. It handles both boolean flags, returning true or false, as well as other return values. Specifying more than one boolean flag will return the logical andof all the specified boolean flags. You may not specify any two flags when both do not provide a boolean return type. (eg. -internal -hiddenis okay but -range -hiddenor -range -softRangeis not.)
bakePartialHistory This command is used to bake sections of the construction history of a shape node when possible.
color This command sets the dormant wireframe color of the specified objects to be their class color or if the -ud/userDefined flag is specified, one of the user defined colors.
colorIndex The index specifies a color index in the color palette.
commandPort Opens or closes the Maya command port. The command port comprises a socket to which a client program may connect. An example command port client mcpis included in the Motion Capture developers kit. Care should be taken regarding INET domain sockets as no user identification, or authorization is required to connect to a given socket, and all commands (including system(...)) are allowed and executed with the user id and permissions of the Maya user. The prefix flag can be used to reduce this security risk, as only the prefix command is executed. The query flag can be used to determine if a given command port exists. See examples below.
connectAttr Connect the attributes of two dependency nodes and return the names of the two connected attributes.
connectionInfo The connectionInfocommand is used to get information about connection sources and destinations. Unlike the isConnected command, this command needs only one end of the connection.
container This command can be used to create and query container nodes.
containerProxy Creates a new container with the same published interface, dynamic attributes and attribute values as the specified container but with fewer container members.
containerTemplate A container template is a description of a container’s published interface.
containerView A container view defines the layout information for the published attributes of a particular container.
contextInfo This command allows you to get information on named contexts.
copyAttr Given two nodes, transfer the connections and/or the values from the first node to the second for all attributes whose names and data types match.
createDisplayLayer
createNode This command creates a new node in the dependency graph of the specified type.
currentUnit This command allows you to change the units in which you will work in Maya. There are three types of units: linear, angular and time. The current unit affects how all commands in Maya interpret their numeric values. For example, if the current linear unit is cm, then the command: move 5 -2 3; sphere -radius 4; will be interpreted as moving 5cm in X, -2cm in Y, 3cm in Z, and as creating a sphere with radius 4cm. Similarly, if the current time unit is Film (24 frames per second), then the command: currentTime 6; will be interpreted as setting the current time to frame 6 in the Film unit, which is 6/24 or 0.25 seconds. You can always override the unit of a particular numeric value to a command be specifying it one the command. For example, using the above examples: move 5m -2mm 3cm; sphere -radius 4inch; currentTime 6ntsc; would move the object 5 meters in X, -2 millimeters in Y, 3 centimeters in Z, create a sphere of radius 4 inches, and change the current time to 6 frames in the NTSC unit, which would be 0.2 seconds, or 4.8 frames in the current (Film) unit.
cycleCheck This command searches for plug cycles in the dependency graph.
delete This command is used to delete selected objects, or all objects, or objects specified along with the command.
deleteAttr This command is used to delete a dynamic attribute from a node or nodes.
disconnectAttr Disconnects two connected attributes.
displayAffected Turns on/off the special coloring of objects that are affected by the objects that are currently in the selection list.
displayColor This command changes or queries the display color for anything in the application that allows the user to set its color.
displayCull This command is responsible for setting the display culling property of back faces of surfaces.
displayLevelOfDetail This command is responsible for setting the display level-of-detail for edit refreshes.
displayPref This command sets/queries the state of global display parameters.
displayRGBColor This command changes or queries the display color for anything in the application that allows the user to set its color.
displaySmoothness This command is responsible for setting the display smoothness of NURBS curves and surfaces to either predefined or custom values. It also sets display modes for smoothness such as hulls and the hull simplification factors. At present, this command is NOT un-doable. In query mode, return type is based on queried flag.
displayStats Flags:
displaySurface This command toggles display options on the specified or active surfaces.
distanceDimension This command is used to create a distance dimension to display the distance between two specified points.
duplicate This command duplicates the given objects.
editDisplayLayerGlobals Edit the parameter values common to all display layers.
editDisplayLayerMembers This command is used to query and edit membership of display layers.
exactWorldBoundingBox This command figures out an exact-fit bounding box for the specified objects (or selected objects if none are specified) This bounding box is always in world space.
getAttr This command returns the value of the named object’s attribute.
getClassification Returns the classification string for a given node type.
gethostname gethostname() -> string
getuser Get the username from the environment or password database.
group This command groups the specified objects under a new group and returns the name of the new group.
hasAttr convenience function for determining if an object has an attribute.
hide The hidecommand is used to make objects invisible.
hilite Hilites/Unhilites the specifed object(s). Hiliting an object makes it possible to select the components of the object. If no objects are specified then the selection list is used.
inheritTransform This command toggles the inherit state of an object.
instance Instancing is a way of making the same object appear twice in the scene.
instanceable Flags one or more DAG nodes so that they can (or cannot) be instanced. This command sets an internal state on the specified DAG nodes which is checked whenever Maya attempts an instancing operation. If no node names are provided on the command line then the current selection list is used. Sets are automatically expanded to their constituent objects. Nodes which are already instanced (or have children which are already instanced) cannot be marked as non-instancable.
instancer This command is used to create a instancer node and set the proper attributes in the node.
isConnected The isConnectedcommand is used to check if two plugs are connected in the dependency graph. The return value is falseif they are not and trueif they are. The first string specifies the source plug to check for connection. The second one specifies the destination plug to check for connection.
isDirty The isDirtycommand is used to check if a plug is dirty. The return value is 0 if it is not and 1 if it is. If more than one plug is specified then the result is the logical orof all objects (ie. returns 1 if *any* of the plugs are dirty).
isValidMayaType
isValidPyNode
isValidPyNodeName
isolateSelect This command turns on/off isolate select mode in a specified modeling view, specified as the argument.
iterConnections
iterHierarchy
iterNodes Iterates on nodes of the argument list, or when args is empty on nodes of the Maya scene,
listAttr This command lists the attributes of a node.
listConnections This command returns a list of all attributes/objects of a specified type that are connected to the given object(s).
listFuture Modifications:
listHistory This command traverses backwards or forwards in the graph from the specified node and returns all of the nodes whose construction history it passes through.
listNodeTypes Lists dependency node types satisfying a specified classification string.
listRelatives This command lists parents and children of DAG objects. The flags -c/children, -ad/allDescendents, -s/shapes, -p/parent and -ap/allParents are mutually exclusive. Only one can be used in a command. When listing parents of objects directly under the world, the command will return an empty parent list. Listing parents of objects directly under a shape (underworld objects) will return their containing shape node in the list of parents. Listing parents of components of objects will return the object. When listing children, shape nodes will return their underworld objects in the list of children. Listing children of components of objects returns nothing. The -ni/noIntermediate flag works with the -s/shapes flag. It causes any intermediate shapes among the descendents to be ignored.
listSets The listSets command is used to get a list of all the sets an object belongs to. To get sets of a specific type for an object use the type flag as well. To get a list of all sets in the scene then don’t use an object in the command line but use one of the flags instead.
listTransforms Modifications:
lockNode Locks or unlocks one or more dependency nodes.
ls The lscommand returns the names (and optionally the type names) of objects in the scene.
makeIdentity The makeIdentity command is a quick way to reset the selected transform and all of its children down to the shape level by the identity transformation. You can also specify which of transform, rotate or scale is applied down from the selected transform. The identity transformation means: translate = 0, 0, 0rotate = 0, 0, 0scale = 1, 1, 1shear = 1, 1, 1If a transform is a joint, then the translateattribute may not be 0, but will be used to position the joints so that they preserve their world space positions. The translate flag doesn’t apply to joints, since joints must preserve their world space positions. Only the rotate and scale flags are meaningful when applied to joints. If the -a/apply flag is true, then the transforms that are reset are accumulated and applied to the all shapes below the modified transforms, so that the shapes will not move. The pivot positions are recalculated so that they also will not move in world space. If this flag is false, then the transformations are reset to identity, without any changes to preserve position.
makeLive This commmand makes an object live.
makePaintable Make attributes of nodes paintable to Attribute Paint Tool. This command is used to register new attributes to the Attribute Paint tool as paintable. Once registered the attributes will be recognized by the Attribute Paint tool and the user will be able to paint them. In query mode, return type is based on queried flag.
mayaTypeToPyNode
move The move command is used to change the positions of geometric objects.
nodeCast Given two nodes, a source node of type A and a target node of type B, where type A is either type B or a sub-type of B, this command will replace the target node with the source node. That is, all node connections, DAG hierarchy and attribute values on the target node will be removed from the target node and placed on the source node. This operation will fail if either object is referenced, locked or if the nodes do not share a common sub-type. This operation is atomic. If the given parameters fail, then the source and target nodes will remain in their initial state prior to execution of the command. IMPORTANT: the command will currently ignore instance connections and instance objects. It will also ignore reference nodes.
nodeType This command returns a string which identifies the given node’s type.
objExists This command simply returns true or false depending on whether an object with the given name exists.
objectCenter This command returns the coordinates of the center of the bounding box of the specified object.
objectType This command returns the type of elements.
paramDimension This command is used to create a param dimension to display the parameter value of a curve/surface at a specified point on the curve/surface.
paramLocator The command creates a locator in the underworld of a NURBS curve or NURBS surface at the specified parameter value. If no object is specified, then a locator will be created on the first valid selected item (either a curve point or a surface point).
parent This command parents (moves) objects under a new group, removes objects from an existing group, or adds/removes parents.
partition This command is used to create, query or add/remove sets to a partition.
performanceOptions Sets the global performance options for the application.
pickWalk The pickWalk command allows you to quickly change the selection list relative to the nodes that are currently selected. It is called pickWalk, because it walks from one selection list to another by unselecting what’s currently selected, and selecting nodes that are in the specified direction from the currently selected list. If you specify objects on the command line, the pickWalk command will walk from those objects instead of the selected list. If the -type flag is instances, then the left and right direction will walk to the previous or next instance of the same selected dag node.
pixelMove The pixelMove command moves objects by what appears as pixel units based on the current view. It takes two integer arguments which specify the direction in screen space an object should appear to move. The vector between the center pixel of the view and the specified offset is mapped to some world space vector which defines the relative amount to move the selected objects. The mapping is dependent upon the view.
removeMultiInstance Removes a particular instance of a multiElement. This is only useful for input attributes since outputs will get regenerated the next time the node gets executed. This command will remove the instance and optionally break all incoming and outgoing connections to that instance. If the connections are not broken (with the -b true) flag, then the command will fail if connections exist.
rename Renames the given object to have the new name.
renameAttr Renames the given user-defined attribute to the name given in the string argument.
reorder This command reorders (moves) objects relative to their siblings.
reorderContainer This command reorders (moves) objects relative to their siblings in a container.
resetTool This command resets a tool back to its factory settings
rotate The rotate command is used to change the rotation of geometric objects.
saveToolSettings This command causes all the tools not on the shelf to save their settings as optionVars. This is called automatically by the system when Maya exits.
scale The scale command is used to change the sizes of geometric objects.
scaleComponents This is a limited version of the scale command.
select This command is used to put objects onto or off of the active list.
selectKey This command operates on a keyset.
selectMode The selectModecommand is used to change the selection mode. Object, component, root, leaf and template modes are mutually exclusive.
selectPref This command controls state variables used to selection UI behavior.
selectPriority The selectPrioritycommand is used to change the selection priority of particular types of objects that can be selected when using the select tool. It accepts no other arguments besides the flags. These flags are the same as used by the ‘selectType’ command.
selectType The selectTypecommand is used to change the set of allowable types of objects that can be selected when using the select tool. It accepts no other arguments besides the flags. There are basically two different types of items that are selectable when interactively selecting objects in the 3D views. They are classified as objects (entire objects) or components (parts of objects). The objectand componentcommand flags control which class of objects are selectable. It is possible to select components while in the object selection mode. To set the components which are selectable in object selection mode you must use the -ocm flag when specifying the component flags.
selected ls -sl
selectedNodes Flags:
setAttr Sets the value of a dependency node attribute.
setToolTo This command switches control to the named context.
sets This command is used to create a set, query some state of a set, or perform operations to update the membership of a set.
shapeCompare Compares two shapes.
showHidden The showHiddencommand is used to make invisible objects visible. If no flags are specified, only the objects given to the command will be made visible. If a parent of an object is invisible, the object will still be invisible. Invisibility is inherited. To ensure the object becomes visible, use the -a/above flag. This forces all invisible ancestors of the object(s) to be visible. If the -b/below flag is used, any invisible objects below the object will be made visible. To make all objects visible, use the -all/allObjects flag. See also:hide
snapMode The snapMode command is used to control snapping. It toggles the snapping modes in effect and sets information used for snapping.
softSelect This command allows you to change the soft modelling options.
spaceLocator The command creates a locator at the specified position in space.
symmetricModelling This command allows you to change the symmetric modelling options.
threadCount This command sets the number of threads to be used by Maya in regions of code that are multithreaded. By default the number of threads is equal to the number of logical CPUs, not the number of physical CPUs. Logical CPUs are different from physical CPUs in the following ways:A physical CPU with hyperthreading counts as two logical CPUsA dual-core CPU counts as two logical CPUsWith some workloads, using one thread per logical CPU may not perform well. This is sometimes the case with hyperthreading. It is worth experimenting with different numbers of threads to see which gives the best performance. Note that having more threads can mean Maya uses more memory. Setting a value of zero means the number of threads used will equal the number of logical processors in the system. In query mode, return type is based on queried flag.
toApiTypeEnum
toApiTypeStr
toMayaType
toPyNode
toggle The toggle command is used to toggle the display of various object features for objects which have these components.
toggleAxis Toggles the state of the display axis.
toolDropped This command builds and executes the commands necessary to recreate the specified tool button.
toolHasOptions This command queries a tool to see if it has options.
toolPropertyWindow End users should only call this command as 1.
transformCompare Compares two transforms passed as arguments.
transformLimits The transformLimits command allows us to set, edit, or query the limits of the transformation that can be applied to objects. We can also turn any limits off which may have been previously set. When an object is first created, all the transformation limits are off by default.Transformation limits allow us to control how much an object can be transformed. This is most useful for joints, although it can be used any place we would like to limit the movement of an object.Default values are:( -1, 1) for translation, ( -1, 1) for scaling, and (-45,45) for rotation. In query mode, return type is based on queried flag.
ungroup This command ungroups the specified objects.
upAxis The upAxis command changes the world up direction. Current implementation provides only two choices of axis (the Y-axis or the Z-axis) as the world up direction.By default, the ground plane in Maya is on the XY plane. Hence, the default up-direction is the direction of the positive Z-axis.The -ax flag is mandatory. In conjunction with the -ax flag, when the -rv flag is specified, the camera of currently active view is revolved about the X-axis such that the position of the groundplane in the view will remain the same as before the the up direction is changed.The screen update is applied to all cameras of all views.In query mode, return type is based on queried flag.
xform This command can be used query/set any element in a transformation node.

Classes

PyNode Abstract class that is base for all pymel nodes classes.
Scene The Scene class provides an attribute-based method for retrieving PyNode instances of

Exceptions

class AmbiguityWarning

Bases: exceptions.Warning

args
message
exception message
class MayaAttributeError(node=None)

Bases: pymel.core.general.MayaObjectError, exceptions.AttributeError

args
message
exception message
class MayaNodeError(node=None)

Bases: pymel.core.general.MayaObjectError

args
message
exception message
class MayaObjectError(node=None)

Bases: exceptions.ValueError

args
message
exception message

Table Of Contents

Commands

Modules

This Page