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

Synopsis

getParticleAttr [-array boolean] [-attribute string] [-object string] selectionItem

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
-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.
-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.


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 be used more than once in a command.

MEL examples

getParticleAttr -at velocity particle1;

// This will return the average velocity for the entire particle
// object as well as the maximum offset from the average.

getParticleAttr -at velocity particleShape1.pt[0:7] particleShape1.pt[11];

// This will return the average velocity for particles 0-7 and 11
// as well as the maximum offset from the average.

getParticleAttr -at position -array true particleShape1.pt[0:7] particleShape1.pt[11];
// This will return an array of 27 floats containing the position
// values for the nine specified particles.