To construct an If statement, in the Geometry toolbar, from the
Programming menu, select
If + End If (you can also do this by right-clicking the
Geometry node in the model tree and opening the
Programming submenu). This adds an
If node (
) and an
End If node (
) after the current node. You can optionally add
Else If (
) nodes and an
Else node (
) in a similar way. To add these nodes at an arbitrary position in a geometry sequence, you can right-click a geometry feature node and select
If,
Else If,
Else, or
End If on the
Add Before or
Add After submenu. This adds the selected type of programming feature before or after the selected node, without building the preceding feature node.
where the Else If and
Else nodes are optional. There can be an arbitrary number of geometry features in each branch, and there can be an arbitrary number of
Else If nodes. The
Else node must appear after all
Else If nodes and before the
End If node.
The Settings windows for
If and
Else If have a
Condition field, which contains a logical condition in terms of parameters (for example,
a+b>0, where
a and
b are defined as parameters for the geometry sequence). In general, the condition is true if it evaluates to a nonzero value. When building the geometry sequence, the program builds the features in the first branch that has a true condition and treats the other branches as disabled. If none of the conditions are true, the program builds the
Else branch.
If you select a feature in a branch and click Build Selected, the software pretends that the chosen branch has a true condition and that all other branches have false conditions. You can use this behavior to try out the different branches without having to change the parameters. If statements can be nested.