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