[Closed] Selecting objects by name?
i want to write a for loop which chooses sertain objects according to their name … example
i want to select all objects will name box like box01 box02 box 03 … but if their is sphere01 it will not be selected in the loop …
thx in advance
select (getNodeByName "Box01") -- selects only Box01
or…
select (execute ("$Box*")) -- selects Box01, Box02, BoxTop, BoxEtc
or…
for o in objects do (
-- selects Box01, Box02, BoxTop, BoxEtc, without using an execute()
if (matchPattern o.name pattern:"Box*") do ( selectMore o )
)
from either of those it’s just some string manipulation to get the ones you want
Hi dieselll,
take a look at “Pathname Literals” in MaxScript Reference, probably you don’t need a loop.
aw (late)
Richard, you forgot:
select (for item in $Box* collect item)
- Enrico
yea it really works but unfortunetly i cant integrate it with the rest of my script …
this is the script i am working on now
for i in selection do
(
addModifier i (uvwmap maptype:4 MapChannel:2)
)
for o in getclassinstances VrayMtl do
(
try
(
mtlBrowser.browseFrom #selected
o.texmap_diffuse.coords.mapchannel = 2
Showtexturemap o o.texmap_diffuse on
)
catch()
)
and i want to select objects by name instead of selecting it by mouse … can anybody help me plz
Naw, that’s the same as…
select (execute ("$Box*"))
more to the point… your line there collapses to:
select $Box*
The only reason for the execute is if you need things named dynamically, which requires the string manipulations implied
Just replace…
for i in selection do
…with…
for i in $Box* do
?
Edit: … which of course you already got answered in:
http://forums.cgsociety.org/showthread.php?p=5860417#post5860417
Try not to post the same question to multiple threads