How to create and control View Filters

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 views with a different graphic filter (in this case color). The second part is then to control the visibility of the filter for a particular view (ie on or off). I was able to do that for a single view, but now after following you’re instructions there is something amiss for me. I have included the .rvt sample file and updated graph.

Filters-Dynamo.rvt (2.1 MB)
ViewFilters_Test.dyn (26.8 KB)

TransactionManager.Instance.EnsureInTransaction(doc)
for v in views:
out=
for x in filters:
try:
v.SetFilterVisibility(x.Id, visOrNot)
output.append(“Filter switched”)
except:
output.append(“Filter failed to switch”)
output.append(out)
TransactionManager.Instance.TransactionTaskDone()

1 Like