|
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[4]
particle1.pt[11]
particle1.pt[27:30]
particle1.pt[32]
particle1.pt[43]
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[4] or particle1.pt[11]
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
|
|
|
|
select -cl ; select -r particle1.pt[10] ; select -tgl particle1.pt[52] ; select -tgl particle1.pt[57] ; select -tgl particle1.pt[80] ; select -tgl particle1.pt[113] ; select -tgl particle1.pt[95] ; getParticleAttr -at id -array true `ls -sl`; // Result: 10 52 57 80 95 113 //
|
|
|