Select many objects by name

Unhandled Perfection
Unhandled — Maya
2 min readFeb 10, 2018

Steps using the outliner

Step 1) Open Outline

Window > Outliner

Step 2) Expand all parents and groups

You can do this by Shift + Clicking on the top level node.

Step 3) Add search filter

Now we reduce the objects by starting a search. ex: bldg_window_pillar_*
The * means match anything after.

Step 4) Select all

You can now select all the elements shown in the outliner.

Steps using MEL

Step 1) Open the mel editor

Window > General Editor > Script Editor

Step 2) Run code

There are two commands you can run

select -r "bldg_window_pilar_*"

Steps using advanced MEL and Python

Step 1) Open the mel editor

Window > General Editor > Script Editor

Step 2) Run code

You can now dynamically create the list of object names to select.

This next example will select objects with name bldg_window_pillar_a, bldg_window_pillar_b, bldg_window_pillar_c.

python("cmds.select(['bldg_window_pillar_%s' % n for n in ['a','b','c']])");

This next example will select objects with name: bldg_window_pillar_1, bldg_window_pillar_2, bldg_window_pillar_3.

python("cmds.select(['bldg_window_pillar_%s' % n for n in range(1,3)])");

Conclusion

To learn more about what you can do with MEL select see http://download.autodesk.com/us/maya/2010help/CommandsPython/select.html.

--

--