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()