Pymel command for returning components in order they were selected

Hi,

I can’t remember what was the command that I need to enter when I want to get my selection list in order in which the components were selected.
To make it a bit clearer, I selected some vertices and when I enter pm.selected(flatten = True) I don’t get the vertices in order I selected them. I’m pretty sure that there needs to be a command before that tells Maya to store the selection correctly.

The flag you are looking for is orderedSelection.
But before you can retrieve an ordered component selection you have to turn the option on in Maya preferences:
Preferences > Selection > Track selection order
or
cmds.selectPref(trackSelectionOrder=True)

cmds.ls(orderedSelection=True)

Thanks capper. That was exactly what I was looking for. I knew that there was something that needs to be turned on but I would probably remember what it was in a couple of days when I wouldn’t need it any more.

http://mayastation.typepad.com/maya-station/2011/10/retrieve-polygon-components-in-the-order-they-are-selected-.html

Yup! Seems to be a feature of 2012+ though. Worth noting. :slight_smile:

I’m using 2014 so it is worth something. :slight_smile: