# Adding a filter to different Viewfilters

**URL:** <https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898>\
**Category:** Revit\
**Created:** [August 10, 2017, 12:27pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898 "2017-08-10T12:27:44Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![markmaas](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@markmaas](https://forum.dynamobim.com/u/markmaas)\
**Post date:** [August 10, 2017, 12:27pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/1 "2017-08-10T12:27:44Z")

</div>

Hello,

I want to build a script wich will push one or more filters in all the viewtemplates in the project. Is that possible? Can someone help me to start?

---

<div class="post-metadata">

**Author:** ![Tom\_Kunsman](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tom_kunsman/32/133796_2.png) [@Tom\_Kunsman](https://forum.dynamobim.com/u/Tom_Kunsman)\
**Post date:** [August 10, 2017, 1:25pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/2 "2017-08-10T13:25:14Z")

</div>

> [@Create and add view filter (ParameterFilterElement)](https://forum.dynamobim.com/t/create-and-add-view-filter-parameterfilterelement/3616/4):
>
> Ok, now we are getting somewhere. Showing clearly what you need is step one. Step two is to show some work that you have done. This forum is not exactly a place where you just post “tell me how to do this because i need this for my homework/work, and send the ready definition to my email”. It’s a community support forum and we (at least I do) have some rules that we follow. Rules: Post clear description of problem. Images, sample files are welcome. Please only post minimum required to duplic…

> [@How to create and control View Filters](https://forum.dynamobim.com/t/how-to-create-and-control-view-filters/7720/7):
>
> Hello Ben, I think I followed your instructions, however something is astray. There are two parts to what I’m trying to do, one apply a graphic filter to a view, and then the second part is to control the visibility of that view, i.e. either On or Off. We don’t have to be trapped in the process that I started out, it was my attempt at trying to achieve that outcome, if there is a better way, I’ll gladly accept that, I just could find a node to do it. However you will see I can control multiple…

from the search feature of the forum 🙂

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [August 10, 2017, 1:26pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/3 "2017-08-10T13:26:53Z")

</div>

Hi @markmaas

Create a new revit file using the template.  
Setup a new viewtemplate by rightclicking a floorplan view and click create template from view.  
Edit this new viewtemplate and set up the filter  
Save  
Go to the revit file you want the filter rule in and Transfer project standards from the new file.  
Make sure only Filters and Viewtemplates are ticked.  
In Dynamo 1.3 there are a few new nodes for messing with view templates.  
Good luck  
Marcel

---

<div class="post-metadata">

**Author:** ![markmaas](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@markmaas](https://forum.dynamobim.com/u/markmaas)\
**Post date:** [August 10, 2017, 1:49pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/4 "2017-08-10T13:49:01Z")

</div>

Thanks Marcel,

I know how to do it in Revit. I have about 80 different viewteplates ans adding just one filter to each template is a lot of work. I’m a newby so i was just wondering if it is possible to write a script. I couldn’t find a node witch will add a filter to a list of viewtemplates. I was just asking for a good start. Then i will try it myself off course. Don’t want to up sad Tom\_Kunsman.

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [August 10, 2017, 7:27pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/6 "2017-08-10T19:27:09Z")

</div>

Hi @markmaas

I got this far  
[addfilter.DYN](https://forum.dynamobim.com/uploads/short-url/92ic1b5jnZDhFaIVfW2MMlZk8Mh.DYN) (11.0 KB)

 ![Capture4](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/8/88ee7355ff2f0f66341bb779dfc8696572be1186.PNG)

I know the order of the filters is read bottom up.  
So the top filter gets applied after the ones further down.  
This will set the last (first applied) filter…all OOTB Dynamo 1.3.1 nodes.  
And the rvt.  
[escape route.rvt](https://forum.dynamobim.com/uploads/short-url/i331PjYGvPT6Pc3zSMjXnd5Fsj5.rvt) (344 KB)

Marcel

---

<div class="post-metadata">

**Author:** ![markmaas](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@markmaas](https://forum.dynamobim.com/u/markmaas)\
**Post date:** [August 11, 2017, 10:22am UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/7 "2017-08-11T10:22:29Z")

</div>

Hi Marcel thanks a lot! I did something similar for the Phase of schedules. But what i really try to achieve is to add the filter to the view templates. All my filter settings are stored in the view templates. There are a lot so that’s a lot of work and a big change i forget some. I think we need a custom node for that. Some kind of Python script. Was wondering if somebody new such a script.

 ![viewtemplates](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/2/b22e54bdf03d674e1a61b2981c554889c0ed0069.png)

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [August 11, 2017, 11:01am UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/8 "2017-08-11T11:01:08Z")

</div>

@markmaas

> [@Add Filter to View Template](https://forum.dynamobim.com/t/add-filter-to-view-template/9215/2):
>
> View Templates are Views so you can just add View Filters to them the same way you would add one to a Floor Plan: [image]

The current node takes a list for the categories.

Marcel

---

<div class="post-metadata">

**Author:** ![markmaas](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@markmaas](https://forum.dynamobim.com/u/markmaas)\
**Post date:** [August 11, 2017, 11:19am UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/9 "2017-08-11T11:19:54Z")

</div>

Thanks thats cool. I’m going to try this out. 🙂

---

<div class="post-metadata">

**Author:** ![markmaas](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@markmaas](https://forum.dynamobim.com/u/markmaas)\
**Post date:** [August 12, 2017, 11:06am UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/10 "2017-08-12T11:06:59Z")

</div>

I try to rebuild the script. I can’t find the ViewFilter.CreateRule node. is that a custom node? And my View.SetFilterOverrides is totaly differnt than the one displayed in the example. Is it an old post? Made with Dynamo 0.7 or older maybe?

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [August 12, 2017, 11:24am UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/11 "2017-08-12T11:24:18Z")

</div>

@markmaas

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/3/135b4c33b43149190d2c455124e88d16baf75eae.png)

Konrad posted it jan 28 this year.

Marcel

---

<div class="post-metadata">

**Author:** ![markmaas](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@markmaas](https://forum.dynamobim.com/u/markmaas)\
**Post date:** [August 12, 2017, 11:44am UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/12 "2017-08-12T11:44:17Z")

</div>

Oke this is to hard for me at this very moment, I just starting to learn Dynamo this week. I have difficulties with finding the right nodes. The search functions seems terrible to me. I’m going to concentrated on simpler tasks. Thanks for the responds.

 ![swimming](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/d/fd8a1828383f4695d230f391c2a4abe9c2201afe.png)

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [August 12, 2017, 11:49am UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/13 "2017-08-12T11:49:15Z")

</div>

@markmaas

Fixed it btw.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/2/223bbe5fca5ed0ba392240edde5f33726b26510c.png)  
[addfilter.DYN](https://forum.dynamobim.com/uploads/short-url/iHcW77BrYBsABkIYMO8MqUIBllx.DYN) (16.3 KB)

Marcel

---

<div class="post-metadata">

**Author:** ![markmaas](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@markmaas](https://forum.dynamobim.com/u/markmaas)\
**Post date:** [August 12, 2017, 12:18pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/14 "2017-08-12T12:18:02Z")

</div>

Thanks a lot Marcel, it works well. I don’t have Revit 2017 on my labtop. So i opened you’re files with Revit 2018.1. As soon as i opened the filter to take a closer look at it, Revit crashes. Three times in a row. But i will try to rebuild you’re script in 2016. Just to learn something from it.

 ![crash](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/6/f60c51d266dd922c4c06051858867f7e6b1d8c53.png)

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [August 12, 2017, 12:28pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/15 "2017-08-12T12:28:19Z")

</div>

@markmaas

Well i’m sorry for that.  
I cannot replicate this since i only have Revit 2017 and there it works fine.

Marcel

---

<div class="post-metadata">

**Author:** ![markmaas](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@markmaas](https://forum.dynamobim.com/u/markmaas)\
**Post date:** [August 12, 2017, 2:19pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/16 "2017-08-12T14:19:59Z")

</div>

Oke i tried to rebuild it just like you’re image. It’s not working well so i made some mistakes. Can’t find them right now. I will take a fresh look at it tomorrow.

 ![warnings2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/8/3818ae485432a4d3bd5f19ce87e7e1acd8f86cca.png)

---

<div class="post-metadata">

**Author:** ![markmaas](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@markmaas](https://forum.dynamobim.com/u/markmaas)\
**Post date:** [August 12, 2017, 2:32pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/17 "2017-08-12T14:32:47Z")

</div>

Solved! it must be “0” and not “0”; in the code blocks…

 ![no_warnings](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/a/0a74e2579840582c2885a42e9080e83da98783ae.png)

---

<div class="post-metadata">

**Author:** ![markmaas](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@markmaas](https://forum.dynamobim.com/u/markmaas)\
**Post date:** [August 12, 2017, 2:40pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/18 "2017-08-12T14:40:19Z")

</div>

The next challenge is to put in a list of view(templates) instead of only one view… 😊

---

<div class="post-metadata">

**Author:** ![markmaas](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@markmaas](https://forum.dynamobim.com/u/markmaas)\
**Post date:** [August 12, 2017, 2:48pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/19 "2017-08-12T14:48:16Z")

</div>

That was’t so hard!

 ![list_views](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/a/5a09b77a412226ab9dc09ba308a248d04d55a721.png)

---

<div class="post-metadata">

**Author:** ![markmaas](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@markmaas](https://forum.dynamobim.com/u/markmaas)\
**Post date:** [August 12, 2017, 3:12pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/20 "2017-08-12T15:12:32Z")

</div>

I shorten it in a little bit. Is it possible to choose an excisting viewfilter instad of making a new one?

 ![shorten](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/8/08294bffb925874912e335fc1d18ba14c38b6e96.png)

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [August 12, 2017, 5:32pm UTC](https://forum.dynamobim.com/t/adding-a-filter-to-different-viewfilters/13898/21 "2017-08-12T17:32:08Z")

</div>

@markmaas

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

This can be done more elegant by downloading the backary package and putting a node called IfEqualReturnIndex in between the View.Filters and List.GetItemAtIndex node.  
Let it search for the name of the filter and return the index in the list.  
I’ve done that manualy now.  
I cannot demonstrate it.  
There is an error on the packages website.  
ERR\_SSL\_PROTOCOL\_ERROR

Marcel
