Skip to content

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 mm to a number to enter it in millimeters: 40mm + 1 is 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.Thickness evaluates 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 ​

SymbolMeaningExample
+Addition5 + 1 = 6
-Subtraction1 - 8 = -7
*Multiplication5 * 3 = 15
/Division1 / 8 = 0.125
( )Order of operations(2 + 2) * 2 = 8
mmMillimeter suffix for a number40mm + 1 = 40 × 0.03937 + 1
$DoorDoor Data property$Door.Thickness / 2
$JambJamb Data property$Jamb.GapHingeSide
$ParentProperty 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
$GroupThe Feature Group's location for the Feature$Group.WLocation
#A defined property of the Feature Group1 + #MyProperty
$MathA 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 ​

PropertyDescriptionExpression
LengthLength of the door$Door.Length
WidthWidth of the door$Door.Width
ThicknessThickness of the door$Door.Thickness
HingeBevelBevel of the hinge edge, in degrees$Door.HingeBevel
LockBevelBevel of the lock edge, in degrees$Door.LockBevel
FeedRatePercentFeed 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 ​

NameDescriptionExample
EEuler's number$Math.e = 2.71828…
PIPi (π)$Math.PI = 3.14159…

Math Functions ​

FunctionDescriptionExample
absAbsolute value$Math.abs(3 - 5) = 2
sinSine, angle in radians$Math.sin($Math.PI / 2) = 1
sindSine, angle in degrees$Math.sind(90) = 1
cosCosine, angle in radians$Math.cos(0) = 1
cosdCosine, angle in degrees$Math.cosd(90) = 0
tanTangent, angle in radians$Math.tan($Math.PI / 4) = 1
tandTangent, angle in degrees$Math.tand(45) = 1
asinInverse sine (arcsine)$Math.asin(1) = π / 2
acosInverse cosine (arccosine)$Math.acos(-1) = π
atanInverse tangent (arctangent)$Math.atan(1) = π / 4
atan2Inverse 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
maxLarger of two values$Math.max(2, 5) = 5
minSmaller 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.