3dsMax - Exporting FBX with Python

python
max

#1

Hey all - I’m starting to get my feet wet with 3dsMax and Python (looking to extend some of our Maya frameworks over to max).

I’m trying something simple - exporting an FBX with custom settings to disk. I want to do it without any dialogs - but I cannot seem to find a way around it.

This is what I’m doing:

import pymxs as mxs
mxs.runtime.FBXExporterSetParam('ResetExport')
mxs.runtime.FBXExporterSetParam('Animation', False)
mxs.runtime.exportFile(r'e:\tmp\msx.fbx', noPrompt=True, selectedOnly=True, using='FBXEXP')

Unfortunately, this doesn’t seem to work - I always get the FBX export prompt. Any ideas? My maxscript is SUPER rusty, so if there is another way, forgive me.


#2

Your maxscript is totally fine - it’s pymxs’s dodgy way of integrating “name values” that’s the problem. Name Values are basically the property flags with a “#” in front of them. Why are some name values and others just properties? I don’t know. I assume someone does, but not this guy.

Anyway, to get it working in pymxs, rather than do the logical thing which you did (noPrompt = True), you have to do this:

pymxs.runtime.Name("noPrompt")

Instead. That effectively shoves “#noPrompt” in there, which is what you want. SelectedOnly and Using should be fine as assignments like you have it.

Edit: To clarify, your final line should now read…

mxs.runtime.exportFile(r'e:\tmp\msx.fbx', pymxs.runtime.Name("noPrompt"), selectedOnly=True, using='FBXEXP')

That’ll export with no dialog.


#3

@jtilden20 Don’t forget to mark the answer as “solved” (using the … button) if it handles your problem!


#4

Thanks, @DanGrover - I think that’ll do it!