filter_set
filter_set -setd_setObj-exprs_expression| -expr_exs_extendedExpr
Description
Returns a set containing objects from the original set that meet the criteria given by a simple expression (-expr) or a Tcl expression (-expr_ex) which compares property values for objects in the given set to target values. A number of operators are available.
The syntax for simple expressions differs from the Tcl syntax. Basic syntax differences are shown in the following table.
|
Name must be preceded by a dollar sign ($); for example, |
||
|
String must be enclosed in double quotes ("); for example, |
Arguments
Value Returned
|
Is the set of objects that meet the expression criteria. If any object in the original set does not have the given property, an error message is issued and a NULL set is returned. |
Examples
Example 1—Simple expression using -expr
The following command evaluates objects in the selected set and returns a set containing all objects whose direction is WEST.
filter_set -set [get_selection_set] -expr {direction == WEST}
If any object in the selected set does not have a direction property, the command will fail and return a NULL set.
Example 2—Simple expression using -expr_ex
The following command will return the same set of objects as in the above example but this command uses the -expr_ex syntax instead.
filter_set -set [get_selection_set] -expr_ex {$direction == "WEST"}
Example 3—Compound expression using -expr_ex
The following command returns the set of objects whose length is greater than 3 and whose direction ends with "TH".
filter_set -set $set1 -expr_ex {$length > 3 && [string match "*TH" $direction]}
Related Topics
Return to top