Mel Script for Exporting Specific File Type?

Mel Script for Exporting Specific File Type?

dangertaz1
Advocate Advocate
1,737 Views
6 Replies
Message 1 of 7

Mel Script for Exporting Specific File Type?

dangertaz1
Advocate
Advocate

I'm trying to make some shelf buttons that send out selected geometry as .IGS, .FBX and .STL.  3 Buttons, 3 different scripts.

 

When I use Echo All Commands all I can come up with is:

ExportSelection -options "" -typ "IGES_ATF Export" -pr -es;

 

But it doesn't quite work.  The geo is exported as the last file type that was used, not .IGS specifically.  Ideally, this save window would already be set to .IGS, not FBX.

Capture.PNG

 

Any ideas on what's wrong with my mel?

0 Likes
1,738 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable

The file command is what you're after. You can find out how to use it by looking at the documentation.

0 Likes
Message 3 of 7

dangertaz1
Advocate
Advocate

Thank you for the response Rallion.

I looked over the documentation and attempted to script it again and again, but no luck.

 

This bit from the documentation is interesting:

-type(-typ)stringcreatequery
 Set the type of this file. By default this can be any one of: "mayaAscii", "mayaBinary", "mel", "OBJ", "directory", "plug-in", "audio", "move", "EPS", "Adobe(R) Illustrator(R)", "image" plug-ins may define their own types as well.
Return a string array of file types that match this file.

 

FBX, .SPF and .IGS are not listed as supported default file types.  

 

This may be a limitation that needs a much longer script to solve?

0 Likes
Message 4 of 7

Anonymous
Not applicable

The key here is "plug-ins may define their own types as well." - IGS is not a native maya file type, although the plug-in (I believe) comes with Maya. So the file command documentation doesn't specify what the "type" is for IGS.
Looking at the output from your first post, the type seems to be "IGES_ATF Export" for this filetype.

Can you please post the code you've written? It may help to troubleshoot your problem. 🙂

0 Likes
Message 5 of 7

dangertaz1
Advocate
Advocate

 

I believe .IGS only works with surfaces, so I am converting my poly mesh to SubD and the SubD to NURBS before I try to export.

 

Here is one script, it causes a crash when used on polys or NURBS:

 

file -es -type "IGES_ATF";

 

this one crashes too:

 

file -force -options "" -typ "IGES_ATF" -pr -es

 

This one produces an error message:

 

file -es -type "IGES_ATF EXPORT";

// Error: line 1: Invalid file type specified: IGES_ATF EXPORT //

 

 

This one works for FBX:

 

file -force -options "" -typ "Fbx" -pr -es

 

0 Likes
Message 6 of 7

Anonymous
Not applicable

Not sure why that would be crashing out when it works for FBX. Maybe just keep trying different option combinations? *shrug*

0 Likes
Message 7 of 7

kevin.picott
Alumni
Alumni

There is definitely some bad behaviour in there. I was able to reproduce the crash but not consistently. I'm filing this in our internal bug tracker for investigation.

 

The error message seems to come from the fact that the file type is case sensitive. This works:

 

file -es -type "IGES_ATF Export";

 

Have you tried using the File menu Export Selection... entry? That seemed to be more stable for me. You can copy-paste the command it generates afterwards for scripting.



Kevin "Father of the DG" Picott

Senior Principal Engineer
0 Likes