Notifications
Clear all

[Closed] select to get items,, using OR function

i have sphere01 and sphere02

for this i want to select object with name shpere01 if its not in the file, then the selection with script should do sphere02 if this is not present to it should get select for 3 and next 4, like that 6 items, with same sequence numbered…

i wrote,

select $Sphere01 or select $Sphere01

how to do this, does i have get write if else statement, for these, if do…, how??

2 Replies
(
    -- create 6 Spheres
    for i = 1 to 6 do
    (
        Sphere radius:5 pos[i*10, 0, 0]
    )

    -- select first available from Sphere01 to Sphere06
    for i = 1 to 6 do
    (
        local oSphere = execute("$Sphere0" + (i as String))

        if (isValidNode oSphere) do
        (
            select oSphere
            exit
        )
    )
)
  • Enrico

thank you very much SyncViewS, your script works, good,. really i am happy to get good response from cgsociety website, for learning and solving things with max scripting, , all are very cooperative,