pymel.core.effects.setFluidAttr

setFluidAttr(*args, **kwargs)

Sets values of built-in fluid attributes such as density, velocity, etc., for individual grid cells or for all cells in the grid.

Flags:
Long name (short name) Argument Types Properties
addValue (ad) bool  
 
Add specified value to attribute
attribute (at) unicode ../../../_images/create.gif
 
Specifies the fluid attribute for which to set values. Valid attributes are “velocity”, “density”, “fuel”, “color”, “falloff”, and “temperature”.
clear (cl) bool  
 
Set this attribute to 0
floatRandom (fr) float  
 

If this was a scalar (e.g. density) attribute, use a random value in +-VALUE If fv is specified, it is used as the base value and combined with the random value. If the fv flag is not specified, the base is assumed to be 0.

floatValue (fv) float  
 
If this was a scalar (e.g. density) attribute, use this value
lowerFace (lf) bool ../../../_images/create.gif
 

Only valid with “-at velocity”. Since velocity values are stored on the edges of each voxel and not at the center, using voxel based indices to set velocity necessarily affects neighboring voxels. Use this flag to only set velocity components on the lower left three faces of a voxel, rather than all six.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

reset (re) bool  
 
Set this attribute to default value
vectorRandom (vr) float, float, float  
 

If this was a vector (e.g. velocity) attribute, use a random value in +-VALUE If vv is specified, it is used as the base value and combined with the random value. If the vv flag is not specified, the base is assumed to be 0,0,0.

vectorValue (vv) float, float, float  
 
If this was a vector (e.g. velocity) attribute, use this value
xIndex (xi) int ../../../_images/create.gif
 
Only return values for cells with this X index
xvalue (x) bool  
 
Only set the first component of the vector-valued attribute specified by the “-at/attribute” flag.
yIndex (yi) int ../../../_images/create.gif
 
Only return values for cells with this Y index
yvalue (y) bool  
 
Only set the second component of the vector-valued attribute specified by the “-at/attribute” flag.
zIndex (zi) int ../../../_images/create.gif
 
Only return values for cells with this Z index
zvalue (z) bool  
 
Only set the third component of the vector-valued attribute specified by the “-at/attribute” flag.

Derived from mel command maya.cmds.setFluidAttr

Example:

import pymel.core as pm

import maya.cmds as cmds

# set density for entire fluid
pm.setFluidAttr( at='density', fv=1.0 )
# add 3.5 to the density at the cell x=1, y=2, z=3
pm.setFluidAttr( at='density', ad=True, fv-3.5, xi=1, yi=2, zi=3 )
# clear the density for the whole fluid
pm.setFluidAttr( at='density', cl=True )
# reset the velocity at the cell x=1, y=2, z=3
pm.setFluidAttr( at='velocity', re=True, xi=1, yi=2, zi=3 )
# set the velocity at the centers of the voxels on plane y=5
# to approximately (-1, 0, 0)
pm.setFluidAttr( at='velocity', vv=(-1, 0, 0), yi=5 )
# set the Z-component of the velocity at the bottom of cell [0, 0, 0]
# to exactly 1.3
pm.setFluidAttr( at='velocity', z=True, xi=0, yi=0, zi=0, fv=1.3 )
# set the X-component of the velocity at the right of cell [5, 3, 2]
# (which is also the left of cell [6, 3, 2]) to exactly 4.8
pm.setFluidAttr( at='velocity', x=True, xi=5, yi=3, zi=2, fv=4.8 )
# set the density to a random value in the range 0.1 to 0.9
# the fv flag specfies the base value, and then we add a a
# random value in the range of -fr to +fr
pm.setFluidAttr( at='density', fv=0.5, fr=0.4 )

Previous topic

pymel.core.effects.setDynamic

Next topic

pymel.core.effects.setParticleAttr

Core

Core Modules

Other Modules

This Page