Skip to main content

Variables & Formulas

Variables are a powerful feature that allow you to create dynamic, parametric patterns. Instead of using fixed measurements, you can define named values that can be reused throughout your pattern and automatically update when changed.

Understanding the Concepts

Variables

A variable is a named value that you can reference throughout your pattern. Variables store a single numeric value (like 42 or 2.5) and can be used in place of any measurement.

Example: Create a variable called SeamAllowance with value 1 (cm), then use it for all seam allowances in your pattern.

Formulas

A formula is a mathematical expression that calculates a variable's value based on other variables or expressions. When the inputs change, the formula automatically recalculates.

Example: Create a formula BagWidth / 2 + 2 that automatically updates when you change BagWidth.

Expressions

Expressions are special functions and references that let you access pattern geometry like point positions, line lengths, and panel dimensions. They can be used inside formulas.

Example: Use A1.A2 to get the length of a line, or A.width to get a panel's width.


Creating Variables

Simple Variables (Fixed Value)

  1. Open the Variables section in the right sidebar
  2. Click the + button to add a new variable
  3. Enter a name (e.g., SeamAllowance)
  4. Enter a value (e.g., 1.5)
  5. Press Enter or click the checkmark

Formula Variables (Calculated Value)

  1. Click the + button to add a new variable
  2. Enter a name (e.g., HalfWidth)
  3. Click the ƒx button to switch to formula mode
  4. Enter your formula (e.g., BagWidth / 2)
  5. Press Enter or click the checkmark

The formula editor shows a preview of the calculated value in yellow.


Expression Reference

These expressions can be inserted using the code button in the formula editor.

Panel Properties

Access overall panel dimensions:

ExpressionDescription
A.widthWidth of panel A
A.heightHeight of panel A
A.perimeterTotal perimeter of panel A
A.areaArea of panel A (in square units)
A.pointCountNumber of points in panel A

Point Expressions

Access point positions and line measurements:

ExpressionDescription
A1Point reference (for use in functions)
A1.xX coordinate of point 1 on panel A
A1.yY coordinate of point 1 on panel A

Line Properties

Access line measurements between two points:

ExpressionDescription
A1.A2Distance between point 1 and point 2 (shorthand for .length)
A1.A2.lengthLength of line from A1 to A2
A1.A2.angleAngle of line A1-A2 in degrees
A1.A2.curveCurve amount of line A1-A2
A1.A2.seamSeam allowance for line A1-A2

Measurement Functions

ExpressionDescription
dist(A1, A2)Distance between two points
angle(A1, A2)Angle of line in degrees
curve(A1, A2)Curve amount of the line

Construction

ExpressionDescription
seam()Global seam allowance value
A.seamPanel A's seam allowance (0 if disabled)

Math Functions

FunctionDescription
min(a, b)Minimum of two values
max(a, b)Maximum of two values
abs(x)Absolute value
round(x)Round to nearest integer
floor(x)Round down
ceil(x)Round up
sqrt(x)Square root
pow(x, n)Power (x to the n)
avg(a, b)Average of two values
mod(a, b)Modulus (remainder)
sin(x)Sine (x in radians)
cos(x)Cosine (x in radians)
tan(x)Tangent (x in radians)

Conditional Expressions

Use ternary expressions to create values that change based on conditions:

ExpressionDescription
x > y ? a : bIf x greater than y, use a; otherwise b
x >= y ? a : bIf x greater than or equal to y, use a; otherwise b
x == y ? a : bIf x equals y, use a; otherwise b
x != y ? a : bIf x not equal to y, use a; otherwise b

Examples:

NameFormulaDescription
MarginBagWidth > 30 ? 5 : 3Wider margin for large bags
StrapWidthBagHeight > 50 ? 5 : BagHeight > 30 ? 3.5 : 2.5Chained: 3 sizes based on height
Nesting Conditionals

You can nest ternary expressions or combine them with other formulas: base + (margin > 5 ? 16 : 8)


Practical Examples

Example 1: Parametric Backpack

Create a backpack with variables for key dimensions:

Variables (fixed values):

NameValue
BagHeight45
BagWidth30
BagDepth15
SeamAllowance1

Formulas (calculated):

NameFormula
HalfWidthBagWidth / 2
FrontPanelWidthBagWidth + BagDepth
StrapLengthBagHeight * 2 + 20
PocketWidthBagWidth - 4

Now when you change BagWidth, all related measurements update automatically!


Example 2: Dynamic Seam Allowance

Link seam allowance to panel dimensions:

NameFormula
CutWidthA.width + SeamAllowance * 2
CutHeightA.height + SeamAllowance * 2

Example 3: Matching Panel Dimensions

Ensure the bag bottom matches the front panel width:

NameFormula
BottomWidthA.width

This makes the bottom panel always match the front panel's width.


Example 4: Calculate Fabric Requirements

NameFormula
TotalAreaA.area + B.area + C.area
FabricLengthround(TotalArea / FabricWidth)

Example 5: Proportional Pocket Sizing

Create pocket dimensions based on the main bag:

