10212 : predecessor or the successor of a particular timeitem on a row?

Question

is there an efficient method to get the predecessor or the successor of a particular timeitem on a row?

Answer

TimeItems has an index property so accessing the time item in front in the layer list is easy:

prevtimeitem=timeitem.Layer[timeitem.Index-1] // Note: you will want to check Index>0 first

But I guess your question is how to find the time item closest to another based on Start or Stop. Currently we have no faster way in doing this than iterating the layer and looking for the best candidate….

 

Leave a Reply