Export 3DSMAX to a specific .txt format

Hello everyone!
I'm looking for a 3dsmax script in order to export data from 3dsmax.
I have an animated cube in my scene and I need to export for each frame (at 100fps)
position and rotation in this particular file format (txt):

0.000 0.000 0.000 0.000 0.000 0.000 0.000
0.010 0.000 0.000 0.000 0.000 0.000 0.000
0.020 0.000 0.000 0.000 0.000 0.000 0.000
0.030 0.000 0.000 0.000 0.000 0.000 0.000
0.040 0.000 0.001 0.000 0.000 0.000 0.000
0.050 0.000 0.001 0.000 0.000 0.000 0.000
0.060 0.000 0.001 0.000 0.000 0.000 0.000
0.070 0.001 0.002 0.000 0.000 0.000 0.000
0.080 0.001 0.003 0.000 0.000 0.000 0.000
0.090 0.001 0.004 0.000 0.000 0.000 0.000
0.100 0.002 0.005 0.000 0.000 0.000 0.000
0.110 0.002 0.006 0.000 0.000 0.000 0.000

The first row is time in seconds, then X, Y, Z in millimeters, rX, rY, rZ in degrees, each time seperated by a tabulation space (this space doesn't appear in the post, sorry... there is no way to input tabulation space in this post...)
I need this specific data file in order to export my 3dsmax animation to a 6DOF hexapod motion software.

Does anyone can help me???
Thanks a lot for all your answers!!!

r.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tdugard's picture

Hi, I gave it a try, I've

Hi,

I gave it a try, I've truncated float value to 3 digits like your example :

-- 6DOF exporter for 3dsmax by Tony DUGARD
-- 
-- website : www.tonydugard.com
-- email : tony.dugard (a) gmail.com
--
 
out_name = ("C:/yourfile.txt")
out_file = createfile out_name
vFormat = ".3f"
 
vStartFrame = animationrange.start
vEndFrame = animationrange.end
 
 for t = vStartFrame to vEndFrame do
 (
	vCurrentFrame = formattedPrint ((t.frame)/1000.00) format:vFormat
 
	vCurrentPosX = formattedPrint (at time t $.pos.x) format:vFormat
	vCurrentPosY = formattedPrint (at time t $.pos.y) format:vFormat
	vCurrentPosZ = formattedPrint (at time t $.pos.z) format:vFormat
 
	vCurrentRot = at time t quattoEuler2($.rotation.controller.value)
	vCurrentRotX = formattedPrint (at time t vCurrentRot.x) format:vFormat
	vCurrentRotY = formattedPrint (at time t vCurrentRot.y) format:vFormat
	vCurrentRotZ = formattedPrint (at time t vCurrentRot.z) format:vFormat
 
	format "%\t%\t%\t%\t%\t%\t%\n" vCurrentFrame vCurrentPosX vCurrentPosY vCurrentPosZ vCurrentRotX vCurrentRotY vCurrentRotZ to:out_file
)
 
close out_file

To use it, simply select the cube and then execute the script. You can change the export path easily changing the first line of code.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.