You can use equations wherever you can enter a numeric value.
For example, you can write equations in the Edit Dimensions dialog, feature dialogs, and the Parameters dialog. You can use equations to calculate feature sizes, calculate assembly constraint offsets or angles, or simulate motion among several components.
Equations can be simple or contain many algebraic operators, prefixes, and functions. For example, here is a simple equation:
2 ul *(6+3)
The following complex equation uses internal parameters such as pi:
(PI rad/5 ul +(25 deg *PI rad)/180 deg))
See Functions, prefixes, and algebraic operators for a list of supported functions in edit boxes.
Algebraic Operators
- + addition
- - subtraction
- % floating point modulo
- * multiplication
- / division
- ^ power
- ( expression delimiter
- ) expression delimiter
- ; delimiter for multiargument functions
Syntax
The edit box uses the units specified in the default document properties. If you do not specify units in an edit box, terms and coefficients are assigned default units. An expression is evaluated according to the algebraic order of operations and default unit values.
- Syntax errors
- Exponents are applied to units as well as the expression. For example:
2 + 3^3
The edit box assigns default units to all terms unless a unit is specified. The results are in error because dissimilar units cannot be added: 2 mm + (3 mm)^3ul is evaluated as 2 mm + 27 mm^3. Because the units are ambiguous, the expression is shown in red to indicate an error:
2 + 3^3
Including units and specifying which units are unitless results in the correct evaluation: 2 mm + ((3 ul) ^ 3 ul ) * 1 mm.
- Typecasting
- Does not allow assignment of units to an expression. The following example is not permitted:
(-2.00 + 3^3) m^2
- Unit evaluation
- Units are evaluated before the arithmetic portion of an expression. Therefore, the power operator applies to a unit before it applies to an adjacent numeric value. For example:
2 m^2
does not evaluate to 4 square meters, but rather means 2 square meters. The correct syntax is:
(2 m)^2 = 4 m^2
- Correct syntax
- In expressions, assign a unit to each numerical value in the expression. The following expression is in error because the system expects default units:
(2 + 1 * (3^2))
Use "ul" to indicate a unitless value: 2 mm + 1 mm * (3ul^2ul).
When entering an angle, the default unit is degrees. To enter radians, use this syntax:
(-0.25 deg * 3.1415 rad/1 deg) + (2ul * 3.1415 ul ) * 1 rad
Units
For a list of supported unit types and their abbreviations, add a numeric parameter to the Parameters dialog, enter a name, and then click in the Units column.
isolate(Width;mm;ul)
The Number of Occurrences value in a dialog requires a unitless (ul) result, but you are referencing the unit width, which is a linear value. Convert the Width parameter to a unitless value.
Prefixes
When you use unit prefixes in an equation, enter the prefix symbol rather than the prefix itself. For example, an equation that includes the unit "nanometer" might look like this equation: 3.5 ul * 2.6 nm.
"exa" "E" |
1.0e18 |
"peta" "P" |
1.0e15 |
"tera" "T" |
1.0e12 |
"giga" "G" |
1.0e9 |
"mega" "M" |
1.0e6 |
"kilo" "k" |
1.0e3 |
"hecto" "h" |
1.0e2 |
"deca" "da" |
1.0e1 |
"deka" "da" |
1.0e1 |
"deci" "d" |
1.0e-1 |
"centi" "c" |
1.0e-2 |
"milli" "m" |
1.0e-3 |
"micro" "micro" |
1.0e-6 |
"nano" "n" |
1.0e-9 |
"pico" "p" |
1.0e-12 |
"femto" "f" |
1.0e-15 |
"atto" "a" |
1.0e-18 |
Reserved Parameters
The following are the reserved system parameters supported by Inventor.- PI
- Value3.14159265358979323846264338328
- E
- Value 2.71828182845904523536
Edit Box Parsing Reference
Input Expression |
Unit Assumption |
Final Unit |
1st Post Parse |
Final Unit |
2nd Post Parse |
Final Unit |
3 |
3 mm |
mm |
||||
3 * 4 |
3 mm * 4 mm |
mm^2 |
3 mm * 4 ul |
mm ul |
||
3 mm * 4 |
3 mm * 4 mm |
mm^2 |
3 mm * 4 ul |
mm ul |
||
3 * 4 mm |
3 mm * 4 mm |
mm^2 |
3 mm * 4 mm |
mm^2 |
3 ul * 4 mm |
mm ul |
3 / 4 |
3 mm/ 4 mm |
none |
3 mm / 4 ul |
mm / ul |
||
3 mm / 4 |
3 mm / 4 mm |
none |
3 mm / 4 ul |
mm /ul |
||
3 / 4 mm |
3 mm / 4 mm |
none |
3 mm / 4 mm (no change) |
none |
3 ul / 4 mm |
ul/mm (mismatch) |
3 * cos(30) |
3 mm * cos(30 mm) |
error |
3 mm * cos(30deg) |
mm ul |
||
cos(30) * 3 |
cos(30mm) * 3 mm |
error |
cos(30deg) * 3 mm |
mm ul |
||
3 *cos(2 * 15) |
3 mm * cos(2 mm * 15 mm) |
error |
3 mm * cos(2 deg * 15 ul) |
mm ul |
||
3 * cos(2 * 15 deg) |
3 mm * cos( 2 mm * 15 deg) |
error |
3 mm * cos(2 deg * 15 deg) |
error |
3 ul * cos(2 deg * 15 deg) |
error |
3 * cos(15 deg * 2) |
3 mm * cos(15 deg * 2 deg) |
error |
3 mm * cos(15 deg * 2 ul) |
mm ul |
||
3mm *cos(2 * 15) |
3 mm * cos(2 mm * 15 mm) |
error |
3 mm * cos(2 deg * 15 ul) |
mm ul |
||
3mm * cos(2 * 15 deg) |
3 mm * cos( 2 mm * 15 deg) |
error |
3 mm * cos(2 deg * 15 deg) |
error |
3 mm * cos( 2 ul * 15 deg) |
mm ul |
3mm * cos(15 deg * 2) |
3 mm * cos(15 deg * 2 deg) |
error |
3 mm * cos(15 deg * 2 ul) |
mm ul |