Reputation: 13
I have started a python script that extracts the filter rule information, but can't find a way to get the information out of the "GetRuleParameters()"
Any help is greatly appreciated. I've seen a lot of information on creating rule filters, but little on extracting the rule information.
Here is an example for filter overrides in a view
Here is where I am at:
pfes = list(FilteredElementCollector(doc).OfClass(ParameterFilterElement).ToElements()) for pfe in pfes:
rps = pfe.GetRuleParameters()
for rp in rps:
print rp.ToString()
el = doc.GetElement(rp)
print el
Upvotes: 1
Views: 1651
Reputation: 51
As a starting point it would be more helpful to print the name of the classes rather than to convert the classes to a string. That will not get you everything though. GetRuleParameters will return the elementID of the parameters that are used in the rule; however, the element id of built in parameters is negative. The GetElement function doesn't seem to find parameters if they have a negative element id. I can't find a way to get the built in parameter from the id.
for pfe in pfes:
print(pfe.Name)
rps = pfe.GetRuleParameters()
for rp in rps:
el = doc.GetElement(rp)
# this will only work if the parameter used in the
# filter is not built in
try:
print("\t" + el.Name)
except:
pass
Upvotes: 1
Reputation: 8294
You can use RevitLookup to explore the properties and parameter values of the rule parameter elements that are returned via the list of element ids, or research in more depth using the interactive RPS console.
Upvotes: 0