Batch renaming sub-lists of spaces

Hello,
I am trying to rename renumber MEP spaces in groups, which may depend on their level, their name.
One desired outcome would be to prepend the string “L1_” to the number for all spaces placed on level 1 etc. Also I would like to replace certain strings with others in spaces name, e.g. replacing “Kitchen / Living” with “KL”.

I would assume this could be easily done, but could not find some straight-forward method online.

Thanks,
Andrea

Are your levels named nicely? Level 1, Level 2, Etc.

Not as nicely as that, but they follow a schema (not set by me!), i.e. Building-level-FinishedFloorLevel.
So I would have C01Z-L00-FFL, C01Z-L01-FFL etc.
I would like to extract L00, L01 etc. and prepend it to space names.

Thank you

Well thankfully we can account for that! Here is an example using dictionaries to create the specified prefixes. Dictionaries are fairly high level, but they will achieve what you want. This example should get you most of the way there. You will have to adapt to your workflow though.

and here is the graph.
groupingRoomsWithPrefixes.dyn (15.0 KB)

1 Like

I am very bad with list management / matching, so I used a custom node (IndicesOf) I found online: http://plevit1.blogspot.co.uk/p/enjoy.html

However, it returns an empty list…

Use group by key in my example above.

@john_pierson first of all thank you for that.
However, it seems to be a bit complicated to implement, as my model contains a number of additional levels (other than those - i.e. C01Z-L00-FFL, C01Z-L01-FFL - the spaces are associated to.) that are located in-between those.
Your nodes create a dictionary entry for each level that exists in the model, so the only way would be to sub-select levels based on their names?

Maybe just make a list of preferred level names?

Yes, trying to do that. However I am struggling to make my sub-list become the source for new dictionary keys. Isn’t there a quicker way to perform an excel-type of “index(match)” operation?

@john_pierson I think I’ve found a solution here: Dynamo - Rooms renumbering with a twist

2 Likes