Element Conversion from Revit type do Dynamo type crashing

Hello, i’ve been trying to get all viewtemplates from a project using the following code.

I tryed to convert these elements to dynamo types… the problem is i get some null values.

My question is. Is there a way to convert from revit elements to Dynamo elements without causing it to crash? Thanks!

import clr

import Autodesk
from Autodesk.Revit.DB import *

import Revit

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

doc = DocumentManager.Instance.CurrentDBDocument

collector = FilteredElementCollector(doc)

filter = ElementCategoryFilter(BuiltInCategory.OST_Views)

ld = collector.WherePasses(filter)

OUT = ld, list(ld)

I don’t know why it is crashing, but I would try to filter your views to just view templates. Each View has an IsTemplate property. So, you can do something like this:

filtered = list(filter(lambda view: view.IsTemplate, ld))

VT = [] 
views =FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Views).ToElements()
for v in views:
    if v.IsTemplate: