View Full Version : scene objet txt list
loran 09-15-2011, 04:27 PM hi people,
I want to export a object list of the scene in a text file. Anyone ever done this?
thank you
|
|
miauu
09-15-2011, 04:56 PM
(
local infoFileSavePath = (GetDir #export)
local checkInfoFile = infoFileSavePath+"\Statistic.txt"
if doesFileExist checkInfoFile then
infoFile = openFile checkInfoFile mode:"at"
else -- if infoFile does not exist - create it
infoFile = createfile (infoFileSavePath+"\Statistic.txt")
for o in objects do
format "Name: %\n" o.name to:infoFile
flush infoFole
close infoFile
)
The file with name Statistic will be created in max "export" folder.
denisT
09-15-2011, 04:59 PM
(
local infoFileSavePath = (GetDir #export)
local checkInfoFile = infoFileSavePath+"\Statistic.txt"
if doesFileExist checkInfoFile then
infoFile = openFile checkInfoFile mode:"at"
else -- if infoFile does not exist - create it
infoFile = createfile (infoFileSavePath+"\Statistic.txt")
for o in objects do
format "Name: %\n" o.name to:infoFile
)
The file with name Statistic will be created in max "export" folder.
don't forget to flush and close the file stream
miauu
09-15-2011, 05:19 PM
Oh, yes.
This snipet is from one of script that i.m working now, and the close, flush and gc() are at the bottom of the script(about 100 lines below). :)
The above code is updated. :)
DaveWortley
09-16-2011, 09:06 AM
Why do you need to Flush before closing? Doesn't Close Flush anyway?
From maxscript help....
flush <filestream>
Ensure all output to file is on disk, flushes the memory buffers.
close <filestream>
Flushes the memory buffers and closes the file
loran
09-16-2011, 09:42 AM
Thank you guys!
PiXeL_MoNKeY
09-16-2011, 02:48 PM
If you don't want to open the file first you can also use getMaxFileObjectNames (http://docs.autodesk.com/3DSMAX/14/ENU/MAXScript%20Help%202012/files/GUID-624D3D05-B15D-4A97-9F15-DA35CDB0DDD-2016.htm#SECTION_0EFE0CA1363A4654B5E8E11C3816F0E0) max_filename_string> [ quiet:<bool> ], to get the list of object names.
-Eric
CGTalk Moderation
09-16-2011, 02:48 PM
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.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.