View Full Version : Selection by name of groups only
11-30-2012, 11:15 AM
I've been struggling for a while with what I hope is quite a basic thing to do. I'm trying to select any groups in a scene with a certain name to use in my mel script.
what I'm doing at the moment is this
if (`objExists GEOMETRY`)
select -r "*GEOMETRY" ;
rest of the script...
The trouble is I'd like to only select groups called GEOMETRY and not any old objects that have that in the name for safety reasons. Ideally the script then performs actions on the hierarchy within the selected GEOMETRY groups. :)
If I take away the "*GEOMETRY" and replace it with just "GEOMETRY" it warns me that there's more than one thing called that and stops.
I hope this makes sense as I'm not greatly experienced with scripting, but just trying to piece things together with lots of forum searching and googleing.
Thanks for any advice
You can get a bit more control over what you add to your list using ls with the type keyword.
ls -type "transform" "*_geometry";
and so on...
You might rewrite your code something like this...
geo_groups = cmds.ls('*_geometry', type='transform')
string $geo_groups = `ls -type "transform" "*_geometry"`;
11-30-2012, 02:29 PM
thanks very much for the quick reply. I'll give these a go. :)
I just realized it may not have been clear to some people that my last post contained both python and mel examples, to demonstrate how it could be done in python _or_ mel, in that order. Sorry for the confusion.
12-01-2012, 04:08 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.