Im trying to create a filter that collects all element that own a shared parameter.
I have managed to find all elements that have this parameter (i passed an id) by only because im comparing its contents. So basically if value of parameter = something. (i found an example online)
import clr
# Adding the RevitServices.dll special Dynamo module to deal with Revit
clr.AddReference('RevitServices')
import RevitServices # Importing RevitServices
# From RevitServices import the Document Manager
from RevitServices.Persistence import DocumentManager
# Adding the RevitAPI.dll module to access the Revit API
clr.AddReference('RevitAPI')
import Autodesk # Here we import the Autodesk namespace
# From the Autodesk namespace - derived down to the Revit Database
# we import only the required classes
from Autodesk.Revit.DB import \
FilteredElementCollector, BuiltInParameter, \
ParameterValueProvider, ElementId, FilterStringBeginsWith, \
FilterStringContains, FilterStringEndsWith, FilterStringEquals, \
FilterStringGreater, FilterStringGreaterOrEqual, FilterStringLess, \
FilterStringLessOrEqual, FilterStringRule, ElementParameterFilter
# to import all classes use the wildcard '*'
# this will marginally slow down dynamo/python and may cause errors if
# multiple classes are identically named
# from Autodesk.Revit.DB import *
sharedparam=UnwrapElement(IN[0])
doc = DocumentManager.Instance.CurrentDBDocument
fec = FilteredElementCollector
provider = ParameterValueProvider(sharedparam.Id)
# this is for testing
evalBegins = FilterStringBeginsWith()
evalCon = FilterStringContains()
evalEnds = FilterStringEndsWith()
evalEq = FilterStringEquals()
evalGreat = FilterStringGreater()
evalGoEq = FilterStringGreaterOrEqual()
evalLess = FilterStringLess()
evalLoEq = FilterStringLessOrEqual()
#contains
evaluator = evalCon
# string that it is testing agianst
test = 'New'
caseSensitive = False
rule = FilterStringRule(provider, evaluator, test, caseSensitive)
filter = ElementParameterFilter(rule)
items = fec(doc).WherePasses(filter).ToElements()
OUT = items
So how would i do this to check if the parameter (string) is not emtpy?
Or is there a way to construct the rule so it just check for existance of parameters?
so far what i found are Double,Numer,Integer,Boolean and String rules, but non of them have a check to see if the parameter is emtpy (no value) or has any value.