*if()
Used to conditionally execute branches of code.
Syntax
*if ([expression])
Type
HyperMesh Template Command
Description
Used to conditionally execute branches of code. This is useful for testing and acting on a
condition. The following operators are available:
==, = | equal |
!= | not equal |
<= | less than or equal |
< | less than |
>= | greater than or equal |
> | greater than |
% | modulus |
This command must be accompanied by a *endif() command at the end of the block.
Inputs
- expression
- Relational expression. This must be enclosed in square brackets.
Example
To output a portion of a CQUAD4 element with conditions depending on the property assignment:
*elements(104,1,"CQUAD4","")
*format()
*string("CQUAD4 ")
*field(integer,id,8)
*if([propertyid == 0])
*field(integer,collector.propertyid,8)
*else()
*field(integer,propertyid,8)
*endif()
*field(integer,node1.id,8)
*field(integer,node2.id,8)
*field(integer,node3.id,8)
*field(integer,node4.id,8)
*end()
*output()