Copy selected filters and filter overrides between views and view templates

Hello all,
I am trying to copy selected filters and filter overrides between views and view templates using datashape package, everything seems to be working fine except that the final output of the graph only copy overrides to the first selected filter and not the rest.
Images and graph attached.
Home.dyn (32.1 KB)

Many thanks in advance.

1 Like

Hmm, the following List@Level changes and addition of View.Filters seems to help.

I cannot speak as to how it would behave with multiple views selected though. That might take some more investigation.

Hello John,
Not sure why in my end it does not work, the node View.SetFilterOverrides only give me one item in the out list.
However when I used the graph you explained us the other day the number of items in the out list is the same as the number of filters you copy across.
I thought it was my dynamo version but it isnt I have tried with 1.3.2 and 1.3.3

Attached both results.

I have modified the lacing to longest and it is working now…:hushed:
I do not understand why in my end, or why in this graph and not in the other one I have to have a different lacing, is this a glitch???
Many thanks for your support.


I couldn’t get either to work! I wrote my own code… It needs error catching and to work for lists of views, but hopefully it helps others…

import clr
from Autodesk.Revit.DB import *

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

doc = DocumentManager.Instance.CurrentDBDocument

viewOrig = UnwrapElement(IN[0])
viewTarg = UnwrapElement(IN[1])

overrides = []
filters = viewOrig.GetFilters()

filterElemIds = []
for filter in filters:
	fel = doc.GetElement(filter)
for filterElemId in filterElemIds:

result = []

count = 0
for filterElemId, override in zip(filterElemIds, overrides):
	viewTarg.SetFilterOverrides(filterElemId, override)


OUT = result

1 Like