Hi hamkoo,
re:
> How to select an object with object-name using script?tks!
There are a couple of different ways, one way is to just loop through all objects looking at the object's .name property for the one you want and then set its .selected property to true like this:
script: var objs = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); if (obj.name == 'testname' ) obj.selected = true; }
There is also a selectNamed() function you can use that does that for you and also supports "wildcard" characters like * and ? :
script: moi.geometryDatabase.selectNamed( 'testname' );
Also if you type in the object name into the XYZ input box it will run the select named function on that name. So for example to select all objects that start with 'test' push the Tab key to put focus in the XYZ input box, type test* and push enter and now all objects beginning with 'test' will get selected.
- Michael
|