PRINT selected objects name

PRINT selected objects name

Richardd013
Enthusiast Enthusiast
2,854 Views
3 Replies
Message 1 of 4

PRINT selected objects name

Richardd013
Enthusiast
Enthusiast

Hi is there a way to print the list of selected objects in Maya using python or MEL?

I'm looking for a way to automate this instead of copy-pasting them manually cause it'll save me some time.

I need to put the list of the objects in excel later on.

 

Thank you!

0 Likes
Accepted solutions (1)
2,855 Views
3 Replies
Replies (3)
Message 2 of 4

brentmc
Autodesk
Autodesk

The MEL command to list the selected objects is:

ls -sl

Brent McPherson
Principle Engineer
0 Likes
Message 3 of 4

Richardd013
Enthusiast
Enthusiast
that worked! but how to make it printed verticaly instead?
0 Likes
Message 4 of 4

brentmc
Autodesk
Autodesk
Accepted solution

In that case you will need to loop over the selection and print each item followed by a newline:

 

{
    string $obj;
    string $sel[] = `ls -sl`;
    for ($obj in $sel) {
        print($obj + "\n");
    }
}

You can do a lot in Maya with some simple programming skills so you should look for some introductory tutorials on MEL to get started.

 

Brent McPherson
Principle Engineer