find string

i used findstring for select same name object

example)
there is obj1 obj2 obj3 obj4 obj5 obj1 objs

in there , i would like to select obj1 name only
but if i use findstring function ,
that fuction collect all obj* objects

how can i select same name object with findsting fuction ?

Comments

Comment viewing options

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

try this thing fellafn

try this thing fella

fn selectObject theName=
(
select (for i in objects where (matchpattern i.name pattern:theName) collect i)
)
selectObject "obj1"
 
PS: obj1 refer as name of obj not direct obj

....remember to add "" before and after the name object...but if youre using edit.text you dont need that

barigazy's picture

...

In most cases you need to add

"*"

except you search for exact name.
Also "ignoreCase" argument can be important.

barigazy

barigazy's picture

Use finditem


objNameArr = for n in $Obj* collect n.name
--#("Obj5", "Obj4", "Obj3", "Obj2", "Obj1")
select (getnodebyname objNameArr[(finditem objNameArr "Obj1")])

barigazy

dussla's picture

ok thank you pls , can you answer same layer

ok i see same object find way thank you

in layers

obj1 obj2 obj3 obj4 layers

how can i find same obj1 layer ?

barigazy's picture

Are you want to find out in

Are you want to find out in which the layer is obj1?

barigazy

dussla's picture

yes

yes
0. layer name in text box
1. collect layer name
2. current layer layer name in text box
or turn on layer name in text box

barigazy's picture

If you want to know obj layer

If you want to know obj layer name just use

$Obj1.layer.name
--or if you want to collect objs layer names (unique one)
layerNamesArr = #()
for o in $Obj* do appendifunique layerNamesArr o.layer.name

barigazy

dussla's picture

wow ,barigazy thank you

always thank you
you are my sunshine
if you help me , mabey i can't do anything
you are best kindly person

Comment viewing options

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