PDA

View Full Version : Recreating a polygon model


ctscoville
02-04-2008, 08:53 PM
Is it possible to write a script that will re-create a polygon model? For example, I have a polygon model saved in a maya file. I want to be able to generate a script that will create the same model in a new maya file (just like importing the model, but done through script commands). Is this possible?

~NoMaD~
02-05-2008, 03:55 AM
I've never tried it myself, but in theory it is possible... Here's what I'd try:

Export your model as a Maya Ascii file (.ma) and open it in a script editor... there you should be able to find the part in the script that contains the "Creation of your model"... Mind you... if you have a very complex model, it will be a HUGE amound of vertex point locations... so be prepared to sort though a LOT of info...

Good Luck!

Chris

ashishdantu
02-05-2008, 05:28 AM
hi,

one way to get ur CODE version of ur mesh..

save ur model into a new file and save into MA format.. adn then you can open in wordpad to copy the code ? paste into script editor to execute it ??

or we can write a mel to read this file but i guess we have to do some string formatting after reading each line, before executing this whole string ?

any other ideas ??

Robert Bateman
02-05-2008, 10:35 AM
easiest way is to write a *.obj file to disk then import - you just need the basic fopen/fclose/fprint commands to write the file, then the file command to import.

You could use polyCreateFacet with poly combine if you really want to. However it's really really really really really really slow.

The C++ API is probably the best place to do this kinda thing.

\edit

ignore that stuff. Just use the file command to export your selected model as a maya ascii file, then use the file command again to import. You can even use the import/export menu items from the File menu to do that.

strarup
03-05-2008, 07:49 AM
Hi,

not sure if this is what you are after... but here is a melscript that via mel can recreate and rebuild a polygon object via mel... and save it as a mel script to rebuild it...

http://forums.cgsociety.org/showthread.php?t=559155
hope that helps a bit... :)

edit: requires the polygon object to be selected within the scene... this script can't read the Ma file and extract the object from it... if that was what the question was about... :)


kind regards

Strarup

CGTalk Moderation
03-05-2008, 07:49 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.