Position data to file (MaxScript)

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  04 April 2013
Position data to file (MaxScript)

Hi guys,

I have an animated dummy. What I want is to write positions (x,y,z) of the dummy to each frame in a file. Something like this:
#1frame x=10 y=10 z=10

I don't know anything about maxscript. Can anyone help me how to write a script to get this?
Thanks in advance for help!
Best Regards,
Balazs Halo
  04 April 2013
Give this a shot.

	if selection.count == 1 do
		obj = selection[1]
		eFile = getSaveFileName caption:"Save Position Data" \
				filename:(maxfilepath + obj.name + ".txt") \
				types:"Text File (*.txt)|*.txt" \
				historyCategory:"Save Position Data"
		if eFile != undefined do
			eWriteFile = createFile eFile
			eString = "" as stringstream

			animStart = animationRange.start.frame
			animEnd = animationRange.end.frame

			for i = animStart to animEnd do with redraw off with undo off
				at time i
					format "#%frame x=% y=% z=%\n" i obj.position.x obj.position.y obj.position.z to:eString
			format "%" (eString as string) to:eWriteFile
			close eWriteFile
Juan Martinez | Blog | Animator
  04 April 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 02:00 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.