PrintNowPrintNowDocs

Expression System

Build formulas with arithmetic operators and functions like min, max, clamp, and step in Print CAD.

Print CAD's expression system lets you write formulas that compute values dynamically from variables and constants. Expressions can be used anywhere a numeric value is accepted — dimensional constraints, variable definitions, and rule formulas. This enables complex parametric relationships where one dimension depends on calculations involving multiple variables.

Arithmetic Operators

OperatorDescriptionExample
+AdditionW + 0.5
-SubtractionL - A
*MultiplicationW * 2
/DivisionD / 3

Expressions follow standard mathematical order of operations. Use parentheses to control evaluation order: (W + A) * 2.

Functions

Print CAD extends the base expression system with functions useful for packaging design:

FunctionSyntaxDescription
minmin(a, b)Returns the smaller of two values. Useful for constraining a dimension to never exceed a limit: min(W, 24)
maxmax(a, b)Returns the larger of two values. Useful for enforcing minimum sizes: max(D, 1)
clampclamp(value, min, max)Restricts a value to a range. Equivalent to max(min, min(max, value)). Example: clamp(A, 0.25, 1.0)
stepstep(value, threshold)Returns 0 if value is below threshold, 1 if at or above. Useful for conditional geometry that appears only above a certain size.
sqrtsqrt(x)Square root. Useful for diagonal calculations: sqrt(WW + DD)
sinsin(angle)Sine of angle in degrees.
coscos(angle)Cosine of angle in degrees.
asinasin(value)Arcsine, returns angle in degrees.
acosacos(value)Arccosine, returns angle in degrees.
pipiThe constant 3.14159...

Expression Examples for Packaging

ExpressionUse Case
W + A * 2Total width including allowance on both sides
D / 2 + 0.125Half-depth tuck flap with 1/8" extra for overlap
min(W, L) * 0.1Glue tab width proportional to the shorter dimension
clamp(D * 0.5, 0.5, 2.0)Flap depth that scales with box depth but stays between 0.5" and 2"
step(W, 12) * 0.25Add 0.25" reinforcement only when width exceeds 12"
sqrt(WW + DD)Diagonal dimension for angled structural elements

Expressions in Rules

The same expression syntax is used in Rules formulas and Auto Flute area formulas in the Custom Libraries admin. Variable names in expressions must match the parameter Variable names exactly (case-sensitive).

  • Variables — Define the named values that expressions reference
  • Constraints — Enter expressions directly into dimensional constraints
  • Rules — Write restriction formulas using expression syntax
  • Auto Flute — Use expressions in the area calculation formula

On this page