FBX export with Motionbuilder preset

Simple question that I can’t seem to easily find an answer to…

Looking to do an FBX export, with the motionbuilder preset in 2016 set. What would be the command in Python to set the export to use that preset? I can’t seem to find it documented anywhere or in script editor echo out.

cmds.file(“C:/test/FBX_Export/test.fbx”, force=True, options=“v=0;”, typ=“FBX export”, pr=True, es=True)

you need

cmds.FBXLoadImportPresetFile("path/to/file")

before you run the export.
http://help.autodesk.com/view/MAYAUL/2016/ENU//?guid=GUID-F48E3B78-3E56-4869-9914-CE0FAB6E3116

Thanks! This somewhat helps… but I think I would need the loadexport command instead of import, which I assume is this and looks like it can only be done with MEL rather than Python:

FBXLoadExportPresetFile -f “C:\Users\blah\Documents\maya\FBX\Presets\2016.0\export\Test.fbxexportpreset”;

I seem to be getting stuck though because when running this command it keeps complaining about bad file extension, which is odd because the preset file is sitting right there with the correct extension (it was saved out via Maya 2016). VERY Frustrating!!

// Error: Bad file extension. (must be: fbxexportpreset) //

[QUOTE=Theodox;29388]you need

cmds.FBXLoadImportPresetFile("path/to/file")

before you run the export.
http://help.autodesk.com/view/MAYAUL/2016/ENU//?guid=GUID-F48E3B78-3E56-4869-9914-CE0FAB6E3116[/QUOTE]

Oops. Looks like I figured it out… needed to switch my “” with “/”.

In python you can also do a raw string.


cmds.FBXLoadImportPresetFile(r'C:
o
eed	o\escape	he\path')

yep, sorry about the wrong command. When the fbx plugin is loaded, it populates cmds with all of its mel functions so you don’t need to use mel

…does that need to be wrapped in quotes?

Error: RuntimeError: file <string> line 2: FBXLoadExportPresetFile: Error bad syntax.

Use syntax: FBXLoadExportPresetFile -f “filepath” #

Also tried…

cmds.FBXLoadExportPresetFile(f=“r’C:\Test.fbxexportpreset’”)

…which doesn’t seem to work.

[QUOTE=R.White;29391]In python you can also do a raw string.


cmds.FBXLoadImportPresetFile(r'C:
o
eed	o\escape	he\path')

[/QUOTE]

Export can also be viewed as save, so you can use:
options = FBFbxOptions(False)
FBApplication().FileSave(itemName, options)