Expressions
Every Feature's properties, and every Door Data and Jamb Data property, are expressions: formulas saved as text, such as 5 + 3.5 or 4 + (1/8 * 2). When you preview, validate, or run a Door Job, KvalCAM evaluates each expression to a number (8.5 and 4.25 here). The Evaluation column next to each expression shows its current value.
Expressions can refer to other properties of the same Feature, to the door and jamb, to defined properties, and to other Features in the tree. For example: 5 + Length / 2, 1 + $Parent.Length / 2, or $Door.Thickness / 2 + Width.
- Expressions are not case-sensitive.
- All values are in inches. Add
mmto a number to enter it in millimeters:40mm + 1is 40 millimeters plus 1 inch. - If a machine measures the door as it runs, the measured size is used. For example, if the Door Data thickness is 2.0 and the machine measures 1.9,
$Door.Thicknessevaluates to 1.9.
TIP
To copy an expression, select the copy icon at the left of its row. To pick from common expressions, select the property's cell, then select the … button.
Symbols and Keywords
| Symbol | Meaning | Example |
|---|---|---|
+ | Addition | 5 + 1 = 6 |
- | Subtraction | 1 - 8 = -7 |
* | Multiplication | 5 * 3 = 15 |
/ | Division | 1 / 8 = 0.125 |
( ) | Order of operations | (2 + 2) * 2 = 8 |
mm | Millimeter suffix for a number | 40mm + 1 = 40 × 0.03937 + 1 |
$Door | Door Data property | $Door.Thickness / 2 |
$Jamb | Jamb Data property | $Jamb.GapHingeSide |
$Parent | Property of the parent Feature | $Parent.Length + 1 |
$Ancestor# | Property of a Feature higher in the tree: 0 is the parent, 1 the grandparent, and so on | $Ancestor1.Length |
$Group | The Feature Group's location for the Feature | $Group.WLocation |
# | A defined property of the Feature Group | 1 + #MyProperty |
$Math | A math function or constant | $Math.max(Length, $Math.PI) |
Reserved Symbol
? is never used in KvalCAM expressions. That makes it safe to use in placeholders, such as dynamic_depth? or ?dynamic?; no other symbol is guaranteed to stay unused. An expression containing a placeholder can't be evaluated, so the Feature won't validate until it's replaced.
Door Properties
| Property | Description | Expression |
|---|---|---|
| Length | Length of the door | $Door.Length |
| Width | Width of the door | $Door.Width |
| Thickness | Thickness of the door | $Door.Thickness |
| HingeBevel | Bevel of the hinge edge, in degrees | $Door.HingeBevel |
| LockBevel | Bevel of the lock edge, in degrees | $Door.LockBevel |
| FeedRatePercent | Feed rate percent for the door | $Door.FeedRatePercent |
Jamb Properties
Jamb properties are named $Jamb. followed by the section and property, for example $Jamb.HingeSideWidth or $Jamb.GapHeader. See Jamb Expressions for the full list.
Math Constants
| Name | Description | Example |
|---|---|---|
| E | Euler's number | $Math.e = 2.71828… |
| PI | Pi (π) | $Math.PI = 3.14159… |
Math Functions
| Function | Description | Example |
|---|---|---|
| abs | Absolute value | $Math.abs(3 - 5) = 2 |
| sin | Sine, angle in radians | $Math.sin($Math.PI / 2) = 1 |
| sind | Sine, angle in degrees | $Math.sind(90) = 1 |
| cos | Cosine, angle in radians | $Math.cos(0) = 1 |
| cosd | Cosine, angle in degrees | $Math.cosd(90) = 0 |
| tan | Tangent, angle in radians | $Math.tan($Math.PI / 4) = 1 |
| tand | Tangent, angle in degrees | $Math.tand(45) = 1 |
| asin | Inverse sine (arcsine) | $Math.asin(1) = π / 2 |
| acos | Inverse cosine (arccosine) | $Math.acos(-1) = π |
| atan | Inverse tangent (arctangent) | $Math.atan(1) = π / 4 |
| atan2 | Inverse tangent using the signs of both arguments to find the quadrant. The first argument is y, the second x. See Math.Atan2 | $Math.atan2(-1, 0) = -π / 2 |
| max | Larger of two values | $Math.max(2, 5) = 5 |
| min | Smaller of two values | $Math.min(2, 5) = 2 |
Examples
Hinge Positioning
Each Feature is positioned by its center. Hinges are usually measured from the top of the door to the top edge of the hinge instead. To do that, set the Feature Group's L Reference to Top and the hinge Feature's LLocation to 25 + Length / 2. The top of the hinge is then exactly 25″ from the top of the door, whatever the hinge's length.
Top of Plate to Top of Plunge
A child Feature is positioned from its parent's center. Hardware spec sheets often give the distance from the top of a plate cut to the top of the plunge cut inside it. To place a child rectangle with its edge exactly 1″ from the edge of its parent plate, set the child's LLocation to Length / 2 - $Parent.Length / 2 + 1. This holds whatever the size of either rectangle or the plate's location.
Soss Hinge
Soss hinges are pockets with rounded, pill-shaped ends, where each corner radius is half the width of the rectangle. Set Radius1 through Radius4 on a Rectangle to Width / 2 and the ends stay fully rounded whatever the rectangle's width.
Repeated Values
To give several properties the same value, create a defined property on the Feature Group and refer to it with #. For example, create a defined property named Radius and set Radius1 through Radius4 to #Radius. Changing Radius then changes all four corners.