Turn off the visibility of a View Filter


Hi all,
I would like to create a filter, assign it to a view and turn its visibility off.
I already found how to create the filter and assign it to a view. It is also solved how to change its graphic override, but I could not find a way to turn its visibility off.
Does anyone know a solution for that?

This is the custom node that I use:

This is what I got from this topic “Create and add view filter (ParameterFilterElement)”:

The problem is in Line 53. It does not give a warning, but definitely does not turn the visibility off. What can be the problem?

Here is the code for copy/paste:
import clr

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

doc = DocumentManager.Instance.CurrentDBDocument

import Autodesk
from Autodesk.Revit.DB import *
import System
from System.Collections.Generic import *

dataEnteringNode = IN

def GetBuiltInParam(paramName):
builtInParams = System.Enum.GetValues(BuiltInParameter)
test = []
for i in builtInParams:
if i.ToString() == paramName:
return test [0]

cats = IN[0]
paramName = IN[1]
pValue = IN[2]
filName = IN[3]
view = UnwrapElement(IN[4])


catList = []
for i in cats:

typedCatList = ListElementId

bip = GetBuiltInParam(paramName)

rules = []

rules.append(ParameterFilterRuleFactory.CreateNotBeginsWithRule(ElementId(bip), pValue, 0.001))

filter = ParameterFilterElement.Create(doc, filName, typedCatList, rules)



OUT = view


what’s the warning?


Thank you for asking. It does not give a warning. It just does not turn off the visibility.
I got that line from here:

I have seen that it should be possible to achieve what I want, because I have seen it working in your video here:


it doesn’t because you have the whole thing enclosed in a TRY statement. take that out and try again.


I took it out from TRY.

It still creates the filter and adds to the view, but it is still visible.


Idk, Revit API works in strange ways sometimes. Try calling it like so instead: view.SetFilterVisibility(filter.Id, False) since we are in Python.

Maybe its the fact that it needs to be regenerated so perhaps call doc.Regenerate() before you call set filter visibility but after you created it.


Konrad, you da real MVP
I only had to change it to " False", instead of “false”. Now it works fine. Thank you very much.


@Konrad_K_Sobon where can I find this package? I have Archi-Lab Grimshaw, Bumblebee, Archi-nodes, and Archi-Nodes but the nodes aren’t included for View Filters. You went right down an avenue that’s going to help me immensely with the nodes in the video above!
(I dug around all over your website too, I didn’t want to bother you, but from the video you’re saving me many hours of “figuring it out” already!)

How to create and control View Filters
View Filter Visibility

This WILL be part of Archi-lab in the future but for now, it will come out available for download with a course at Think Parametric. https://thinkparametric.com/ I think I will keep it there for a month or so and then publish to my package. I think the course for Dynamo 102 is being edited now, and should be ready in a week or two.

Ps. Also, it appears that Dynamo will be getting view filters in the next stable release of Dynamo. I saw some PRs in the works that will allow some of this functionality but I am not sure if all…its pretty limited. When it comes out I will clean out excess from my package and then offer the rest as supplemental, maybe push into the daily builds. I am not sure yet.