I would like to be able to find all of the view filters in my project that are not being used.
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
from System.Collections.Generic import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN
#collect all views in model
collector = FilteredElementCollector(doc)
views = collector.OfClass(View).ToElements()
areaPlans = []
#collect all views filters in the model
collector = FilteredElementCollector(doc)
filters = collector.OfClass(ParameterFilterElement).ToElements()
#viewFilters = []
#filter out view templates
for i in views:
if not i.IsTemplate:
if i.ViewType == ViewType.AreaPlan:
areaPlans.append(i.ToDSType(True))
else:
continue
bipViewFilter = filters
#Assign your output to the OUT variable.
OUT = bipViewFilter, areaPlans
Here's one way you can achieve what you need:
My understanding was that you need a way to extract only View Filters that were applied to Area Plans. This is a two step process where you can get Area Plans and then extract all View Filters for each view. You get something like this: