Batch converting Max files to Maya
Recently I worked on a project that required converting hundreds of models in 3DS .Max format to Maya.
Instead of doing all this importing manually it’s obviously always better to script!
To batch convert Max files to FBX within Max, use this script:
(
local dir = getSavePath "Pick a folder with .max files to convert to .fbx" initialDir:(getDir #scene)
undefined
if (dir != undefined) do (
local files = getFiles (dir + "\\*.max")
if (files.count > 0) do (
if (queryBox ("About to convert " + files.count as string + " .max files to .fbx.\r\n\r\nContinue?") title:"Continue conversion?") do (
for f in files do (
if (keyboard.escPressed) do (a
if (queryBox "Abort processing?") do ( exit )
)
loadMaxFile f useFileUnits:true quiet:true
exportFile ((getFileNamePath f) + (getFileNameFile f) + ".fbx") #noprompt
)
)
)
)
)
To batch convert FBX into the Maya ASCII (.ma) format use this script:
string $path = "C:/temp/"; string $filelist[] = `getFileList -folder $path -filespec "*.fbx"`; string $newFileList[]; int $cnt; string $parts[]; for ($i=0;$i$cnt = `tokenize $filelist[$i] "." $parts`; //strip out "." from fbx suffix $newFileList[$i] = $parts[0]; FBXImport -f ($path + $filelist[$i]) -t; //open the fbx file file -rename ($path + ($newFileList[$i]+".ma")); //rename to .ma file -f -save -options "v=0" -type "mayaAscii"; //save the .ma file -f -new; //create a new scene }
You’ll have to manually change the first line of the code above to match the directory where all your FBX files are stored. Always make sure to end the $path with a forward slash (/) otherwise Maya will not execute the script properly.
Comments
Hi
I’m just wondering is there a better way to do the Max file conversion within Maya?
thanks
I don’t think this would be possible as Maya cannot read Max files natively, they must be converted to fbx first as both programs can read fbx
Hi
So the above script was done within Max itself or done in Python environment? I’m just wondering is there a way to read and convert MAX file to other 3D file format easier without 3DMAX been installed?
thanks
Yeah, since the “.max” files are propriety and only readable by 3DS Max itself I’d find it highly unlikely that anything else would be able to read or edit them.
Even Autodesk’s own FBX converter will not read or open Max files or maya files for that instance, so for now it’ll only be possible with Max installed on the system unfortunately.










