# Turn off the visibility of a View Filter

**URL:** <https://forum.dynamobim.com/t/turn-off-the-visibility-of-a-view-filter/5076>\
**Category:** Developers\
**Created:** [July 18, 2016, 8:23am UTC](https://forum.dynamobim.com/t/turn-off-the-visibility-of-a-view-filter/5076 "2016-07-18T08:23:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mate\_Csocsics](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@Mate\_Csocsics](https://forum.dynamobim.com/u/Mate_Csocsics)\
**Post date:** [July 18, 2016, 8:23am UTC](https://forum.dynamobim.com/t/turn-off-the-visibility-of-a-view-filter/5076/1 "2016-07-18T08:23:05Z")

</div>

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:  
 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/0/0dc7483b61137ae68b9cbc130367576e96d37ed9.png)

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

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/7/7b67fc74a6588fc1681ecd5b73e92bbcc19b6a77.png)

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

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

doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference(“RevitAPI”)  
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:  
test.append(i)  
break  
else:  
continue  
return test [0]

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

TransactionManager.Instance.EnsureInTransaction(doc)

catList =   
for i in cats:  
catList.append(ElementId(i.Id))

typedCatList = ListElementId

bip = GetBuiltInParam(paramName)

rules =

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

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

```
view.AddFilter(filter.Id)
view.SetFilterVisibility(filter.Id,false)

```

except:  
pass  
TransactionManager.Instance.TransactionTaskDone()

OUT = view

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [July 18, 2016, 3:43pm UTC](https://forum.dynamobim.com/t/turn-off-the-visibility-of-a-view-filter/5076/2 "2016-07-18T15:43:20Z")

</div>

what’s the warning?

---

<div class="post-metadata">

**Author:** ![Mate\_Csocsics](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@Mate\_Csocsics](https://forum.dynamobim.com/u/Mate_Csocsics)\
**Post date:** [July 18, 2016, 3:58pm UTC](https://forum.dynamobim.com/t/turn-off-the-visibility-of-a-view-filter/5076/3 "2016-07-18T15:58:25Z")

</div>

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

> **[View Filter API](http://thebuildingcoder.typepad.com/blog/2013/08/view-filter-api.html)**
>
> One long-standing developer wish list item that was fulfilled by the Revit 2014 API is the ability to access, add and control the view filters listed in the visibility dialogue. The Revit API now provides the following methods supporting this:...

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

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [July 18, 2016, 4:01pm UTC](https://forum.dynamobim.com/t/turn-off-the-visibility-of-a-view-filter/5076/4 "2016-07-18T16:01:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mate\_Csocsics](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@Mate\_Csocsics](https://forum.dynamobim.com/u/Mate_Csocsics)\
**Post date:** [July 18, 2016, 4:15pm UTC](https://forum.dynamobim.com/t/turn-off-the-visibility-of-a-view-filter/5076/5 "2016-07-18T16:15:36Z")

</div>

I took it out from TRY.

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/5/5eb87c55cfeef7cd81d4f602dd38b89312898908.png)

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

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/5/53b6c3a1c9acceac9edbb1b882eff17ba4ad6e1f.png)

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [July 18, 2016, 4:19pm UTC](https://forum.dynamobim.com/t/turn-off-the-visibility-of-a-view-filter/5076/6 "2016-07-18T16:19:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mate\_Csocsics](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@Mate\_Csocsics](https://forum.dynamobim.com/u/Mate_Csocsics)\
**Post date:** [July 18, 2016, 5:28pm UTC](https://forum.dynamobim.com/t/turn-off-the-visibility-of-a-view-filter/5076/7 "2016-07-18T17:28:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jason\_Parker](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jason_parker/32/8550_2.png) [@Jason\_Parker](https://forum.dynamobim.com/u/Jason_Parker)\
**Post date:** [July 20, 2016, 6:41pm UTC](https://forum.dynamobim.com/t/turn-off-the-visibility-of-a-view-filter/5076/8 "2016-07-20T18:41:49Z")

</div>

@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!)

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [July 20, 2016, 6:46pm UTC](https://forum.dynamobim.com/t/turn-off-the-visibility-of-a-view-filter/5076/9 "2016-07-20T18:46:50Z")

</div>

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/](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.
