Any arithmetic expressions can be used in numeric inputs. Further processing of these expressions can also be linked to logical IF-THEN-ELSE conditions:
Only round brackets can be used as brackets, square or curly brackets
are not permissible. You can use several nested brackets, but the brackets
must be matched, i.e. every opening bracket must also have a closing bracket.
The following operators can be used in an expression:
+ |
Addition |
/ |
Division |
- |
Subtraction |
^ |
Exponential Operator |
* |
Multiplication |
|
|
Instead of the operator ^, the function name XHY (x to the power of y) can also be used.
An arithmetic expression is evaluated according to the usual mathematical rules.
A logical comparison expression refers to a simple arithmetic comparison a1 op a2, where a1 and a2 are arithmetic expressions linked to a comparison operator op; op can be one of the following operators:
= |
equal to |
< |
less than |
<> |
unequal to |
< |
less than or equal to |
> |
greater than |
> |
greater than or equal to |
A logical comparison expression, however, can be formed from several simple arithmetic comparisons using the logical operators AND and OR.
Logical comparison expressions are important, for example, if the value assignment to a variable is to be made dependent on certain conditions.
ABS |
Absolute value |
LOG |
Natural logarithm |
ACOS |
Arc cosine |
LOG 10 |
Decade logarithm |
AINT |
Integer (whole number portion) |
NINT |
Next integer value (rounds to next whole number) |
ARC |
Conversion of degrees to radians |
SIG |
Signum (sign function: 1, 0 or -1 ) |
ASC |
ASCII code of a character |
SIN |
Sine |
ASIN |
Arc sine |
SINH |
Hyperbolic sine |
ATAN |
Arc tangent |
SQR |
Square |
COS |
Cosine |
SQRT |
Square root |
COSH |
Hyperbolic cosine |
TAN |
Tangent |
EXP |
Exponential function |
TANH |
Hyperbolic tangent |
GRD |
Conversion of radians to degrees |
VAL |
Convert string to number |
LEN |
Length of a string |
|
|
Example: SQRT (A*A + B*B) returns
Although the trigonometric functions generally only process values in radians, inputs and results are processed and output in degrees within the HiCAD formula interpreter, depending on the angle unit defined. You use the ARC and GRD functions to convert between degrees and radians.
The value assignment to a variable can depend on a condition. Two syntactic forms are possible:
where vglad stands for a logical comparison expression and a and b for any arithmetic expressions.
In the first form of the IF-condition, the value assignment is only performed if vglad is fulfilled, i.e. is true. In this case, the value of the expression a is assigned to the variable. In the other case, no value is assigned.
In the second form of the IF-condition, the value of the arithmetic expression is assigned to variable v if vglad is fulfilled; if not, the value of expression b is assigned.
The conditional value assignment will be used most within macro procedures and variants and can have extremely different forms. If, for example, you want the height of the text annotation to be selected depending on scale, a comparison of system variable @2 with a constant value generally suffices:
IF @2 < 100 THEN 2.5 ELSE 3
For scale numbers up to and including 100, annotation size 2.5 mm is selected and 3 mm for larger scales
Arithmetic expressions can also be contained as a component in compound statements. For example, it is possible to use arithmetic expressions for point options A, R, P, W and D, which expect numeric arguments.
The following should be borne in mind for this application type as an argument of point options and as an argument after a distance and angle input:
Example:
P L d is interpreted as a point option "polar coordinates with the angle last used and distance d", while the expressions P (L) d or P + L d use the value of variable L as the angle.
The same applies to options Z and FA which enable you to take distances and angles from the drawing.
Version 1702 - HiCAD Basics | Date: 9/2012 | © Copyright 2012, ISD Software und Systeme GmbH