pymel.core.effects.setParticleAttr

setParticleAttr(*args, **kwargs)

This action will set the value of the chosen attribute for every particle or selected component in the selected or passed particle object. Components should not be passed to the command line. For setting the values of components, the components must be selected and only the particle object’s names should be passed to this action. If the attribute is a vector attribute and the -vv flag is passed, then the three floats passed will be used to set the values. If the attribute is a vector and the -fv flag is pass and the -vv flag is not passed, then the float will be repeated for each of the X, Y, and Z values of the attribute. Similarly, if the attribute is a float attribute and a vector value is passed, then the length of the vector passed will be used for the value. Note: The attribute passed must be a Per- Particle attribute.

Flags:

Long Name / Short Name Argument Types Properties
attribute / at unicode ../../../_images/create.gif
  Tells the action which attribute you want to set
floatValue / fv float ../../../_images/create.gif
  Tells what you want the value to be set to of a float attribute
object / o unicode ../../../_images/create.gif
  If this flag is passed and the STRING is the name of a particle object’s transform or shape, then ONLY that object will be edited, ignoring the selection list or command line, and ALL of its particles’ values will be changed for the specified attribute.
randomFloat / rf float ../../../_images/create.gif
  Tells the command to add a random value from -FLOAT to +FLOAT to the results of each particle. The default is 0.0.
randomVector / rv float, float, float ../../../_images/create.gif
  Tells the command to add a random value from -x,-y,-zto x,y,zto the results of each particle. The default 0 0 0.
relative / r bool ../../../_images/create.gif
  If this is set to TRUE (the default is FALSE), then the float or vector value will be added to the current value for each particle.
vectorValue / vv float, float, float ../../../_images/create.gif
  Tells what you want the value to be set to of a vector attribute Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.setParticleAttr

Example:

import pymel.core as pm

pm.setParticleAttr( 'particle1', at='velocity', vv=(1, 2, 3) )
# This will set the velocity of all of the particles in particle1
# to "" 1, 2, 3 "".

pm.select( 'particleShape1.pt[0:7]', 'particleShape1.pt[11]' )
pm.setParticleAttr( vv=(1, 2, 3), at='velocity' )
pm.setParticleAttr( 'particleShape1', at='velocity' )

# This will set the velocity of particles 0-7 and 11 of
# particleShape1 to "" 1, 2, 3 "".  The rest of the particles are
# not changed.