Elements filter is a tool for filtering elements by category and/or parameter, consisting of filtering algorithms and customization interface (hereinafter referred to as the tool). The tool is used in many plugins. For example, in the Worksets, Copy Values, Coloring elements, etc.
The tool consists of two filters - a filter by category and a filter by parameter. Some plugins allow you to use only one of the filters. For example, the Side of the world plugin uses only the filter by parameters.
In the plugin's interface, the tool can have a horizontal form:
Or a vertical form:
If the tool uses both filters, there is an AND/OR logical operator between them. The AND operator means that the item satisfies the filter conditions if it satisfies the conditions of both filters. The OR operator, respectively, means that the item satisfies the filter conditions if it satisfies the conditions of at least one of the two filters.
The Category Filter is a list of allowed categories. Editing the list of categories is performed in the dialog box of the parent window (plugin window):
At the top of the dialog is a field to search for a category. The search is performed both by displayed category name and by unique program name. If you enter an asterisk (*) in the search field, all selected categories will be displayed. The buttons to the right of the list allow you to uncheck all categories and display only the checked categories .
A parameter filter is a list of conditions separated by an AND or OR logical operator. In the filter field, the conditions are written with a special syntax, which uses symbols for comparison operators:
|- less or equal
|- greater or equal
|- not equal
|- does not contain
Conditions are edited in a separate window:
At the top of the window there is a link Instruction. When hovering the mouse cursor over the link, a tooltip appears that describes various nuances and explanations for creating conditions.
There are two links to the right that act as buttons to add a new simple or group condition to the list of conditions.
In the entry field of the parameter identifier, there can be a button that allows to select a parameter from the list:
This button appears if categories are specified in the Category filter. If there are instances of elements of these categories in the current document, then two lists will be available - the parameters of instances and the parameters of types. If there are no instances in the model, but there are types, then there will be only one list - with type parameters.
As a parameter identifier, it is possible to specify the parameter name, the GUID of a shared parameter, or the system name of a built-in parameter.
In addition to parameters, conditions can use the element ID (ID), the element Type ID (TypeID), and the element parent group (Group) and the element parent assembly (Assembly), if available.
A group condition is a list of simple conditions. All simple conditions inside the group condition are checked with the AND logical operator. I.e. an element satisfies the group condition if it satisfies all the nested simple conditions. In the filter field, the group condition is highlighted by square brackets.
At the bottom of the window there is a drop-down list Element is suitable if that specifies the logical operator used between all the conditions. The value all conditions match corresponds to the logical operator AND, and the value any of conditions match corresponds to the logical operator OR.
The example from the screenshot above in the filter field would look like this:
which means that the wall is matched if it has the value "W-1" in the "Mark" parameter or if it has the value "W-2" in the "Mark" parameter and the value "1" in the "Structural" parameter.
Searching for the required parameters in the checking element is performed by the parameter name. At that, the parameter is first searched in the list of instance parameters, and then (if not found) - in the list of type parameters.
When checking the values of string parameters by operators "Equal", "Not equal", "Contains", "Not contain" the register is taken into account.