Cannot find View.SetFilterVisibility node

Hello all,

I am struggling to find the “View.SetFilterVisibility” node. I am seeing it exists in related posts (see below). But these unfortunately doesn’t help me in finding the node in dynamo.

Has it been removed? I am working in Dynamo Revit 3.3.0.6523. If it has been removed, how do we toggle the visibility of view filters now?

Related posts:

Archi-Lab package if my memory and those posts are correct.

I have the Archi-lab package installed, but the View.SetFilterVisibility node doesnt seem to be included in there.

I did find Views.SetFilterOverrides, but it does not seem to behave like I was hoping.
Attached are my inputs to the nodes and the resulting view filters.

So, what are your trying to set / control?

Doesn’t these do what you want?

OR

Hi @Kevin4 maybe this could work for you
Revit_WqNaByzdlb
test view filters.dyn (4.8 KB)

I am trying to toggle the filter Visibility state. Both those nodes look like they should be able to do what I want, but they simply dont seem to trigger the desired effect.

Hello, the node you shared is almost exactly right. It is triggering the “Enable Filter” function of the desired filter instead of the “Visibility” function.

I guess you have to use @sovitek Python solution :snake: then.

Excuse me, I accidently replied to bvs1982. please see my response to your python node above!

allright then try as here and see if it better


import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
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 = []

TransactionManager.Instance.EnsureInTransaction(doc)

try:
	for i in view:
		viewlist.append(i.SetFilterVisibility(filter.Id, boolean))
		result.append(True)
except:
	result.append(False)
TransactionManager.Instance.TransactionTaskDone()

OUT = (view,result)

The new script doesnt seem to do anything to the filter as far as I can see.

arhhh my bad maybe here :wink:

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

views = IN[0] if isinstance(IN[0], list) else [IN[0]]
view_filter = UnwrapElement(IN[1])
state = IN[2]

results = []

TransactionManager.Instance.EnsureInTransaction(doc)

for v in views:
    view = UnwrapElement(v)
    try:
        f_id = view_filter.Id
        if not view.IsFilterApplied(f_id):
            view.AddFilter(f_id)
        view.SetFilterVisibility(f_id, state)
        results.append(True)
    except:
        results.append(False)

TransactionManager.Instance.TransactionTaskDone()

OUT = (views)
1 Like

Yes! It works perfectly!
I dont think this node is able to handle lists, but i’ll manage without that.
Thank you very much for the help!

1 Like

Probably.

1 Like

havent tried but it could handle list as well as i tried with views…hard coded in the code, or create a costum dyf so we have option for lacing…i guess :wink:

or just use OOTB

View.SetFilterOverrides was my first instinct to use but I could not get it to work for me unfortunatly.