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 CLOSED
 
Thread Tools Search this Thread Display Modes
Old 04 April 2013   #1
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:
output.txt
#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
 
Old 04 April 2013   #2
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
 
Old 04 April 2013   #3
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 02:50 AM.


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