Variable Text Formatting in LightBurn

Detailed Guide to Using Dynamic Text Expressions

Variable Text Formatting allows you to dynamically replace specially formatted expressions with alternate data during laser project output. Paired with the appropriate Variable Text mode, these expressions enable automated updates for dates, serial numbers, and data from CSV files.

Ref-VariableText-VariableTextDropDown


General Tips for Formatting Variable Text

  • Select the corresponding mode in the Text Options Toolbar for each formatting type.
  • Use the Test button to preview the results before sending your project to the laser.

Date/Time Formatting

Substitute date and time values using system-based local settings.

Ref-VariableTextFormatting-DateTime

Date Formatting Examples

Expression Output
d Day without leading zero (1-31)
dd Day with leading zero (01-31)
ddd Abbreviated day name (e.g., Mon)
dddd Full day name (e.g., Monday)
M Month without leading zero (1-12)
MM Month with leading zero (01-12)
MMM Abbreviated month name (e.g., Jan)
MMMM Full month name (e.g., January)
yy Two-digit year (e.g., 23)
yyyy Four-digit year (e.g., 2023)

Time Formatting Examples

Expression Output
h Hour without leading zero
hh Hour with leading zero
m Minute without leading zero
mm Minute with leading zero
s Second without leading zero
ss Second with leading zero
AP or A AM/PM in uppercase
ap or a am/pm in lowercase

Ref-VariableTextFormatting-TextQuotesDemo

Note: Enclose non-formatting characters in single quotes to include them verbatim in the output (e.g., 'The date is:' yyyy-MM-dd).


Serial Number Formatting

Automatically substitute serial number values using the Current value in the Variable Text Window.

Ref-VariableTextFormatting-SerialNumber

Serial Number Examples

Expression Output
d Serial number as decimal
h Serial number as lowercase hex
H Serial number as uppercase hex
0 Adds leading zeros

For example, a Current value of 1234 with 0dddd will output 01234.

Restrictions:

  • Avoid mixing decimal and hexadecimal formatting in one entry.
  • Do not split serial numbers with non-formatting characters (e.g., ddd-ddd).

Ref-VariableTextFormatting-BadFormat


Merge/CSV Formatting

Use data rows from a CSV file by referencing columns with % followed by a column number (e.g., %0 for the first column).

Ref-VariableTextFormatting-MergeCSV

Example:

For a CSV containing:

 
CopyEdit
LightBurn,80,10
Corel,300,20

A text entry of:
"I'm thinking of buying %0, it costs $%1."
Will output:
"I'm thinking of buying LightBurn, it costs $80."

Tips:

  • Use the Offset field to reference different rows for multiple entries.

Cut Setting Formatting

Substitute values from the Cut Settings applied to your text or another layer.

Ref-VariableTextFormatting-CutSettingDemo

Cut Setting Expressions

Expression Output
s Speed (numeric)
S Speed (with units)
p Max Power (percentage)
P Max Power (with %)
d or D DPI (dots per inch)
i Interval (numeric)
I Interval (with units)
L Laser name

Example:

L6 will output the 6th character of the laser name, and L6,4 will output 4 characters starting from the 6th.


Additional Notes for All Formats

  • Non-formatting characters are included verbatim.
  • Use single quotes for literal text within expressions.
  • Ensure clarity when using formats without separators (e.g., ddMM may be ambiguous).

Conclusion

Variable Text Formatting in LightBurn offers robust customization options to enhance your laser projects. By combining different formats, you can automate repetitive tasks and streamline workflows efficiently.