Script saving x,y,z,rot coordinates of selected objects from the scene in the 3D Studio Max to file

I thought to share my solution of kind of tricky situation. I`ve got something programmed and controlled in the script (neutral animation like a rotation) and then I wanted to add some HAVOK generated animation based on the nice physical model.
I was trying to export object to dae files md2 files NOTHING was good enough everything simply encrypted to weird structures... so I decided to simplify that to use just frame by frame x,y,z coordinates. Digging sweat in that maxscript I did this:

path = getSaveFileName caption:"list of coordinates to save?" filename:"liste.csv" types:"format text (*.dat)"
file = createFile path
sframe = 20
eframe = 150

print path
print "------- start"
for i=1 to selection.count do
print selection[i].name

rn = getUserProp selection[i] "Name"
if rn==undefined then rn=selection[i].name

rot = quatToEuler s.rotation
zrot = degToRad rot.z
for t = sframe to eframe do at time t format "%;%;%;%;%;%\n" rn t s.position.x s.position.y s.position.z zrot to:file
print "------- end"

Before you run this script enter the frames in to it how long you want to save period, please select the objects of your interest in the scene first and then after request type in the file name and that`s it :)


coord4.ms561 bytes


Robert574's picture

You have to understand about

You have to understand about hotschedules, Hotschedules Login Welcome Sheet and also click the 'Visit' switch beneath.