(Created page with "== Feature references == An expression may reference any feature inspection so far in the workflow for the current part. *To reference the entered value of a numeric feature (or the numeric field of a categorical feature), use <code>$x</code>, where <code>x</code> is the balloon label of the feature. *To reference the selected value of a categorical feature (even if it has a numeric value as well), use <code>$$x</code>, where <code>x</code> is the balloon label of the f...") |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Feature references == | == Expression definition == | ||
=== Feature references === | |||
An expression may reference any feature inspection so far in the workflow for the current part. | An expression may reference any feature inspection so far in the workflow for the current part. | ||
Line 6: | Line 8: | ||
*Features without balloon labels cannot be referenced. | *Features without balloon labels cannot be referenced. | ||
== Logical operations == | === Logical operations === | ||
{| class="wikitable" | {| class="wikitable" | ||
|+The following logical operations are supported: | |+The following logical operations are supported: | ||
Line 55: | Line 57: | ||
Logical operations can be infinitely nested. For example, <code>((1 == 1) and (1 < 2)) or not ((3 > 4) and (2 > 1))</code> evaluates to <code>true</code>. | Logical operations can be infinitely nested. For example, <code>((1 == 1) and (1 < 2)) or not ((3 > 4) and (2 > 1))</code> evaluates to <code>true</code>. | ||
== Mathematical operations == | === Mathematical operations === | ||
{| class="wikitable" | {| class="wikitable" | ||
|+The following mathematical operations are supported: | |+The following mathematical operations are supported: | ||
Line 91: | Line 93: | ||
|} | |} | ||
== Functions == | === Functions === | ||
{| class="wikitable" | {| class="wikitable" | ||
|+The following functions are supported: | |+The following functions are supported: | ||
Line 97: | Line 99: | ||
!Description | !Description | ||
!Example | !Example | ||
|- | |||
|<code>equalText(a, b)</code> | |||
|Returns whether ''a'' and ''b'' are the same string | |||
|<code>equalText("OK", "ok")</code> → <code>false</code> | |||
|- | |- | ||
|<code>abs(x)</code> | |<code>abs(x)</code> | ||
Line 151: | Line 157: | ||
|<code>sum(1, 2, 3, 4)</code> → <code>10</code> | |<code>sum(1, 2, 3, 4)</code> → <code>10</code> | ||
|} | |} | ||
The following | {| class="wikitable" | ||
|+The following trigonometric functions are available: | |||
![[wikipedia:Trigonometric_function|Trigonometric function]] | |||
![[wikipedia:Hyperbolic_functions|Hyperbolic function]] | |||
![[wikipedia:Inverse_trigonometric_functions|Inverse function]] | |||
![[wikipedia:Inverse_hyperbolic_functions|Inverse hyperbolic function]] | |||
|- | |||
|<code>sin</code> | |||
|<code>sinh</code> | |||
|<code>asin</code> | |||
|<code>asinh</code> | |||
|- | |||
|<code>cos</code> | |||
|<code>cosh</code> | |||
|<code>acos</code> | |||
|<code>acosh</code> | |||
|- | |||
|<code>tan</code> | |||
|<code>tanh</code> | |||
|<code>atan</code> | |||
|<code>atanh</code> | |||
|- | |||
|<code>sec</code> | |||
|<code>sech</code> | |||
|<code>asec</code> | |||
|<code>asech</code> | |||
|- | |||
|<code>csc</code> | |||
|<code>csch</code> | |||
|<code>acsc</code> | |||
|<code>acsch</code> | |||
|- | |||
|<code>cot</code> | |||
|<code>coth</code> | |||
|<code>acot</code> | |||
|<code>acoth</code> | |||
|} | |||
All trigonometric functions operate in radians. For input in degrees, you can convert the argument using <code>unit(x, 'deg')</code>. | |||
For example: <code>sin(unit(60, 'deg')) = 0.866... = sin(pi / 3)</code>. | |||
=== Constants === | |||
== Constants == | |||
{| class="wikitable" | {| class="wikitable" | ||
|+The following constants are predefined: | |+The following constants are predefined: | ||
Line 181: | Line 217: | ||
|1.618033988749895 | |1.618033988749895 | ||
|} | |} | ||
== Usage == | |||
=== Inspection calculations === | |||
During inspection, you may enter mathematical expressions following the rules outlined above and the evaluated (calculated) result will be entered for the feature's value. For example, you can enter <code>0.6712 - 0.431</code> into the measurement value field and the feature will be measured as <code>0.2402</code> upon leaving the input field. | |||
Focusing back into the input field ''before submitting the inspection'' will reveal the expression as it was originally entered for editing. The raw expressions are discarded upon submitting the inspection. | |||
You can also use the values entered for features that have already been measured in your expressions. For example, to enter a value that is equal to twice the value of the feature with balloon label <code>F3</code>, you can enter <code>$F3 * 2</code>. | |||
Clicking the '''$''' button or pressing '''Ctrl + Space''' while focused in a measurement field will open a list of features that can be referenced. If the button or menu is not visible, no features can be referenced. Features can only be referenced if they meet both of the following conditions: | |||
* The feature has a non-empty balloon label. | |||
* There is a numeric value entered for the feature in the current part workflow. | |||
=== Conditional features === | |||
Features can have conditional expressions that are evaluated each time any feature in the workflow is measured. Any features whose conditional expressions do not evaluate to <code>true</code> will be hidden. | |||
The following rules apply to conditional feature expressions: | |||
* Expressions can reference the value of another feature with <code>$x</code>, where <code>x</code> is the feature's balloon label. | |||
* Expressions can reference the selected value of a categorical feature with <code>$$x</code>. If numeric entry is still allowed for a categorical feature, any entered numeric value can be referenced with <code>$x</code> like a normal feature. | |||
* Be careful not to reference features that come after the current one during inspection because they may not have values entered yet. | |||
Conditional expressions can be configured from the feature instructions step of the feature editor. | |||
==== Examples ==== | |||
* <code>$B2 < 0.1</code> | |||
* <code>not equalText($$C3, "OK")</code> | |||
* <code>not equalText($$6, "OK") or $6 >= 0.012</code> | |||
* <code>(equalText($$A1, "OK") and equalText($$A2, "OK")) or equalText($$A3, "NG")</code> | |||
[[Category:Inspection User Guid]] | [[Category:Inspection User Guid]] |
Latest revision as of 11:15, 26 October 2023
Expression definition
Feature references
An expression may reference any feature inspection so far in the workflow for the current part.
- To reference the entered value of a numeric feature (or the numeric field of a categorical feature), use
$x
, wherex
is the balloon label of the feature. - To reference the selected value of a categorical feature (even if it has a numeric value as well), use
$$x
, wherex
is the balloon label of the feature. - Features without balloon labels cannot be referenced.
Logical operations
Operator | Evaluates to true only when...
|
Example |
---|---|---|
==
|
Both arguments are equal | 1 == 2 → false
|
!=
|
Both arguments are not equal | 1 != 2 → true
|
<
|
Left argument is smaller | 1 < 2 → true
|
>
|
Right argument is smaller | 1 > 2 → false
|
<=
|
Left argument is smaller or equal | 1 <= 2 → true
|
>=
|
Right argument is smaller or equal | 1 >= 2 → false
|
or
|
Either input is true | (1 > 2) or (4 > 3) → true
|
and
|
Both inputs are true | (1 > 2) and (2 >= 3) → false
|
xor
|
Exactly one input is true | true xor true → false
|
not
|
The input is false | not true → false
|
Logical operations can be infinitely nested. For example, ((1 == 1) and (1 < 2)) or not ((3 > 4) and (2 > 1))
evaluates to true
.
Mathematical operations
Operator | Description | Example |
---|---|---|
+
|
Addition | 1 + 2 → 3
|
-
|
Subtraction | 2 - 0.5 → 1.5
|
*
|
Multiplication | 2 * 3 → 6
|
/
|
Division | 9 / 2 → 4.5
|
^
|
Exponentiation | 4 ^ 2 → 16
|
%
|
Remainder | 12 % 5 → 2
|
!
|
Factorial | 4! → 24
|
Functions
Name | Description | Example |
---|---|---|
equalText(a, b)
|
Returns whether a and b are the same string | equalText("OK", "ok") → false
|
abs(x)
|
Returns the absolute value of x | abs(-3) → 3
|
round(x)
|
Round x to the nearest integer | round(1.5) → 2
|
ceil(x)
|
Rounds x up | ceil(1.1) → 2
|
floor(x)
|
Rounds x down | ceil(2.9) → 2
|
log(x)
|
Computes the logarithm base e of x | log(5) → 1.60944...
|
log(x, b)
|
Computes the logarithm base b of x | log(5, 10) → 0.69897...
|
sqrt(x)
|
Returns the square root of x | sqrt(64) → 8
|
min(...)
|
Returns the smallest of its arguments | min(1, 2, 3) → 1
|
max(...)
|
Returns the largest of its arguments | max(1, 2, 3) → 3
|
mean(...)
|
Returns the average of its arguments | mean(1, 5, 10) → 2.666...
|
median(...)
|
Returns the middle of its arguments.
If there are an even number of arguments, it returns the average of the middle two. |
median(2, 5, 7) → 5
|
std(...)
|
Returns the standard deviation of its arguments. | mode(1, 5, 13, 20) → 8
|
sum(...)
|
Returns the sum of its arguments. | sum(1, 2, 3, 4) → 10
|
Trigonometric function | Hyperbolic function | Inverse function | Inverse hyperbolic function |
---|---|---|---|
sin
|
sinh
|
asin
|
asinh
|
cos
|
cosh
|
acos
|
acosh
|
tan
|
tanh
|
atan
|
atanh
|
sec
|
sech
|
asec
|
asech
|
csc
|
csch
|
acsc
|
acsch
|
cot
|
coth
|
acot
|
acoth
|
All trigonometric functions operate in radians. For input in degrees, you can convert the argument using unit(x, 'deg')
.
For example: sin(unit(60, 'deg')) = 0.866... = sin(pi / 3)
.
Constants
Name | Description | Value |
---|---|---|
pi or PI
|
Pi (π) | 3.141592653589793 |
e or E
|
Euler's number (e) | 2.718281828459045 |
phi
|
Golden ratio (φ) | 1.618033988749895 |
Usage
Inspection calculations
During inspection, you may enter mathematical expressions following the rules outlined above and the evaluated (calculated) result will be entered for the feature's value. For example, you can enter 0.6712 - 0.431
into the measurement value field and the feature will be measured as 0.2402
upon leaving the input field.
Focusing back into the input field before submitting the inspection will reveal the expression as it was originally entered for editing. The raw expressions are discarded upon submitting the inspection.
You can also use the values entered for features that have already been measured in your expressions. For example, to enter a value that is equal to twice the value of the feature with balloon label F3
, you can enter $F3 * 2
.
Clicking the $ button or pressing Ctrl + Space while focused in a measurement field will open a list of features that can be referenced. If the button or menu is not visible, no features can be referenced. Features can only be referenced if they meet both of the following conditions:
- The feature has a non-empty balloon label.
- There is a numeric value entered for the feature in the current part workflow.
Conditional features
Features can have conditional expressions that are evaluated each time any feature in the workflow is measured. Any features whose conditional expressions do not evaluate to true
will be hidden.
The following rules apply to conditional feature expressions:
- Expressions can reference the value of another feature with
$x
, wherex
is the feature's balloon label. - Expressions can reference the selected value of a categorical feature with
$$x
. If numeric entry is still allowed for a categorical feature, any entered numeric value can be referenced with$x
like a normal feature. - Be careful not to reference features that come after the current one during inspection because they may not have values entered yet.
Conditional expressions can be configured from the feature instructions step of the feature editor.
Examples
$B2 < 0.1
not equalText($$C3, "OK")
not equalText($$6, "OK") or $6 >= 0.012
(equalText($$A1, "OK") and equalText($$A2, "OK")) or equalText($$A3, "NG")