Controlling filter visibility with a list of views

Hey, i’m trying to change filter visibility on a list of independent views.

Zhukoven package does have a node like that - SetFilterVisibility, but for some reason it just doesn’t change it. I’ve looked into the code, and it seems pretty straightforward. I’ve even tried to simplify it, taking out the TRY statement but it seems to have broken it.

i’ve tried looking into similar topics but to no avail

this is zhukoven node unmodified

#Author Konstantin Zhukoven @
#Tested to work with Dynamo 1.3.0+
import clr
from Autodesk.Revit.DB import *

import Revit

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

doc = DocumentManager.Instance.CurrentDBDocument
view = UnwrapElement(IN[0])
filter = UnwrapElement(IN[1])
boolean = IN[2]
result = []
viewlist = []


	for i in view:
		viewlist.append(i.SetFilterVisibility(filter.Id, boolean))

OUT = (view,result)


Sorry I can’t look at it in detail, but the immediate problem you have is explained in the warning…

The code is looking for ‘A Filter’, you are feeding ‘A List Of Filters’. Dynamo thinks of that List as an object, a different kind of object to a Filter… That code will only work if you feed 1 Filter :(.

If your list of filters exactly matches your list of views, you could amend the code to:

    for v, f in zip(view, filter):
        viewlist.append(v.SetFilterVisibility(f.Id, boolean))

The zip will iterate through both lists together.

Whether there is something more fundamental failing, I don’t know.

Hope that helps,


Thanks for the quick reply.

Both input lists are of the same lenght so it should work.

I’ve added TRY statement and zipped views and filters together, that didn’t help, then I tried to select boolean by ID, now it gives me empty list.

Is it because it now wants same lenght list of booleans?


No your boolean is fine, sorry I can’t look in more detail, all i can suggest is that you have a search of the forum, i know i have done work with filters before…

I think i remember that the Orchid package now has some filter nodes? Perhaps you could have a look there?




getting Orchid package did help - it has a View.Addfilter node with visibility control that actually works.
One disclaimer though - views that go into the node need to have no View Template applied.

Out of curiosity I’ve checked if disabling View Templates on these views make Zhukoven node work - it doesn’t.

Still - I will keep looking how to make it through a python script.

You can also use the View Add Filter node in Genius Loci package.
This one is in Python.

1 Like

Or, since it’s looking for A filter try setting the list level to @L1. :slight_smile: