Here's the code for a FBX exporter. At this point it will only create and export PolyCube1, but ill fix that up so it will "apply to selected".
The code itself was derived from the output window (so it will require fixing and cleaning for superfluous material) Also it is mel at this time but the conversion from mel to python is very perscise so ill continue with this code. But an upside is you can save it to whatever directory you want.
polyPlane -w 1 -h 1 -sx 10 -sy 10 -ax 0 1 0 -cuv 2 -ch 1;
// pPlane1 polyPlane1 // select -cl ;
select -r pPlane1 ;editMenuUpdate MayaWindow|mainEditMenu;
checkMainFileMenu;
ExportSelectionOptions;
fileOptions "ExportActive" "projectViewer ExportActive";
IsExportActiveOperationMode();
// Result: 0 //
IsExportActiveOperationMode();
// Result: 0 //
fileOptionsAction OptionBoxWindow "ExportActive" "projectViewer ExportActive";
fileCmdCallback;
fileCmdRestoreCallback;
IsExportActiveOperationMode();
// Result: 1 //
IsExportActiveOperationMode();
// Result: 1 //
fileOperationsOptionsUISetup ExportActive FileDialogOptionsGrpBoxLayout;
np_getPrimaryProjectFileRules 0;
// Result: Scenes scene scenes Templates templates assets Images images images Source Images sourceImages sourceimages Render Data renderData Particles particles particles Clips clips clips Sound sound Scripts scripts Disk Cache diskCache data Movies movie data Translator Data translatorData AutoSave autoSave autosave //
fileOperationsOptionsUIInitValues ExportActive FileDialogOptionsGrpBoxLayout"OBJexport";
manipMoveValues Move;
toolPropertyShow;
changeToolIcon;
uvEntryFieldScriptJob;
saveOptionBoxSize();
fileOperationsOptionsUICallback ExportActive FileDialogOptionsGrpBoxLayout;
fileCmdCallback;
fileCmdRestoreCallback;
fileCmdCallback;
fileCmdRestoreCallback;
fileCmdCallback;
fileCmdRestoreCallback;
fileCmdCallback;
fileCmdRestoreCallback;
fileCmdCallback;
fileCmdRestoreCallback;
fileCmdCallback;
fileCmdRestoreCallback;
fileCmdCallback;
fileCmdRestoreCallback;
file -force -options "groups=0;ptgroups=0;materials=1;smoothing=1;normals=0" -typ "OBJexport" -pr -es "C:/Users/owner/Desktop/test.obj";
fileCmdCallback;
about -application;
// Result: maya //
about -product;
// Result: Maya 2013 //
about -version;
// Result: 2013 x64 //
about -cutIdentifier;
// Result: 201202220241-825136 //
about -osv;
// Result: Microsoft Windows 7 Home Premium Edition, 64-bit Windows 7 Service Pack 1 (Build 7601)
//
ls -sets;
// Result: defaultLightSet defaultObjectSet initialParticleSE initialShadingGroup //
listRelatives -ap -f |pPlane1|pPlaneShape1;
// Result: |pPlane1 //
listRelatives -ap |pPlane1|pPlaneShape1;
// Result: pPlane1 //
nodeType |pPlane1;
// Result: transform //
listRelatives -ap -f |pPlane1;
listRelatives -ap |pPlane1;
listRelatives -ap -f |pPlane1|pPlaneShape1;
// Result: |pPlane1 //
listRelatives -ap |pPlane1|pPlaneShape1;
// Result: pPlane1 //
nodeType |pPlane1;
// Result: transform //
listRelatives -ap -f |pPlane1;
listRelatives -ap |pPlane1;
listConnections -t file lambert1.color;
listConnections -t file lambert1.ambientColor;
listConnections -t bump2d lambert1.normalCamera;
memory -he;
// Result: 389.03125 //
memory -fr;
// Result: 1063.332031 //
memory -pf;
// Result: 4387037 //
fileCmdRestoreCallback;
// Result: C:/Users/owner/Desktop/test.obj //
fileCmdCallback;
fileCmdRestoreCallback;
refreshAE;
listHistory -pdo true -lf false -il 2 "|pPlane1";
listHistory -pdo true -lf false -il 2 -f true "|pPlane1";
listHistory -pdo true -lf false -il 2 "|pPlane1|pPlaneShape1";
// Result: polyPlane1 //
listHistory -pdo true -lf false -il 2 -f true "|pPlane1|pPlaneShape1";
// Result: initialShadingGroup //
allConnectedMentalrayShaders "initialShadingGroup";
manipMoveValues Move;
toolPropertyShow;
changeToolIcon;
uvEntryFieldScriptJob;