global proc getParticleData(string $tnode, vector $data[]) {
int $count = size($data);
string $part;
float $pos[];
int $num = `particle -q -ct $tnode`;
for($n = 0; $n < $num; $n++) {
$part = $tnode + ".pt[" + $n + "]";
$pos = `getParticleAttr -at position $part`;
$data[$count] = <<$pos[0], $pos[1], $pos[2]>>;
$count++;
}
}
/*
Example of use.
vector $data[];
clear($data); <<---- very important-------
getParticleData("particle1", $data);
for($i = 0; $i < size($data); $i++) {
vector $pos = $data[$i];
print($pos.x + " " + $pos.y + " " + $pos.z + "\n");
}
*/