# Mass Duplicate View revit crash

**URL:** <https://forum.dynamobim.com/t/mass-duplicate-view-revit-crash/22219>\
**Category:** Revit\
**Tags:** revit, dynamo, views\
**Created:** [May 25, 2018, 1:06pm UTC](https://forum.dynamobim.com/t/mass-duplicate-view-revit-crash/22219 "2018-05-25T13:06:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![y.chatain](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/y.chatain/32/39292_2.png) [@y.chatain](https://forum.dynamobim.com/u/y.chatain)\
**Post date:** [May 25, 2018, 1:06pm UTC](https://forum.dynamobim.com/t/mass-duplicate-view-revit-crash/22219/1 "2018-05-25T13:06:41Z")

</div>

Hello, i am pretty much without a clue here.

My problem is that i want to duplicate views from a revit file.

It generally works pretty fine, but now i have a revit file where the script just stuck.

Even the except doesn’t work, probably because it does not through an error.

do you guy hav an idea what could be the cause and why the duplicate function is not working?

I would be very thankfull

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  
Schedules = UnwrapElement(IN[0])  
filepath = IN[1]

#Option for Duplication Duplicate / WithDetailing / Dependent

#Option = Autodesk.Revit.DB.ViewDuplicateOption.Duplicate  
Option = Autodesk.Revit.DB.ViewDuplicateOption.WithDetailing  
#Option = Autodesk.Revit.DB.ViewDuplicateOption.Dependent

Building = list()  
j=0  
TransactionManager.Instance.EnsureInTransaction(doc)

for Apartments in Schedules:

```
Apartmentlist = list()
for ScheduleApartment in Apartments:
	with open(filepath, 'a') as file:
		file.write(str(ScheduleApartment.Name))
		file.write("\n")		
		file.close
		j=j+1
	try:
		newSchedule = ScheduleApartment.Duplicate(Option)
		Apartmentlist.append(doc.GetElement(newSchedule))
	except:
		Apartmentlist.append(None)
Building.append(Apartmentlist)

```

TransactionManager.Instance.TransactionTaskDone()

---

<div class="post-metadata">

**Author:** ![y.chatain](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/y.chatain/32/39292_2.png) [@y.chatain](https://forum.dynamobim.com/u/y.chatain)\
**Post date:** [May 28, 2018, 8:30am UTC](https://forum.dynamobim.com/t/mass-duplicate-view-revit-crash/22219/2 "2018-05-28T08:30:09Z")

</div>

So I’m narroing my analysis and it is due to the duplicate method from the Revit API.

Not knowing if it is related, I identified Views that are nul

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/a/6a11c85d72fbe29479884ec11bef4dea459230fd.png)

How are such Views possible?

and can this be the reason why it is getting mixed up while duplicating a lot of views?

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [May 28, 2018, 8:36am UTC](https://forum.dynamobim.com/t/mass-duplicate-view-revit-crash/22219/3 "2018-05-28T08:36:59Z")

</div>

I think the nuls are View Templates and the Browser organization (arborescence).

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [May 28, 2018, 9:01am UTC](https://forum.dynamobim.com/t/mass-duplicate-view-revit-crash/22219/4 "2018-05-28T09:01:38Z")

</div>

If you use the OOTB node Views, you can find in the list “Project View” and “System Browser”.  
These are probably the nulls.
