I tried the suggestion, now I have a new error “Type Error: Expected Element, got List”.
I am fairly new to all this but believe because am creating multiple views is the reason for error pop-up, but then I don’t understand why it does not with active view. Any suggestions?
The updated code for your reference:
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
Min=[]
Max=[]
viewlist=[]
bbox=[]
for i in IN[0]:
Min.append(UnwrapElement(i.ToXyz(True)))
for i in IN[1]:
Max.append(UnwrapElement(i.ToXyz(True)))
TransactionManager.Instance.EnsureInTransaction(doc)
def filter_list(elements, search_str):
passed = []
for element in elements:
name = element.Name
if search_str in name:
passed.append(element)
return passed
views3d = []
views3d = FilteredElementCollector(doc).OfClass(View3D).WhereElementIsNotElementType().ToElements()
D = filter_list(views3d, 'ThreeD')
typeid=View3D.GetTypeId(D) #Line of error
count = 0
while (count < len(Min)):
b=View3D.CreateIsometric(doc, typeid)
viewlist.append(b)
box = app.Create.NewBoundingBoxXYZ()
box.Min = Min[count]
box.Max = Max[count]
bbox.append(box)
a=View3D.SetSectionBox(b,box)
count = count + 1
TransactionManager.Instance.TransactionTaskDone()
OUT=bbox,viewlist