Filter Visibility

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 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

Hey,

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

Hope that helps,

Mark

2 Likes

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…

Hi @ here is a way with ootb nodes

VISIBILITY FILTERS.dyn (69.8 KB)