Well, I don't know that it helps much for your particular situation, but you might use the tempfile system in Python to get a file handle and save to that instead. It still goes to a file, but that file is a temporary file that will get deleted later.

As far as I can tell, there's no way to intercept the raw string of the cmds.file operation before a save occurs. There is the MFileIO class in the API, but that only gives you access to a limited subset of what's available in cmds.file, so I don't see that as being a real help.

Now, depending on what you're trying to do, you *could* simply parse the scene data itself, and store that in memory, and then you could do whatever you want with it. At that point you're basically writing a custom exporter that could output to a string, or whatever you want to do with it.

On 3/14/2015 5:23 AM, Marcus Ottosson wrote:

Hi all,

I’m looking for a way to export similar to |cmds.file(exportSelected=True)| but have the result of that export remain in memory, so that I can parse the output.

I’d like to go from this.

 1. Export ascii to disk
 2. Read ascii from disk
 3. Parse ascii

To this.

 1. Export ascii
 2. Parse ascii

It isn’t solving any burning issue at the moment, it’s more of a curious enquiry. :) Any techniques are ok; no limits.

Any ideas?

​
--
*Marcus Ottosson*
[email protected] <mailto:[email protected]>
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODq-yy0Dho8x-uUomgvRJv7epsXcYskqg7yGq0G6DdewA%40mail.gmail.com <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODq-yy0Dho8x-uUomgvRJv7epsXcYskqg7yGq0G6DdewA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.



---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com

--
You received this message because you are subscribed to the Google Groups "Python 
Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/550483E9.8040907%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to