Operations and Functions in BricsCAD Expressions
Quick answer: BricsCAD expressions, used anywhere a parameter or constraint accepts one, support six mathematical operators and 29 functions, evaluated according to standard mathematical precedence.
Operators
| Operation | Character | Description |
|---|---|---|
| Addition | + |
Produces the sum of numeric values |
| Subtraction | - |
Subtracts one numeric value from another |
| Multiplication | * |
Multiplies numeric values |
| Division | / |
Divides one numeric value by another |
| Exponentiation | ^ |
Calculates the exponential value of the given numbers |
| Remainder | % |
Gives the remainder after dividing one numeric value by another; for example, 5%2 equals 1, since 5 divided by 2 leaves a remainder of 1 |
Expression Precedence
Expressions evaluate according to standard mathematical rules:
- Expressions within brackets, innermost sets first.
- Then, in order: exponents, then multiplication and division, then addition and subtraction.
- Operators of equal precedence evaluate left to right.
Functions
| Function | Syntax |
|---|---|
| Sine / Cosine / Tangent | sin() / cos() / tan() |
| Arc sine / Arc cosine / Arc tangent | asin() / acos() / atan() |
| Hyperbolic sine / cosine / tangent | sinh() / cosh() / tanh() |
| Arc hyperbolic sine / cosine / tangent | asinh() / acosh() / atanh() |
| Square root | sqrt() |
| Signum function (-1, 0, 1) | sign() |
| Round to nearest integer | round() |
| Truncate decimal | trunc() |
| Round down / up | floor() / ceil() |
| Absolute value | abs() |
| Largest / smallest of two values | max(a;b) / min(a;b) |
| Degrees to radians / radians to degrees | d2r() / r2d() |
| Logarithm, base e / base 10 | ln() / log() |
| Exponent, base e / base 10 | exp() / exp10() |
| Power | pow(a;b) |
| Random decimal between 0 and 1 | Random |
For functions taking two values, use whichever list separator character your system uses, a comma or a semicolon.
Constants
The constants Pi (3.14…) and e (2.72…) are available in expressions. Their names can’t be reused as a parameter or constraint name.
CLEANUNUSEDVARIABLES purges parameters that aren’t used in any constraint expression and aren’t linked to a dimension.
Frequently Asked Questions
Where can I actually use these operators and functions in BricsCAD? Anywhere an expression is accepted, dimensional constraints, general parameters, and design table configuration values all use the same syntax.
What list separator should I use for functions like max() or pow() that take two values? Whichever your system uses by default, a comma or a semicolon both work.
Can I name a parameter “Pi” or “e”? No, both names are reserved as built-in constants and can’t be reused as a parameter or constraint name.
How do I clean up parameters I’ve created but no longer use? Run CLEANUNUSEDVARIABLES, which purges anything not used in a constraint expression or linked to a dimension.