OFF_PYTHON_EXPRESSION
Hide entities for which a Python expression returns true. The command evaluates the expression for each entity in all loaded drawing files and marks those that match as hidden.
Parameters
| Parameter number | Description | Optional |
|---|---|---|
| 1 | Python expression. All text after the = sign forms the expression. Leading and trailing spaces are ignored.or Names of code table selections, each preceded by # and separated by spaces. |
Yes. Without parameters, the command displays the Python expression dialog box described in ON_PYTHON_EXPRESSION. |
The variable g, attributes (g.codes[0].attributes), the value the expression must return, code snippets, and errors are explained in ON_PYTHON_EXPRESSION. The same rules for names with # apply as in that command.
Examples
To hide entities with exactly 3 vertices:
OFF_PYTHON_EXPRESSION=len(g) == 3
To hide polygons larger than 1000 square units:
OFF_PYTHON_EXPRESSION=type(g).__name__ == 'Polygon' and g.area > 1000
To hide entities matching the code table's "Edificios" or "Deportivo" selection:
OFF_PYTHON_EXPRESSION=#Edificios #Deportivo
Notes
- The command acts on all entities in all loaded drawing files.
- If the expression fails, Digi3D.AI displays the Python error once for each drawing file where it fails (with selection names, once for each selection and drawing file where it fails), and OFF_PYTHON_EXPRESSION hides no entities in that file based on the failed expression. With multiple selection names (
#), OFF_PYTHON_EXPRESSION hides entities matching selections whose expressions do not fail. If OFF_PYTHON_EXPRESSION is part of a macro (@), Digi3D.AI runs the next command after the user closes the message box, even if OFF_PYTHON_EXPRESSION hid no entities. The Errors section of ON_PYTHON_EXPRESSION describes the errors. - Hidden entities are not drawn in the drawing or photogrammetric window. To show them again, run ON_PYTHON_EXPRESSION or SEE_ALL_ENTITIES.
Command characteristics
| Command type | Immediate command |
|---|---|
| Repeats automatically | No |
| Menu option | View/Hide those that comply with Python expression... |
| Toolbar | This command has no associated toolbar button |
| Extension | DigiNG.OrdenesStandard.dll |
| Implementation | Native |
| Related variables | No related variables |
| Related commands | ON_PYTHON_EXPRESSION ON_ONLY_PYTHON_EXPRESSION OFF_ALL |
| Internal name | {81442225-19EB-4577-9EE9-1E74B7A59F0F} |