Go to: Synopsis. Return value. Python examples.

Synopsis

nParticle( selectionItem )

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

nParticle is undoable, queryable, and editable.

The nParticle command creates a new nParticle object from a list of world space points. If an nParticle object is created, the command returns the names of the new particle shape and its associated particle object dependency node. If an object was queried, the results of the query are returned. Per particle attributes can be queried using the particleId or the order of the particle in the particle array. If an object was edited, nothing is returned.

Return value

stringThe name of the nParticle object created

In query mode, return type is based on queried flag.

Python examples

import maya.cmds as cmds

# Creates a particle object with four particles
cmds.nParticle( p=[(0, 0, 0), (3, 5, 6), (5, 6, 7), (9, 9, 9)] )

# Returns the age of the particle with id 2 in object particle1
cmds.nParticle( 'particle1', q=True, attribute='age', id=2 )

# Returns the velocity of the 3rd particle in the currently selected
# particle object
cmds.nParticle( attribute='velocity', q=True, order=3  )

# Edits the velocity of the 7th particle in the currently selected
# particle object to be 0.0, 1.0, 0.0
cmds.nParticle( e=True, attribute='velocity', order=3, vectorValue=(0.0, 1.0, 0.0) )

# Edits the mass of the particle in "particle1" with id 3 to be 0.7
cmds.nParticle( 'nParticle1', e=True, attribute='mass', id=3, fv=0.7 )