# Filter Visibility

**URL:** <https://forum.dynamobim.com/t/filter-visibility/32515>\
**Category:** Revit\
**Created:** [February 22, 2019, 11:41am UTC](https://forum.dynamobim.com/t/filter-visibility/32515 "2019-02-22T11:41:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vykr](https://avatars.discourse-cdn.com/v4/letter/v/e56c9b/32.png) [@Vykr](https://forum.dynamobim.com/u/Vykr)\
**Post date:** [February 22, 2019, 11:41am UTC](https://forum.dynamobim.com/t/filter-visibility/32515/1 "2019-02-22T11:41:47Z")

</div>

Apologies for the amount of posts being posted about this, but I can’t seem to find one with a straight forward answer…

I’m not that experienced at Python, so alas, I cannot alter the stuff posted in others to suit my own. I have a list of true and falses to indicate the value of the visibility, I need to use them to set the visibility in a view dictated by me.

I’ve seen a few python scripts around, i’ve also seen Konrads [thinkparametric.com](http://thinkparametric.com) link to his files, but the files will not work for me.

I think the closest python script so the one I require is this:

If anyone could help out, or point me in the direction of something I may have missed, i’d really appreciate it.

> 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
> 
> filters = UnwrapElement(IN[0])  
> view = UnwrapElement(IN[1])  
> visOrNot = IN[2]  
> output =
> 
> TransactionManager.Instance.EnsureInTransaction(doc)  
> for x in filters:  
> try:  
> view.SetFilterVisibility(x.Id, visOrNot)  
> output.append(“Filter switched”)  
> except:  
> output.append(“Filter failed to switch”)
> 
> TransactionManager.Instance.TransactionTaskDone()
> 
> OUT = output

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [February 22, 2019, 12:16pm UTC](https://forum.dynamobim.com/t/filter-visibility/32515/3 "2019-02-22T12:16:26Z")

</div>

Hey,

That Python works only for a single Visibility… You need a zip…

 ![Test1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/7/871637510cab03efb3863ccb28894fd387b28093.gif)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/2/d2ba06b07afcc27702f4c194503bba415d7f3cc1.png)

Hope that helps,

Mark

---

<div class="post-metadata">

**Author:** ![Afreteur](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@Afreteur](https://forum.dynamobim.com/u/Afreteur)\
**Post date:** [November 1, 2021, 6:43pm UTC](https://forum.dynamobim.com/t/filter-visibility/32515/4 "2021-11-01T18:43:57Z")

</div>

Hello, same problem here. Your solution work fine but for one view at a time.  
Is there a way to adapt the script so it could handle multiple views ?

I have just one filter per view but each view have a different filter.  
I’d like to turn off the visibility for all filters

I’m learning python but I’m still struggling at the moment…

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/6/36e65adb0cf20edc044bfbd3c04f2c5cf01da2b2.png)

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [November 1, 2021, 7:10pm UTC](https://forum.dynamobim.com/t/filter-visibility/32515/5 "2021-11-01T19:10:10Z")

</div>

Hi @ here is a way with ootb nodes

[VISIBILITY FILTERS.dyn](https://forum.dynamobim.com/uploads/short-url/mqOH26Vg2sPipNLs3auYL2sYnG6.dyn) (69.8 KB)

 ![Screenshot 2021-11-01 200911](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/0/d01d21cef65b9d6c076855b2097ec43a0cfc0478.png)
