Expressions in a formula which depend on a calculation or comparison
A conditional statement is one that evaluates to 0 if the statement is false and 1 if the statement is true
This allows conditions in a formula
=(X>400)
=((Z-12)<500)
The statement (X>400) means:-
If X (the part length) is greater than 400 the statement is set to 1 (true) or if X is less than 400 the statement is set to 0 (false).
A typical use of these statements is in the repeat box (for Machining instructions).
On some parts the number of holes may depend on the overall length of the part. The following formula in the Repeat box produces 3 holes if the part is less than 1000mm and 5 holes if it is more than 1000mm.
32: 2 + 2*(X>=1000)
Note - in this case the number of repeats is either 2 or 4 (hence 3 or 5 holes for the full sequence). The full range of conditional statements is:-
> greater than
< less than
= equal to
>= greater than or equal to
<= less than or equal to
<> not equal to
!: does not contain
-> starts with
<- ends with
Advanced conditions - Enter the condition in the format =IF(condition, true-expression, false-expression). The statement acts as an if-then-else calculation, for example:
=IF(("@DECOR@"="D"), 100, 200)
Evaluates to 100 if @DECOR@ is"D" otherwise it evaluates to 200.
The condition expression, true-expression and false-expression can all be formula, allowing nesting. For example:-
=IF(("@DECOR@"="D"), 100, IF(("@DECOR@"="E"), 300, 200))
This is evaluated as 'if @DECOR@="D" then width = 100, else if @DECOR@="E" then width = 300, else width = 200'
=IF(&FORM1&>500, 10, 20)
evaluates to 10 if the result of &FORM1& is greater than 500, otherwise it is 20
If the condition-expression evaluates to any number other than 0 then this is taken to be TRUE.
For example, the following formula for a shelf width in the product definition determines the width of the shelf based on whether the bookcase is in the deluxe or standard range.
Product: Bookcase: Description: @RANGE@
Part Material Length Width Qty
SHELF/1 WHITE-MEL 920.0 =IF((@RANGE@="STANDARD"),300, 450)
In this example the number of shelves depends on the bookcase height.
Product: Bookcase: Description:
Part Material Length Width Qty
SHELF/1 WHITE-MEL 920.0 320.0 =IF(Y>920.0,2,3)
If the condition-expression evaluates to any number other than 0 then this is taken to be TRUE.
Where the variable is defined as boolean, that is, has an answer of Yes (Y) or No (N) the conditional statement is different.
=IF(@EXTRASHELF@,3,4)
Returns 3 if @EXTRASHELF@ is Y and returns 4 if @EXTRASHELF@ is N.
Where the variable is a number or measurement and may be a fractional inch the statement is different.
=IF(@SHELFTHICK@=F(1-1/2),3,4)
The function indicating a fraction must be included so that the program can interpret the measurement or number correctly.
Returns 3 if @SHELFTHICK@ equals (1-1/2) and returns 4 if @SHELFTHICK@ is not equal to (1-1/2)
The fractional value is expressed with the F(...) so that (1-1/2) is not evaluated to 0.5.