Notifications
Clear all

[Closed] Export animation in .OBJ files

Hi everyone

I want to export a sequence of OBJ files from a Max scene,

basically I need Max to grab the meshes at every frame,
collapse them and export them to an OBJ file,
probably using the OBJ exporter utility within Max…

I did a research but I couldn’t find any particular tools for this
and the only option would be to do it manually for every single frame.

I also heard that it might be possible through Maxscript
but I don’t have any knowledge in coding.

I would appreciate some help if it’s not too complicated!

thanks,

LOTK

6 Replies

depending on the version of max you use, it’s either ‘somewhat simple’ or ‘slightly involved’.

Basically what you’d do is loop over all frames and call an export function on each frame:


for i = 1 to 100 do (
slidertime = i -- forcing the slider as some elements don't react well to 'at time'
exportToObjFuntionHere()
)

As for the actual OBJ export function – if you just need to export ‘as is’, use:


exportFile "c:\\filename.obj" #noprompt

e.g. for the current animation range with each file numbered with 4 digits (leading zeroes):


 for i = animationRange.start to animationRange.end do (
 slidertime = i -- forcing the slider as some elements don't react well to 'at time'
numStr = subString ((10000 + i) as string) 2 -1
exportFile ("c:\\filename_" + numStr + ".obj") #noprompt
 )
 

If you do need to change settings, see this thread on how to do so… it varies a bit whether you use 3ds Max 2009 or an earlier version:
http://forums.cgsociety.org/showthread.php?f=98&t=689110&highlight=export

Thanks for the script Richard!

now pls bear with me as I’m not really into scripting,

I have to use Max 8 (ya I know it’s quite old) for the OBJ exporting, so I pasted the script into the listener and modified the output path, but it returns an error:

– Syntax error: at ), expected <factor>
– In line: )

It’s probably something common, but I’m not sure if it’s related to my max version?

thanks again

LOTK

The codes in the 2nd post should be fine (just tried in R8); the first calls a non-existant function, of course – if you defined a function, perhaps the error is in that function?

Can you paste the code you’re using?

Hi Richard,

I realised that in the first bit of code the:exportToObjFuntionHere()

was just referring to the exporting function.

I used the code exactly as in your 2nd block of code with some modifications, i.e

for i = 0 to 100 do (
slidertime = i – forcing the slider as some elements don’t react well to ‘at time’
numStr = subString ((10000 + i) as string) 2 -1
exportFile (“c:\temp\filename_” + numStr + “.obj”) #noprompt
)
I was trying to run it via the “listener” by pasting it and hitting enter at the end, probably wrong way of doing things?

Anyway, I saved an .ms and after running it everything worked, sorry if the question was silly, as I said I’m totally lame with scripting

thanks!

Ahh

When you use the maxscript listener and you have to evaluate a whole block of code, select that whole block, then hit the enter key Otherwise it only evaluates the line you’re hitting enter on – in your case, just the “)”, so MaxScript complains about a closing parenthesis without ever having seen an opening one.

It’s typically best to place code bits in a new script window/tab – makes it much easier to work with (especially with the new editor)

Have fun scripting

Doh!!

Heheheh, should I delete the previous two posts?

thanks for all the help!