Go to: Synopsis. Return value. Related. Flags. Python examples.

Synopsis

getParticleAttr( selectionItem , [array=boolean], [attribute=string], [object=string])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

getParticleAttr is undoable, NOT queryable, and NOT editable.

This action will return either an array of values, or the average value and maximum offset, for a specied per-particle attribute of a particle object or component. If a particle component is specified on the command line, values are returned for that component only. If an object name is given instead, values are returned for all particles in that object. If no object name is passed, but a particle object or component is selected, values are returned for the selection. If you list components, they must all be from the same particle object; the action ignores all objects after the first. Likewise if you list more than one object, the actiion will return values only for the first one.

Return value

float[]

Related

particle, setParticleAttr

Flags

array, attribute, object
Long name (short name) Argument types Properties
attribute(at) string create
Tells the action which attribute you want the value of. Must be a per-particle attribute.

object(o) string create
This flag is obsolete. Instead of using it, please pass the name of the object and/or components you want on the command line. See the examples.

array(a) boolean create
Tells the action whether you want a full array of data. If set true, the action returns an array of floats containing the values for all the specified particles. If set false (the default), the action returns the average value and the maximum offset from the average over the component. If the attribute is a vector attribute, the action returns six values: Average X, Average Y, Average Z, Maximum offset in X, Y, and Z of component.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

cmds.getParticleAttr( 'particle1', at='velocity' )
# This will return the average velocity for the entire particle
# object as well as the maximum offset from the average.
cmds.getParticleAttr( 'particleShape1.pt[0:7]', 'particleShape1.pt[11]', at='velocity' )
# This will return the average velocity for particles 0-7 and 11
# as well as the maximum offset from the average.
cmds.getParticleAttr( 'particleShape1.pt[0:7]', 'particleShape1.pt[11]', at='position', array=1 )
# This will return an array of 27 floats containing the position
# values for the nine specified particles.