You should be able to do something like this to get the point positions on
a per-frame basis:
import pymel.core as pm
pars_shape = pm.PyNode( 'particleShape1' )
for frame in range( start, end+1 ):
pm.currentTime( frame )
positions = []
for pt in pars_shape.points:
positions.append( pt.worldPosition )
f = open( '/tmp/parPositions.%04d.txt' % frame, 'w' )
f.writelines( positions )
f.close()
You could also use the 'with' directive for better file stream handling.
Cheers, Ken
On Sun, May 13, 2012 at 6:17 PM, AJ <[email protected]> wrote:
> Hey,
>
> Lets say I have a particle that is moving base on a field for 10
> frames.
> How can I query its position on each frame and write it in text file?
>
> Many thanks for you help in advance.
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>
--
"God is a metaphor for a mystery that absolutely transcends all human
categories of thought. It's as simple as that!" - Joseph Campbell
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe