Elements filter
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 list of categories from the category filter and the list of conditions from the parameter filter can be copied to the clipboard and pasted from the clipboard via the right-click context menu.
Category Filter
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 , to display only the checked categories or check the categories whose elements are present on the current view . Checked categories can be saved to sets for later use both in the current plugin and in other plugins that use the category filter.
You can load a category set (check categories from the selected set) using .
Parameter filter
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:
= | – equal |
< | – less |
<= | – less or equal |
> | – greater |
>= | – greater or equal |
<> | – not equal |
~ | – contains |
!~ | – does not contain |
Conditions are edited in a separate window:
Rules of creating conditions:
- You can enter multiple valid values in the "Values" field, separated by a comma. A parameter is considered to satisfy the condition if its value matches at least one valid value.
- The condition "Presence of parameter" means that the element will be processed if there is such a parameter, regardless of the parameter value.
- The condition "Absence of parameter " means that the element will be processed in the absence of such a parameter.
- String parameters are checked only by the conditions "Equal", "Not equal", "Contains", "Not contains".
- Numeric parameters are checked by all conditions except "Contains".
- The "Contains" condition checks that the element parameter contains at least one of the valid values. The condition "Not contains", respectively, checks that the parameter does not contain at least one of the values.
- To use the "Starts with" condition, select the "Contains" condition and add an "*" to the end of the value. For example, "Wall*".
- To use the "Ends on" condition, select the "Contains" condition and add a "*" at the beginning of the value. For example, "*Wall".
- To use the "Not starts with" condition, select the "Not contains" condition and add an "*" to the end of the value. For example, "Wall*".
- To use the "Not ends with " condition, select the "Not contains" condition and add a "*" sign to the beginning of the value. For example, "*Wall".
- String values are case-sensitive.
- Parameters of type "on/off" are checked as an integer (0-off, 1-on).
- All simple nested conditions of a group condition are checked with the "AND" operator – i.e. all nested conditions must match.</i8
- Instead of parameter name it is possible to specify GUID for shared parameters or system name for built-in parameters.
- The conditions "Presence of parameter" and "Absence of parameter" when checking the parent Group (keyword Group) check, respectively, whether the element is in the Group or not.
- The conditions "Presence of parameter" and "Absence of parameter" when checking the parent Assembly (keyword Assembly) check, respectively, whether the element is in the Assembly or not.
- When using the key parameters "BottomZ" and "TopZ", the lowest and highest elevation from the element geometry are checked, respectively. The key parameters "BottomZ" and "TopZ" are considered numeric and are checked by the corresponding conditions. The values of the elevations are taken in millimeters rounded to three decimal places. In the "Value" field you can specify level names: if the specified level is found, its elevation in millimeters rounded to 3 decimal places will be used.
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.