Message 1 of 3
How to save particleIDs in a variable after selecting a bunch of particles in the viewport?

Not applicable
05-18-2010
07:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I've been facing problem with saving the particle IDs of selected particles in a variable.
This is what I am doing:
Selected few random particles( particleShape1) in the viewport in component mode and ran the code:
string $sel[] = `ls -sl`;
for($each in $sel)
{
print ($each + "\n")
}
Result:
particle1.pt
particle1.pt
particle1.pt
particle1.pt
particle1.pt
Now my problem is, how can I store only the numbers in a variable? from the above example, I only want the numbers 4, 11, 27, 28, 29 and so on in a variable, not the whole string particle1.pt or particle1.pt
One problem could be that here it stores the output as a string. Did some tests on getParticleAttr, but no progress.
I am not sure how to go about it, or maybe my whole approach is wrong.
NEED HELP!!!!!
Thanks
I've been facing problem with saving the particle IDs of selected particles in a variable.
This is what I am doing:
Selected few random particles( particleShape1) in the viewport in component mode and ran the code:
string $sel[] = `ls -sl`;
for($each in $sel)
{
print ($each + "\n")
}
Result:
particle1.pt
particle1.pt
particle1.pt
particle1.pt
particle1.pt
Now my problem is, how can I store only the numbers in a variable? from the above example, I only want the numbers 4, 11, 27, 28, 29 and so on in a variable, not the whole string particle1.pt or particle1.pt
One problem could be that here it stores the output as a string. Did some tests on getParticleAttr, but no progress.
I am not sure how to go about it, or maybe my whole approach is wrong.
NEED HELP!!!!!
Thanks