Modification Required in existing Dynamo Script

Looks to me that you may use similar logic to the Renumber Rooms graphs: Renumber rooms by spline - Not working consistently - #16 by truevis