@atawk wrote:
.... the order is still matter what i meant is when i select an object using window it doesn't sort out at end with the blocks arrangement.
Then don't select an object using a window. That's exactly why my first routine limits selection methods to only those that put things into the selection set in the order selected as originally requested, but adding the Fence option to the individual-pick method in your description. Maybe mine could be altered to allow selection of a single object in any of those ways, and put it into the selection order, but not allow multiple objects. Is that what you want to do? But why select a single object in a window rather than just picking on it?
If you want to be able to select multiple objects in a window, and you want the positional order to be as it was within such a selection, maybe the routine linked by @pendean at Message 13 will do. When you select multiple objects at one time by Window or Crossing or Lasso, they go into the selection set in -- I forget which -- either drawn order or reverse drawn order. A routine could be made to determine relative left-to-right positions, and put them into a regular row accordingly, but all sorts of questionable possibilities arise. For example, which of these two Circles is farther to the left?

The big one because it extends farther leftward, or the small one because its center is farther left? Blocks with varying insertion point locations relative to their drawn content present similar issues. And what about things that are vertically aligned? Does the order among those matter? Etc., etc.
Kent Cooper, AIA