Adding a filter to different Viewfilters

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?

from the search feature of the forum :slight_smile:

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

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.

Hi @markmaas

I got this far
addfilter.DYN (11.0 KB)

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 (344 KB)

Marcel

1 Like

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.

@markmaas

The current node takes a list for the categories.

Marcel

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

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?

@markmaas

Konrad posted it jan 28 this year.

Marcel

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.

@markmaas

Fixed it btw.
image
addfilter.DYN (16.3 KB)

Marcel

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.

@markmaas

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

Marcel

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.

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

1 Like

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

That was’t so hard!

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

@markmaas

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