How to keep existing room numbering on by following its Unique ID

Hello all,

I am quite noob with Dynamo and I am currently trying to make an order room numbering script (on every Level from 001-upwards) that locks room number by its Revit Unique ID.
This would help me to preserve the existing numbering on the model in case I have to delete a room that is no longer there and add new rooms somewhere else.

Example:

Level 0
Room 001 - Revit Unique ID 844123
Room 002 - Revit Unique ID 844124
Room 003 - Revit Unique ID 844125 (to delete)
Room 004 - Revit Unique ID 844126
Room 005 - Revit Unique ID 844127
Room 006 - Revit Unique ID 844128

Room 007 - Revit Unique ID 844210 (new room)

Alternatively:
That Room 007 can take the place of the old 003 so we keep no gap on the room numbers.

I apologize for the messy explanation and apreciate any good input.

Thank you in advance.

Best,
Pedro A.

Can you clarify what you want the end result to be? It sounds like you’re asking for two conflicting things:

  1. Room numbers locked to the guid so that there are no duplicates or replacements.
  2. Allowing new rooms to take over deleted room numbers.

Hey Nick,

Thank you for your quick help.
I forgot to mentioned that I am working on an existing script from a colleague that is not longer working with us.
Basically the script as it is built, it organizes from 001-xxx the room numbers. The problem is when we delete one or more rooms (example: room 009 - red marked in the following picture):

it will renumber again the numbers from 009-upwards as the bottom plan shows on next post.

Is there any smart way to prevent this from happening in dynamo (like a “lock” over existing room numbers?)

PS: the script have to work on different Revit models.

Hope it gives meaning this time.
Thanks again for the help.

Cheers,
Pedro