Hi everyone, I tried to make a python script to enable/disable filters in views but unfortunately I don’t have much knowledge in this art.
My objective is to initiate a project from sheets (Google sheet), I was able to extract the informations/make the views/filters/…
In this example I have 3 filters to apply to 2 views and 6 bools (1 for each).
The result here: all filter are disabled(or enabled) depending on the latest bool
Here is the script :
import clr
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
clr.AddReference(‘RevitServices’)
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
view = UnwrapElement(IN[0])
viewfilter = UnwrapElement(IN[1])
bool = IN[2]
TransactionManager.Instance.EnsureInTransaction(doc)
count = 0
for v in view:
for vf in viewfilter:
for b in bool:
v.SetIsFilterEnabled(vf.Id,b)
TransactionManager.Instance.TransactionTaskDone()
OUT = IN[0]
Please elp