IDArray (ParticleCollection)

Description

Returns the list of unique particle identification numbers (IDs) for each particle in the collection as an Array of Integers representing each Particle.ID.

C# Syntax

// get accessor
Object rtn = ParticleCollection.IDArray;

Examples

VBScript Example

Option Explicit
'
' This example demonstrates how to use the AgeArray, IDArray, and
' AgeLimitArray properties on the ParticleCollection by showing
' how you can create a subset of the current particle ids in order
' to reset the ages of those particles using the AgeArray property
' 
' For the JScript version of this example, see ParticleCollection.AgeArray.
' For the Python version of this example, see ParticleCollection.AgeLimitArray.
'

' Set up a scene with a particle cloud using a disc emitter
NewScene , 0
CreateParticleCloud , "Disc"

' Simulate particle emission up to frame 4
dim k
for k = 0 to 3
   NextFrame
next

' Get the particle collection from the cloud
dim cloud, pcoll
set cloud = Dictionary.GetObject( "cloud" )
set pcoll = cloud.Particles

' Get the ages of each particle in the collection
dim allAges, results, age
allAges = pcoll.AgeArray
results = "Old ages: "
for each age in allAges
   results = results & vbTab & age
next
Application.LogMessage results 

' Get the particle IDs and then build a new list of every other ID
dim allIDs, j, i
allIDs = pcoll.IDArray
dim subsetIDs()
j = 0
for i = 0 to UBound(allIDs) step 2
   redim preserve subsetIDs(j)
   subsetIDs(j) = allIDs(i)
   j = j + 1
next

' Get the age limit arrays for this group of particles 
dim newAges 
newAges = pcoll.AgeLimitArray(subsetIDs)

' Reset the selected particles to their age limit
pcoll.AgeArray(subsetIDs) = newAges

' Print out the ages again
allAges = pcoll.AgeArray
results = "New ages: "
for each age in allAges
   results = results & vbTab & age
next
Application.LogMessage results 


' Expected result:
'INFO : Old ages: 4 4 3 2 2 1 1 0
'INFO : New ages: 29 4 29 2 29 1 29 0


Autodesk Softimage v7.5