Get All Viewport types -node not working

Hey guys,

Im using the node get all viewport types from archi-lab. Every time I close my script and reopen it and run it …I get this message:

When I delete the node and re - place the same node it works perfectly. Do you guys know why ?

It probably won’t work if you don’t have already placed viewport.

Sounds like a race condition in the node upgrade. Confirm you’re on the latest version of Archilab. Thanks!

Here is what im working with.

Some additional info. @Tomasz_Puchala The script creats views with the default viewports. If I run the script 2 times it still doesnt work. The first time would then create some views with viewports on them and 2nd time would also create views but there would already be used viewports to read from.

Only if I delete the node and place it again from the menu it works. Even without having used viewports in the project. Eveything else is perfect about the node. Its just that I cant run the script without having to remove and then put it again.

Hi @verdi

This should work for you:

import clr
# Import RevitAPI
import Autodesk
from Autodesk.Revit.DB import *

# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager

import Revit

doc = DocumentManager.Instance.CurrentDBDocument

collection = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Viewports).WhereElementIsNotElementType().ToElements()

vptypes = []
for e in collection:
	if e.Category != None:

OUT = vptypes

You could also use OOTB nodes:

Thank you ! I will try the costum script.

The OOTB nodes don’t work, because im looking for all the viewports in the document/project. The OOTB nodes only give you the ones you have placed/used. There are 3 in project but one placed, cause there is only 1 view on the sheet.

@verdi Ah you’re looking to get viewport types?

I had a similiar problem. I coudn’t find a way to get types loaded to a template. Workflow above works only when you have already placed viewports. Otherwise, it will give you an empty list. I get viewport types in totally different way:

  • create placeholder sheet
  • place viewport on it
  • get types and some more viewports properties
  • rollback whole Transaction, so nothing is created, but you still can get viewport types .
    But I don’t know if it’s a good approach for you.
1 Like

Yes I am , but looking to get the types not used in the project yet. The python script , gets all the viewports used. It functions exactly the same as the 2 OOTB nodes " element type " and “all elements of type”.

The name of the node I would be looking for is something like, “available viewport-types in document”.

@Tomasz_Puchala That is a good idea Tomasz. I did not want to do it that way, but seeing that I don’t see any other way yet, I wil just place the view and viewports I need in the starting Revit template and let dynamo choose that one. But then the script would only work in that template.

Thanx for the reactions guys. I do not have a solution yet until the node is fixed, but will use the work around of placing the viewports in the document before running the script.

Isn’t there a way via categories?