How to rename multiple Revit views

Hi all,
I’m brand new to Dynamo but have been using Revit for a few years now. I typically am the setup/organization guy for all project views, but haven’t quite figured out exactly the best ways yet but this is what i have going on right now on an active project.

I need to establish 4 cropped down “zones” for every level of my building, for HVAC pipe & duct to create my shop drawings on. So what i have been doing is creating a “Master” view on which all my annotations go and then dependent views for each zone as well as my duct or pipe legends, giving me 8 dependent views for each “Master”.Then each view can get put on the sheets for the specific zone to create my shop drawings. I want to be able to take a newly created set of dependent views though and then use Dynamo to rename them to my final name format rather than doing it manually one by one. This is what i have come up with thus far.

So this seems to work for the one string replacement that i have connected currently but i want to be able to build in all 8 scenarios (one of each of the two different scenarios are shown above) and then be able to run the script one time to turn my default name list to my final renamed list.

Example Default List
L10 - PLAN - DRY - SHEET - MASTER - Dependent 1
L10 - PLAN - DRY - SHEET - MASTER - Dependent 2
L10 - PLAN - DRY - SHEET - MASTER - Dependent 3
L10 - PLAN - DRY - SHEET - MASTER - Dependent 4
L10 - PLAN - DRY - SHEET - MASTER - Dependent 5
L10 - PLAN - DRY - SHEET - MASTER - Dependent 6
L10 - PLAN - DRY - SHEET - MASTER - Dependent 7
L10 - PLAN - DRY - SHEET - MASTER - Dependent 8

Example Final List
L10 - PLAN - DRY - SHEET - Z1
L10 - PLAN - DRY - SHEET - Z2
L10 - PLAN - DRY - SHEET - Z5
L10 - PLAN - DRY - SHEET - Z6
L10 - PLAN - DRY - SHEET - Z1 - LEGEND
L10 - PLAN - DRY - SHEET - Z2 - LEGEND
L10 - PLAN - DRY - SHEET - Z5 - LEGEND
L10 - PLAN - DRY - SHEET - Z6 - LEGEND

I think i could create the string replacement setups for each scenario and then just connect/disconnect each to the set parameter by name node as i run through each of the 8 scenarios but i was hoping maybe someone might know a way to run them all together simultaneously. Any help is greatly appreciated!!

you can see topic https://forum.dynamobim.com/t/write-assembly-name-to-assembly-detail-view/24520

Hi @ryan.saluzzi,

You can make an IF statement if you want rename all views at one time.

x==1?
"Z1":
x==2?
"Z2":
x==3?
"Z5":
x==4?
"Z6":
x==5?
"Z1 - LEGEND":
x==6?
"Z2 - LEGEND":
x==7?
"Z5 - LEGEND":
x==8?
"Z6 - LEGEND":
"";

Hi @Alban_de_Chasteigner,
Can this work for multiple levels though? The L10 names was just an example for one level (10th floor) and i will need to replicate this across all floors up to L37 (37th floor). It looks like you just typed in the example names i gave, unless i’m not understanding exactly how you created your script. I definitely don’t want to type all my view names in for each floor

Yes it will work for all the levels if “Dependent 1” is always equal to Z1, etc, if “Dependent 5” is always equal to “Z1 - LEGEND” and so on.

@Alban_de_Chasteigner so what do i use in place of the code block for the view names then to get it to pull in my list of view names from my Revit project browser?

View Type from archilab package is what you need

This is what i came up with, can you take a quick look and see if this all looks right before i run it?

There is a mistake in the If statement.
There is a small “x” and a capital letter “X”

Cool thanks for your help @Alban_de_Chasteigner, I appreciate it.

You’re welcome.
Let me know if it works.

This is what i get, not what i was expecting at all. Any ideas on how i can fix this?

The last String.Remove must have a value of -1 not 1.