NameFormula
PocketWidthBagWidth * 0.8
PocketHeightBagHeight * 0.4
ZipperLengthPocketWidth - 2

Example 6: Using Point Positions

Calculate the center point of a panel edge:

NameFormula
CenterX(A1.x + A2.x) / 2
CenterY(A1.y + A2.y) / 2

Example 7: Strap Calculations

Calculate strap dimensions with min/max bounds:

NameFormulaDescription
StrapLengthmax(80, BagHeight * 2.5)At least 80cm, scales with bag
StrapWidthmin(5, max(2.5, BagHeight * 0.1))Between 2.5 and 5cm

Example 8: Roll-Top Calculations

NameFormula
RollPanelHeightRollHeight + 5
BuckleSpacingBagWidth / 3

Example 9: Line Length Reference

Reference actual line lengths from your pattern:

NameFormulaDescription
SideLengthA1.A2Length of line from point 1 to 2
Diagonaldist(A1, A3)Distance between any two points
TotalEdgeA1.A2 + A2.A3 + A3.A4Sum of multiple lines

Quick Edit Popup

You can also link variables directly from the canvas using the Quick Edit popup. Double-click on any point or line to open it, then use the link icon to connect fields to variables—or create new variables on the spot.

See Point Editing → Quick Edit Popup for full details.


Linking Variables to Inputs

Variables can be linked to any numeric input in the pattern editor:

  1. Click on any numeric input field (e.g., point X position, line length)
  2. Click the link icon that appears
  3. Select a variable from the dropdown
  4. The input now displays the variable name and updates automatically

Linked inputs show:

  • Variable name when not hovering
  • Current value when hovering
note

When a point coordinate is linked to a variable, you cannot drag that point in that direction (X or Y). Keyboard arrow keys are also blocked for the linked direction.


Variable Modes

Variable modes let you save and switch between different configurations of your variables — like sizes (Small, Medium, Large) or product variants. Switching a mode instantly updates all variable values and the entire pattern.

Creating Modes

  1. Click the Proportions icon () in the Variables section toolbar
  2. This creates two modes: Default (your current values) and Mode 2 (a copy)
  3. Click the + button to add more modes

Switching Modes

Click any mode tab to switch. All non-formula variable values update instantly, and formula variables recalculate from the new values.

Managing Modes

  • Rename: Double-click a mode tab to edit its name
  • Delete: Click the × on the active tab, or right-click any tab and select Delete
  • Diff highlighting: When viewing a non-default mode, values that differ from the Default mode are shown in blue

Mode Switcher in Variable Graph

When modes exist, a dropdown pill appears in the Variable Graph toolbar showing the active mode. Click it to switch modes from the graph view.

How Modes Work

  • Each mode stores a snapshot of non-formula variable values
  • Formula variables use the same formula across all modes — they recalculate based on the mode's input values
  • Adding a new variable while modes exist uses the variable's default value; other modes pick it up on switch
  • Deleting the second-to-last mode removes all modes, returning to normal behavior

Variable Groups

Organize your variables into groups for better management:

  1. Click the folder+ icon to create a new group
  2. Drag variables into groups
  3. Collapse/expand groups by clicking the folder icon

Tip: Create groups like "Dimensions", "Pockets", "Straps", "Hardware" to keep variables organized.


Tips & Best Practices

Smart Naming

Click the wand icon inside the name input to auto-generate a name based on the variable's content:

  • Formula variables: Uses the expression as the name (e.g., A1.A2 or A.width+SeamAllowance*2)
  • Conditional formulas: Names like bool_margin based on the variables used
  • Slider variables: Named range1, range2, etc.
  • Value variables: Uses the value as the name, or var1, var2, etc.

Naming Conventions

  • Use descriptive names: BagWidth not BW
  • Use CamelCase or underscores: seam_allowance or SeamAllowance
  • Avoid spaces and special characters

Formula Organization

  • Break complex calculations into multiple variables
  • Use intermediate variables for clarity:
HalfWidth = BagWidth / 2
PocketWidth = HalfWidth - 2
ZipperLength = PocketWidth - 1

Unit Awareness

  • Variables automatically convert when switching between cm and inches
  • Expressions like A1.x return values in the current display unit
  • Keep this in mind when creating formulas with fixed values

Performance

  • Formula variables recalculate when their dependencies change
  • Avoid creating circular dependencies (A depends on B, B depends on A)
  • For patterns with many variables, consider grouping related calculations

Troubleshooting

Formula shows "—" (invalid)

  • Check for typos in variable names
  • Ensure referenced variables exist
  • Verify expression syntax (e.g., A1.x not A1x)

Variable not updating

  • Make sure dependent variables are formula-based
  • Check that the formula references the correct variable name
  • Verify the shape/point being referenced exists

Duplicate name error

  • Variable names must be unique (case-insensitive)
  • The name input shows a red border when duplicate detected

Value seems wrong after unit change

  • Expressions automatically convert to display units
  • Fixed values in formulas stay as-is (they're unitless numbers)
  • If mixing, ensure consistent unit expectations