# Property Expressions

Every feature type has a set of properties that represent its shape, location, and work it will do. Many of these properties are represented as expressions in the form of strings, e.g. "5 + 3.5" or "4 + (1/8 * 2)." The expressions are persistently saved and loaded for each property of a feature, and at run time when the user previews, validates, or runs a door job containing features the expressions are evaluated to a final numeric form, e.g. "5 + 3.5" = 8.5, or "4 + (1/8 * 2)" = 4.25. The numeric form is shown and then used to preview, validate, and ultimately perform work on the door. Expressions can reference other properties, the door parameters, or even other features in the tree. E.g. "5 + Length / 2," "1 + $Parent.Length / 2," or "$Door.Thickness/2 + Width."

If door parameters are referenced, and a machine or machine line supports accurately measuring the door, then the measured dimension will be used for evaluation at run time, e.g. if the DoorData Thickness property is set to 2.0 and the machine measures the door thickness to be 1.9, then 1.9 will be used in the evaluation of "$Door.Thickness".

All evaluations are case insensitive.

## Common Use Case Examples

### Hinge Positioning

By default each features has a center reference point that positions the feature relative to its TWL coordinate location. Hinges are commonly referenced from the edge of the hinge to the top of the door, this can easily be expressed by setting the LReference = Top for the feature group, and LLocation = "25 + Length/2" on the Hinge feature. This will place the hinge exactly 25 inches from the top of the door to the edge of the hinge, regardless of the length of the hinge.

### Top of Plate to Top of Plunge

By default features TWL coordinate zero point (0,0,0) is set to its parent center reference in the tree. Parent properties can be referenced using "$Parent.{PROPERTY_NAME}". A door hardware spec sheet may place a plunge cut edge a distance from the edge of a surrounding plate cut, sometimes referred to as "top of plate to top of plunge distance." This can be expressed by setting the child rectangle's LLocation = "Length/2 - $Parent.Length/2 + 1." This will place a child rectangle exactly 1 inch from the top of the parent rectangle (plate cut) to the edge of child rectangle (plunge cut), regardless of the length of the plate rectangle, plunge rectangle, and LLocation of the plate rectangle.

### Soss Hinge

Soss hinges are a closed pocket cut with "pill shaped" ends, the corner radii are equal to exactly half the width of the rectangle. This can be expressed by setting all of the corner radii expressions of a rectangle equal to "Width/2," e.g. CornerRadius1 = "Width/2", CornerRadius2 = "Width/2", etc. This will ensure the corner radii fully wrap both ends of the rectangle cut regardless of the width or position of the rectangle cut.

## Table of Symbols and Keywords

Symbol | Name | Example |
---|---|---|

"+" | Addition | "5 + 1" = 6 |

"-" | Subtraction | "1 - 8" = -7 |

"/" | Division | "1 / 8" = 0.125 |

"*" | Multiplication | "5 * 3" = 15 |

"(" and ")" | Parenthesis order of operation | "(2 + 2) * 2" = 8 |

"$Parent" | Reference parent feature | "$Parent.Length + 1" |

"$Door" | Reference door data | "$Door.Thickness / 2" |

"$Group" | Reference group locations for the feature | "$Group.WLocation" |

"$Ancestor#" | Reference ancestor (parent or higher) in the tree | "Ancestor1.Length" (0 based index, 0 = parent, 1 = grandparent, etc.) |

"$Math" | Access a math function or constant | "$Math.Max(Length, $Math.PI)" |

"mm" | Number literal millimeter suffix | "40mm + 1" (equal to 40 millimeters plus 1 inch, will evaluate to 40 * 0.03937 + 1, all expressions evaluate to inches) |

"#" | Reference a defined property on the parent feature group | "1 + #MyProperty" |

## Supported Door Properties

Property | Description | Example |
---|---|---|

Length | Length of the door | "$Door.Length" |

Width | Width of the door | "$Door.Width" |

Thickness | Thickness of the door | "$Door.Thickness" |

HingeBevel | Bevel defined for the hinge edge of the door in degrees | "$Door.HingeBevel" |

LockBevel | Bevel defined for the lock edge of the door in degrees | "$Door.LockBevel" |

FeedRatePercent | Feed rate percent defined for the door | "$Door.FeedRatePercent" |

## Supported Math Constants

Name | Description | Example |
---|---|---|

E | Euler's number | "$Math.e" = 2.71828... |

PI | Math constant Pi (π) | "$Math.PI" = 3.14159... |

## Supported Math Functions

Function | Description | Example |
---|---|---|

abs | Absolute value function | "$Math.abs(3 - 5)" = 2 |

sin | Sine trigonometric function accepting angle in radians | "$Math.sin($Math.PI / 2) = 1 |

sind | Sine trigonometric function accepting angle in degrees | "$Math.sind(90)" = 1 |

cos | Cosine trigonometric function accepting angle in radians | "$Math.cos(0)" = 1 |

cosd | Cosine trigonometric function accepting angle in degrees | "$Math.cosd(90)" = 0 |

tan | Tangent trigonometric function accepting angle in radians | "$Math.tan($Math.PI / 4)" = 1 |

tand | Tangent trigonometric function accepting angle in degrees | "$Math.tand(45)" = 1 |

asin | Inverse sine (arcsin) trigonometric function | "$Math.asin(1)" = PI / 2 |

acos | Inverse cosine (arccos) trigonometric function | "$Math.acos(-1)" = PI |

atan | Inverse tangent (arctan) trigonometric function | "$Math.atan(1)" = PI / 4 |

atan2 | Quadrant based inverse tangent (arctan) function, first argument is y, second argument is x, uses the polarity of the arguments to determine quadrant * | "$Math.atan2(-1, 0)" = -PI / 2 |

max | Max value between two arguments | "$Math.max(2, 5)" = 5 |

min | Min value between two arguments | "$Math.min(2, 5)" = 2 |

* See this for more information

## Reserved Symbol Meanings

Identifiers containing "?" will never be defined in KvalCAM expressions which allows it to be used for placeholders, e.g. "dynamic_depth?" or "?dynamic?". This is guaranteed to work as a placeholder (and not accidentally define something meaningful), there is no guarantee on other symbols/strings.