PDA

View Full Version : find all object


Skylab82
06-25-2010, 12:44 PM
Hello,
how can put on a file .txt all the geometry objects present on my scene?
Thanks

denisT
06-25-2010, 01:55 PM
Hello,
how can put on a file .txt all the geometry objects present on my scene?
Thanks

it puts all geometry object names in alphabetically sorted order in text file:

(
file = (getdir #temp) + "geo_object_names.txt"
if (ss = createfile file) != undefined do
(
list = for node in geometry collect node.name
sort list
for name in list do format "%\n" name to:ss
flush ss
close ss
)
)

Skylab82
06-25-2010, 02:46 PM
i have try this but he don't work :curious:

it puts all geometry object names in alphabetically sorted order in text file:

(
file = (getdir #temp) + "geo_object_names.txt"
if (ss = createfile file) != undefined do
(
list = for node in geometry collect node.name
sort list
for name in list do format "%\n" name to:ss
flush ss
close ss
)
)

denisT
06-25-2010, 02:54 PM
what is not working? it can't be not working.

(
delete objects
teapot()
box()
sphere()

file = (getdir #temp) + "geo_object_names.txt"
if (ss = createfile file) != undefined do
(
list = for node in geometry collect node.name
sort list
for name in list do format "%\n" name to:ss
flush ss
close ss
edit file
)
)

Skylab82
06-25-2010, 03:09 PM
i have this error


-- Syntax error: at ), expected <factor>
-- In line: )

denisT
06-25-2010, 03:22 PM
probably because you aren't coping whole script from "code" area and missing last ")" symbol.

Skylab82
06-25-2010, 05:25 PM
ok,
i was wrong because I tried to run the script under maxscript listner.
Is possible save the Hierarchy of My Objects?

probably because you aren't coping whole script from "code" area and missing last ")" symbol.

denisT
06-25-2010, 05:53 PM
Is possible save the Hierarchy of My Objects?

it's possible...
with no sorting for all objects in the scene:

(
fn collectNames node pre:"" ss: =
(
format "%%\n" pre node.name to:ss
for n in node.children do collectNames n pre:(pre + "\t") ss:ss
)

file = (getdir #temp) + "object_names.txt"
if (ss = createfile file) != undefined do
(
for node in objects where node.parent == undefined do collectNames node ss:ss
flush ss
close ss
edit file
)
)

CGTalk Moderation
06-25-2010, 05:53 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.