i am actually working on an tool which creates “ParameterFilterElements”. The aim behind of it -> handling all filters in an Excel and than let dynamo create the “ParameterFilterElements”. This is already running and doing well. The information in this workflow comes from excel.
So where is the Problem:
If i have to use the tool again to do some changes to some “filter.rules” it can’t be written to revit, because the “ParameterFilterElement.byRules” can’t change or overwrite an existing “ParameterFilterElement”.
What i have tried:
It is no problem to divide the existing “ParameterFilterElements” from the new ones and just create those who are new. So the new ones can be created but those who are already in revit can’t be changed.
Workaround – delete & new:
A Workaround which would work is, to delete the existing “ParameterFilteElements” and create the new one.
In this case, all definitions in the the “view templates” also will be deleted – so this workaround is not that straight forward…
Is there any way to change the existing “filter.rules” in the “ParameterFilteElement”??
If you are handy with the Revit API - it appears that there is a method for ParameterFilterElements called ClearRules() which would seem to leave the ParameterFilterElement intact but be waiting for a new revised set of rules from your script.
After clearing the rules for an existing parameter filter element, is there a node that will set new rules without creating a new filter? If not, do you have an example of how to set new filter rules through Revit API? Thanks
Via the API - you have to first use the Create() method to create the ParameterFilterElement. This is the same as going through the UI and going to filters and creating a new filter and giving it a name. No rules are set yet - it’s just an empty ParameterFilterElement at that point. So in the API - if you use ClearRules() then you have just emptied the rules out of the ParameterFilterElement. You then set the new set of rules the same as when you first created the ParameterFilterElement (see post below)