For example, I want to launch a script that creates a poly cube, export it to .stl or .fbx from the command line.
I can do it in Python by using the Maya standalone but it cannot handle exporting to other formats than .ma apparently
For example, I want to launch a script that creates a poly cube, export it to .stl or .fbx from the command line.
I can do it in Python by using the Maya standalone but it cannot handle exporting to other formats than .ma apparently
Why of course you can. Here's how you'd do exactly that (for FBX):
from os.path import join
from maya.standalone import initialize
import maya.cmds as cmds
import maya.mel as mel
initialize("python")
cmds.loadPlugin("fbxmaya")
my_cube = cmds.polyCube()
cmds.select(my_cube[0], r=True)
my_filename = "cube2.fbx"
my_folder = "C:/SomeFolder/scenes"
full_file_path = join(my_folder, my_filename).replace('\\', '/')
mel.eval('FBXExport -f "%s"' % full_file_path)
Hope that was useful.