Python add-in - get list of selected features in order selected

Discussion created by recurvata on May 6, 2014
Latest reply on Jul 20, 2016 by chen0315
I'm trying to create a python addin that will fill a list with the objectids of features in the order they're selected. This is so I can then add incremental numbers to them in that order. Trying to automate lot numbering, basically. The order of the objectids themselves doesn't necessarily correspond to lot order, so can't just sort them. The idea is that the user would select the features, then click a button to add the lot numbers.

I can add numbers using Chris Fox's UniqueIDSort script, but there's no existing field to sort on. Main problem is retrieving the objectid when the script hasn't run yet. Tried using onEditorSelectioChanged() under Extensions, which presumably could just listen for the event and build the list, but don't see documentation on how to check if a feature has been selected or unselected. Any help much appreciated.