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)
- Open the Variables section in the right sidebar
- Click the + button to add a new variable
- Enter a name (e.g.,
SeamAllowance) - Enter a value (e.g.,
1.5) - Press Enter or click the checkmark
Formula Variables (Calculated Value)
- Click the + button to add a new variable
- Enter a name (e.g.,
HalfWidth) - Click the ƒx button to switch to formula mode
- Enter your formula (e.g.,
BagWidth / 2) - 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:
| Expression | Description |
|---|---|
A.width | Width of panel A |
A.height | Height of panel A |
A.perimeter | Total perimeter of panel A |
A.area | Area of panel A (in square units) |
A.pointCount | Number of points in panel A |
Point Expressions
Access point positions and line measurements:
| Expression | Description |
|---|---|
A1 | Point reference (for use in functions) |
A1.x | X coordinate of point 1 on panel A |
A1.y | Y coordinate of point 1 on panel A |
Line Properties
Access line measurements between two points:
| Expression | Description |
|---|---|
A1.A2 | Distance between point 1 and point 2 (shorthand for .length) |
A1.A2.length | Length of line from A1 to A2 |
A1.A2.angle | Angle of line A1-A2 in degrees |
A1.A2.curve | Curve amount of line A1-A2 |
A1.A2.seam | Seam allowance for line A1-A2 |
Measurement Functions
| Expression | Description |
|---|---|
dist(A1, A2) | Distance between two points |
angle(A1, A2) | Angle of line in degrees |
curve(A1, A2) | Curve amount of the line |
Construction
| Expression | Description |
|---|---|
seam() | Global seam allowance value |
A.seam | Panel A's seam allowance (0 if disabled) |
Math Functions
| Function | Description |
|---|---|
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:
| Expression | Description |
|---|---|
x > y ? a : b | If x greater than y, use a; otherwise b |
x >= y ? a : b | If x greater than or equal to y, use a; otherwise b |
x == y ? a : b | If x equals y, use a; otherwise b |
x != y ? a : b | If x not equal to y, use a; otherwise b |
Examples:
| Name | Formula | Description |
|---|---|---|
| Margin | BagWidth > 30 ? 5 : 3 | Wider margin for large bags |
| StrapWidth | BagHeight > 50 ? 5 : BagHeight > 30 ? 3.5 : 2.5 | Chained: 3 sizes based on height |
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):
| Name | Value |
|---|---|
| BagHeight | 45 |
| BagWidth | 30 |
| BagDepth | 15 |
| SeamAllowance | 1 |
Formulas (calculated):
| Name | Formula |
|---|---|
| HalfWidth | BagWidth / 2 |
| FrontPanelWidth | BagWidth + BagDepth |
| StrapLength | BagHeight * 2 + 20 |
| PocketWidth | BagWidth - 4 |
Now when you change BagWidth, all related measurements update automatically!
Example 2: Dynamic Seam Allowance
Link seam allowance to panel dimensions:
| Name | Formula |
|---|---|
| CutWidth | A.width + SeamAllowance * 2 |
| CutHeight | A.height + SeamAllowance * 2 |
Example 3: Matching Panel Dimensions
Ensure the bag bottom matches the front panel width:
| Name | Formula |
|---|---|
| BottomWidth | A.width |
This makes the bottom panel always match the front panel's width.
Example 4: Calculate Fabric Requirements
| Name | Formula |
|---|---|
| TotalArea | A.area + B.area + C.area |
| FabricLength | round(TotalArea / FabricWidth) |
Example 5: Proportional Pocket Sizing
Create pocket dimensions based on the main bag:
| Name | Formula |
|---|---|
| PocketWidth | BagWidth * 0.8 |
| PocketHeight | BagHeight * 0.4 |
| ZipperLength | PocketWidth - 2 |
Example 6: Using Point Positions
Calculate the center point of a panel edge:
| Name | Formula |
|---|---|
| CenterX | (A1.x + A2.x) / 2 |
| CenterY | (A1.y + A2.y) / 2 |
Example 7: Strap Calculations
Calculate strap dimensions with min/max bounds:
| Name | Formula | Description |
|---|---|---|
| StrapLength | max(80, BagHeight * 2.5) | At least 80cm, scales with bag |
| StrapWidth | min(5, max(2.5, BagHeight * 0.1)) | Between 2.5 and 5cm |
Example 8: Roll-Top Calculations
| Name | Formula |
|---|---|
| RollPanelHeight | RollHeight + 5 |
| BuckleSpacing | BagWidth / 3 |
Example 9: Line Length Reference
Reference actual line lengths from your pattern:
| Name | Formula | Description |
|---|---|---|
| SideLength | A1.A2 | Length of line from point 1 to 2 |
| Diagonal | dist(A1, A3) | Distance between any two points |
| TotalEdge | A1.A2 + A2.A3 + A3.A4 | Sum 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:
- Click on any numeric input field (e.g., point X position, line length)
- Click the link icon that appears
- Select a variable from the dropdown
- The input now displays the variable name and updates automatically
Linked inputs show:
- Variable name when not hovering
- Current value when hovering
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
- Click the Proportions icon () in the Variables section toolbar
- This creates two modes: Default (your current values) and Mode 2 (a copy)
- 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:
- Click the folder+ icon to create a new group
- Drag variables into groups
- 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.A2orA.width+SeamAllowance*2) - Conditional formulas: Names like
bool_marginbased 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:
BagWidthnotBW - Use CamelCase or underscores:
seam_allowanceorSeamAllowance - Avoid spaces and special characters
Formula Organization
- Break complex calculations into multiple variables
- Use intermediate variables for clarity:
Unit Awareness
- Variables automatically convert when switching between cm and inches
- Expressions like
A1.xreturn 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.xnotA1x)
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