I am trying to access 3D views in a file that is open in the background. I have seen older thread that used Genius Loci get 3d views. I have found in more recent release of Loci 3DView Collector. Is it possible this node will not collect 3d views that have a view template?
Please help if you know a node or have python script that can get all the 3D views out of a document opened in the background.
This one works for me it collects all the views ,you could filter down later for just 3d views…
This line doesn’t seem to work, I dont know why. but, solves the purpose in our case
if view.ViewType == ViewType.ThreeD:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = IN[1]
collector = FilteredElementCollector(doc)
views = collector.OfClass(View).ToElements()
viewlist = list()
#myView =[]
for view in views:
if view.ViewType == ViewType.ThreeD:
if not(view.IsTemplate):
viewlist.append(view)
else:
viewlist.append(view)
#if view.Name == IN[0]:
#myView = view
#if myView == []:
#myView = " Can't find a view by that name"
OUT = viewlist
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = IN[1]
collector = FilteredElementCollector(doc)
views = collector.OfClass(View).ToElements()
viewlist = list()
myView =[]
for view in views:
if view.ViewType == ViewType.ThreeD:
if not(view.IsTemplate):
viewlist.append(view.Name)
#else:
#viewlist.append(view.Name)
Thanks for the reply! Unfotunately I have the same result.
There are 11 3d views that are not in the list.
import clr
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
import Autodesk
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = IN[0]
collector = FilteredElementCollector(doc)
views = collector.OfClass(View).ToElements()
viewlist = list()
myView =
for view in views:
if view.ViewType == ViewType.ThreeD:
if not(view.IsTemplate):
viewlist.append(view.Name)
#else:
#viewlist.append(view.Name)
OUT = viewlist