Trouble to combine and duplicate a List of elements

Please Help!
I’m trying to duplicate some elements (floorplane views), one for each level.
The number of times that each element (floorpane view) is suposed to be duplicated is given by a list from excel.
So for level P0, that floorplanview must be duplicated 16 times… for level P1, 13 times… an so one.
I can’t find a way to use the clockwork node View.Duplicate in just one Run, without going through a manual process.

After burning my head with the problem I’ve give up. Can some one help, please.
I thint that this is really easy for people used to combine lists.

Please see Atached image.

Hi @Jose_Goncalves

By making a little alteration of the code inside the view.duplicate node, you can precise the amount of times you’d like to duplicate a view. The other thing a did is use list.sortbykey to make the list of plans and the list of amounts match . I hope this helps:

import clr
from Autodesk.Revit.DB import *
import Autodesk

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
views = UnwrapElement(IN[0])
amounts = IN[1]
elementlist = list()
dupopt = Autodesk.Revit.DB.ViewDuplicateOption.Duplicate

for view,amount in zip(views,amounts):
	i = 0
	while i<amount:

		newview = view.Duplicate(dupopt)
		i += 1

OUT = elementlist

Thank you Mostafa.

Fantastic !!!

You problably don’t believe, but I’ve spent all day trying to achive this!!!

Finally I did it Thanks to you.


This should work too…


Thanks Vikram.
Sorry it didn’t work, I did try your defenition and simply don’t know how can it be diferent from mine and how did you get your results, cause i’ve did exactly the same with diferente results.
With 4 levels and the same amount of repetitions for each level, i’ve got as result that the all group of levels are repeated 2, 3, 4, and 5 times.
When I wanted that level 1 to be repeated two times, level 2 tree times,… and so one like you’ve got. But with my definiton is diferent.

The lacing of List.OfRepeatedItem must be set to longest


All Right!!! Now it works!
Thanks again Mostafa and Vikram.
I was starting to get crazy with the differente results for the same thing.


1 Like

Hi all.

This topic makes me so excited. And i would like to ask you one more thing. If i have one parameter as view purpose with 3 options : Modeling, Documentation and Coordination. How i can arrange the duplicated views of floor plan to right view purpose automatically? Because after duplicating views i have to change the value of view purpose (or another parameter) manually

Thanks for your help!

Hello lysonthien, I’m working on this subject, trying to creat floorplan views from excel. The process I went was to create some Shared parametes and assign them to the views.
After duplicating the floorplanviews, I have assign them a proper name from a list, and inclued also some grouping parameters. So when a view is copyed with the python scrip like the one on the top, you just have to set the parameters you chose from the output of the python script. See the picture below. (in the picture it seams that it does not work but it does, i’ve just didnt run it. I hope I’ve understud the question.

1 Like

@lysonthien If you want to change the Discipline parameter you could try this…
ViewDiscipline.dyn (11.2 KB)


@Vikram_Subbaiah Thanks for your help. Actually i’m working in structural discipline from the beginning. The thing i want is to arrange duplicated views into right place on project brownsers based on view purpose. Honestly your code is so creative and i can adapt for my purpose. Thanks in advance!

@Jose_Goncalves You did it and completely excact what i want. Thanks for your effort!

Hi, just a quick question about this modified code. Do we Edit… the node of the python script for View.Duplicate and just copy and paste your script or do we copy and paste to the end of what is already there? :disappointed_relieved:

@m.yasemin you can just copy paste the whole thing in a new python script node

Ok thanks, I’m getting the error that my selected view is not iterable , I tried the node String from Object before inputting it into IN[0] but now my result is an Empty List.

Sorry but I cannot open the screenshot of what you are inputting :cold_sweat: so if you can please define what I should IN[0] (which looks like a list?) and also IN[1] which seems like a list of the view name… I have a List.OfRepeatedItem (set to Lacing: Longest …view name listed the number of times I want it) and also a List.Count (#) so which one should be the input?

if it says not iterable it means that you’re giving a sigle element where a list is expected.
First input is a list of views, second input is a matching list of integers that give the amount of duplicates for each view .

Check out Jose_Goncalves’s screenshot. It can be zoomed in and shows the correct inputs

Hi There,
I’m having trouble using the adjusted code to get the amount of duplicates using Revit 2018 and a newer version of dynamo 1.3. It’s fairly frustrating that the code is somewhat different from version to version. I believe this is the problem I’m having. Is there any chance you could point me in the right direction when determining what I should look for when updating the code?

Knowing the error you get would be nice… also you’re missing the last few lines of code…



I’ve actually found a work around with standard nodes however it would be nice to understand this error.