PyMEL: Help with pymel.core.system.exportSelected()


#1

I’m trying to export a file to a format that isn’t native to Maya. The docs say that pymel.core.system.exportSelected is derived from maya.cmds.file (which is used when I export manually via the dialog) but exportSelected has only like 20% of the flags?

In the script editor I can see that maya-cmds.file uses these flags for the export:
-force
-options
-typ (type)
-es (exportSelected)

Am I supposed to use the PyMEL flag expressions for feeding the options to the command, and if so what is the format and syntax like? The docs really doesn’t specify anything here. It also says nothing about the file path.


#2

dont forget help()


#3

Unfortunatly that is the same text that is in the official docs and it really doesn’t say anything about how the export options should be formatted (or what key they go to) or how to specify the file output path.


#4

Well most of the info is there. As mentioned, the docs for maya.cmds.file fills in some gaps. And doing it from the UI with echo all commands provides a look at some of the format specific stuff that you would not expect to see in the docs if its a non-native format. ( Which one by the way? )

Here’s an obj example…

pm.exportSelected('U:/temp/exports/xxx.obj', type='OBJexport', options='groups=1;ptgroups=1;materials=0;smoothing=1;normals=0')

# Result: Path('U:/temp/exports/xxx.obj') # 

David


#5

Thank you. For some reason I just assumed that the options -flag was invalid because it wasn’t covered in the docs -_-