Script Select Object by Name

 From:  Michael Gibson
8259.2 In reply to 8259.1 
Thanks MindSet, I'm glad you like MoI!

To select an object by name in a script, you'll need to loop through all objects looking for the one with the .name property that you want.

For example here's a shortcut key script that will select objects with a name of "objA":

<script>
script: var objs = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); if ( obj.name == 'objA' ) obj.selected = true; }
</script>

Also note that you can select an object by a typed in name without using script by pushing the tab key to put focus in the XYZ control and then type in the name and push enter. You can also use wildcard characters like typing in obj* will match anything starting with "obj".

- Michael