[Closed] Exporting file whose the filename is the mesh's name
Hi there.
I would like to export some meshes automatically, and it would be nice to pass the mesh’s name as the name for the exported file…
Suppose I have a mesh called “YellowCar” (it is a editable mesh). Would anyone know, for example, how to export the mesh as a “YellowCar.3ds” using MaxScript?
Any help would be very appreciated.
Thanks in advance
Note: I don’t want to create a new exporter… I just want to use an exporter from 3dsmax (.3ds, .dxf, .ase, etc…).
Assuming that the mesh is already selected use
exportFile ($.name+".3ds") #noprompt
Have a look at the docs fo its details.
[edited]
One more thing, by default if you don’t specify the path, the file will be exported to the meshes folder.
Hope it helps
Mobeen
Thanks mobeen!
Actually, I’m exporting meshes as .x files (with Panda plugin). The script works fine… The only little problem is that, when I have a texture mapped on the mesh, the .x file is exported to the correct folder, but the texture always is exported to the folder where is the .max file (independently on the specification of the file path).
Thanks again.
Sounds like a bug or “feature” in the Panda exporter. You could follow that export command with a copyFile then a deleteFile to relocate the texture. Something like this:
myDir = "C:\\exportFiles\\"
exportFile (myDir + $.name+".x") #noprompt
[left]copyFile (maxFilePath + $.name + ".tga") (myDir + $.name + ".tga")[/left]
[left]deleteFile (maxFilePath + $.name + ".tga")
[/left]
[left]… or something along those lines. Swapping “.tga” with whatever texture extension the Panda exporter uses.[/left]