Object name search

Hi I have objects with random names for example box1-22-r or box-23-r

i am trying to create a script that looks for the "22" in the name and selects them all
so if i have box1-22-r, bag-22-r it will select them and not select the other objects
like searching for string name "22"

this is what i came with so far but no luck

(
waveName = "22" as string
select (execute ("$" + waveName + "*"))
)
thanks in advance

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Mrjacks2o's picture

I figured it out

I figured it out guys.
-------------------------------------
deselect $*
for i in $*22* do selectmore i
--------------------------------------

thank you

miauu's picture

.

This is the proper way to do it:

(
	waveNameStr = "22"
	objsToSelArr = for o in objects where (matchPattern o.name pattern:("*"+waveNameStr+"*")) collect o
	select objsToSelArr	
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.