Duplicating Multiple views Multiple Times At Once


I am trying to get the attached script to duplicate multiple views multiple times in one go. It will duplicate a single view as many times as you would like but as soon as i select more that one view it will not work.

I believe the problem is this area is where i convert the list into a list of strings going in to the python script here:

The python script does not show null when only choosing 1 view to duplicate having no clue with python unsure if the issue is within the code.

Hopefully this all makes sense and thank you in advance in taking a look. If there is any more info i can give please let me know.

Duplicate Views.dyn (26.1 KB)


The problem is that your Python Script cannot manage the input you are giving it. You are passing a string within three lines, not a list of three strings, thus the script is not founding any view which name is :

Room 405 - Plan View
Room 600 - Plan View
Room 601 - Plan View

returning the default value of foundView in the script, aka null.

Try replacing the script by this one, it will be able to manage lists of strings :slight_smile:

import clr
# import Document Manager
import RevitServices 
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIDocument
import Revit
from Autodesk.Revit.DB import *

dataEnteringNode = IN
vName = IN[0]
foundView = []

coll = FilteredElementCollector(doc)
views = coll.OfClass(View)

for v in views:
	view = UnwrapElement(v)
	for s_vName in vName :
		if v.Name == s_vName:
OUT = foundView
#For more information refer to RBG Wiki or email me (ctrl + click link): daniel.woodcock@robertbird.com

Also remember to change the input so it becomes a list :

[0] Room 405 - Plan View
[1] Room 600 - Plan View
[2] Room 601 - Plan View

This technique should work to split the string : ( "\n" is the way to indicate a line break) , but i think the best way is to definitely not use the Convert List into List of Strings with Line Breaks custom node …

1 Like

Thank you so much it works now ive been trying to learn C# so i can go in to visual studio but dynamo is so much easier. One day coding will click haha.

Dear Matthew,

Is it possible that you send me the script that is working for you.

I’m trying to get the script running but i have a problem with the duplicate options, as dependent, with detailing and duplicate. See picture below;

Also i have problem with the last step from this topic to rewrite a part of the script and replace the convert list into list of strings with line breaks.

please let me know


Have a play with this. I have been messing around with it but just tried it and it works.

Duplicate Views.dyn (29.1 KB)