pymel.core.effects.getParticleAttr

getParticleAttr(*args, **kwargs)

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.

Flags:
Long name (short name) Argument Types Properties
array (a) bool ../../../_images/create.gif
 

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 commandFlag can have multiple arguments, passed either as a tuple or a list.

attribute (at) unicode ../../../_images/create.gif
 
Tells the action which attribute you want the value of. Must be a per-particle attribute.
object (o) unicode ../../../_images/create.gif
 
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.

Derived from mel command maya.cmds.getParticleAttr

Example:

import pymel.core as pm

pm.getParticleAttr( 'particle1', at='velocity' )

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

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

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

Previous topic

pymel.core.effects.getFluidAttr

Next topic

pymel.core.effects.goal

Core

Core Modules

Other Modules

This Page