Trouble to combine and duplicate a List of elements

IT DID, IT DID WORK !!!
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.

:slight_smile:

This should work too…

2 Likes

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

2 Likes

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

:slight_smile:

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)

3 Likes

@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…

Sure,

error%20python%20codeerror%20python%20code%202

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

Thanks

Pretty sure it is because you’re trying to iterate over the integer “amounts” which is your input number IN[1]…

Try this code instead (removed a little).

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk

clr.AddReference('RevitServices')
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

TransactionManager.Instance.EnsureInTransaction(doc)
for view in views:
	i = 0
	while i<amounts:
		newview = view.Duplicate(dupopt)
		elementlist.append(doc.GetElement(newview))
		i += 1
TransactionManager.Instance.TransactionTaskDone()
OUT = elementlist
2 Likes

Great, thank you very much.