You can control geometry using mathematical expressions that include the names of dimensional constraints, user variables, and functions.
Formulas and equations can be represented either as expressions within dimensional constraints or by defining a user variables. For example, the following illustration represents a design that constrains a circle to the center of the rectangle with an area equal to that of the rectangle.
The Length and Width dimensional constraints are set to constants. The d1 and d2 constraints are simple expressions that reference the Length and Width. The Radius dimensional constraint is set to an expression that includes the square root function, parentheses to determine the precedence of operations, the Area user variable, the division operator, and the constant, PI. These parameters are all displayed in the Parameters Manager.
As you can see, part of the equation for determining the area of the circle is included in the Radius dimensional constraint and part was defined as a user variable. Alternatively, the entire expression, sqrt (Length * Width / PI), could have been assigned to the Radius dimensional constraint, defined in a user variable, or some other combination.
Work with the Parameters Manager
The Parameters Manager displays dimensional constraints (both dynamic constraints and annotational constraints), reference constraints, and user variables. You can easily create, modify, and delete parameters from the Parameters Manager.
The Parameters Manager supports the following operations:
Dimensional constraints and user variables support the following operators within expressions:
Operator | Description |
---|---|
+ | Addition |
- | Subtraction or unary negation |
% | Floating point modulo |
* | Multiplication |
/ | Division |
^ | Exponentiation |
( ) | Parenthesis, expression delimiter |
. | Decimal separator |
Understand Precedence in Expressions
Expressions are evaluated according to the following standard mathematical rules of precedence:
Expressions are evaluated using the standard precedence as shown in the following table in descending order.
Functions Supported in Expressions
The following functions are available for use in expressions:
Function | Syntax |
---|---|
Cosine | cos(expression) |
Sine | sin(expression) |
Tangent | tan(expression) |
Arc cosine | acos(expression) |
Arc sine | asin(expression) |
Arc tangent | atan(expression) |
Hyperbolic cosine | cosh(expression) |
Hyperbolic sine | sinh(expression) |
Hyperbolic tangent | tanh(expression) |
Arc hyperbolic cosine | acosh(expression) |
Arc hyperbolic sine | asinh(expression) |
Arc hyperbolic tangent | atanh(expression) |
Square root | sqrt(expression) |
Signum function (-1,0,1) | sign(expression) |
Round to nearest integer | round(expression) |
Truncate decimal | trunc(expression) |
Round down | floor(expression) |
Round up | ceil(expression) |
Absolute value | abs(expression) |
Largest element in array | max(expression1;expression2) |
Smallest element in array | min(expression1;expression2) |
Degrees to radians | d2r(expression) |
Radians to degrees | r2d(expression) |
Logarithm, base e | ln(expression) |
Logarithm, base 10 | log(expression) |
Exponent, base e | exp(expression) |
Exponent, base 10 | exp10(expression) |
Power function | pow(expression1;expression2) |
Random decimal, 0-1 | Random |
In addition to these functions, the constants Pi and e are also available for use in expressions.