Query ordered component selection?

Query ordered component selection?

Anonymous
Not applicable
480 Views
2 Replies
Message 1 of 3

Query ordered component selection?

Anonymous
Not applicable
I'm trying to create a script that takes into account the order of which components are selected. However when you assign multiple components to an array via "ls -sl" they are automatically assigned in numeric order rather than selected order. How would you go about assigning the first selected component to array, so on and so forth?

In 2012 i guess there is a flag now in ls that does this, but i need to make this script work for earlier versions as well.
0 Likes
481 Views
2 Replies
Replies (2)
Message 2 of 3

Cagetron
Advocate
Advocate
The only thing I can think of is to try and use the scriptJob command with the -event flag. You might be able to make a script job that builds up an array every time the "SelectionChanged" event occurs. That way the array is getting built up as components are getting selected instead of trying to get the array after everything has been selected. Maybe use the appendStringArray mel script to build it up. Not entirely sure if it would work but it's worth a shot.
0 Likes
Message 3 of 3

weshowe
Collaborator
Collaborator
The data you want exists in the API as MSelectionList. I do not know a way in MEL to access that list, though I have used it from C++. You should be able to access it from Python using the MEL command python().

I haven't tested that, and I am not a Python user, but there are examples I saw using Google. That is where I would start if I needed that functionality.

<* Wes *>
0 Likes