DATSort is a windows application for sorting the elements
in an
LDraw .DAT, .LDR or .MPD file by color, part number or X-Y-Z coordinates.

When creating .DAT files, I often try to sort the elements
to make
it easier for the builder to follow the steps. LEGO™ instructions
typically build a model from bottom to top, back to front, left to
right. Now, with DATSort, you can create your .DAT file using LDraw, MLCad,
etc. and afterward sort the elements in the file according to your own preference.

You can select any elements in the file to be sorted, or tell
DATSort
to sort them all. You can sort by X-Y-Z coordinates, by the part
color, or by part number. You can set the sort to be ascending or
descending, which means you can independently set the coordinate sort
to work from bottom to top, top to bottom, left to right, right to left,
etc. etc.

Once the file is sorted, you can save it in place of the unsorted
one,
with an option to backup the original file.