Skip to content

G-code

Saving the G-code

Write the G-code for the active machine: a name format with tokens, one file per tool, sequence or operation, presets, output folder and all pages at once.

File › Save G-code… (⇧⌘E), or the G-code button. The G-code is written for the active machine (its flavor, spindle, accessories, custom blocks and post-processor options); without a machine, for GRBL 1.1 (3018-type CNC). Right-clicking an enabled operation also offers Export This Operation… (that operation alone) and Export the Operations Using the Same Tool… (the enabled operations that use its tool).

  • Name format: the name of each file, in free text and tokens in braces, for example {project}_{seq}_{tool name}. A slash / creates a folder: {project} {date}/{seq}_{tool name}. Operations that get the same name go into the same file: with no operation or tool token, everything fits in a single file; with {op}, one file per operation; with {seq}, one file per sequence (consecutive operations using the same tool); with {tool}, one file per tool (you change the tool by hand between two files). Operations that do not follow each other, gathered in the same file, are machined one after the other there: the machining order changes, and Dusty says so. The extension is the flavor’s (.nc for GRBL).
  • Preset: a single file, one file per tool, per sequence or per operation, dated folder with one file per sequence. Save as Preset… keeps the format under a name; your presets can be renamed and deleted. The default format can also be chosen in Settings › Machining.
  • Three tabs: Files (the tree of folders and files, with their number of lines), Operations (the file of each operation, and its tool), Syntax (the tokens and their meaning; double-clicking a token adds it at the end of the format).
  • The post-processor warnings, including this one: several tools in the same file on a machine without an automatic tool changer, with a format that does not separate the tools. Each tool change is then written according to the flavor (a pause for GRBL: see G-code flavors).
  • Output folder: chosen once (Choose…), then remembered, like the format and your presets. Export… writes the files there (and first asks for the folder if none is chosen); an existing file is replaced only after your confirmation.
TokensReplaced by
{project}, {project short}The project name; the same without spaces, 12 characters at most.
{op}, {op index}, {op name}The rank of the operation, with or without leading zeros; its name.
{seq}, {seq index}The rank of the sequence, with or without leading zeros.
{tool}, {tool index}The rank of the tool in order of appearance, with or without leading zeros.
{tool name}, {tool number}, {tool radius}, {tool category}The tool name, its number (tool changer), its radius in millimeters, its type (end mill, V-bit…).
{timestamp}, {date}, {time}YYYY_MM_DD_HH_MM_SS, YYYY_MM_DD, HH_MM_SS.
{day}, {day name}, {month}, {month name}, {year}, {year short}The day, its name, the month (01 to 12), its name, the year on four or two digits.
{hour}, {hour short}, {hour ap}, {minute}, {second}The hour from 00 to 23, from 01 to 12, am or pm, the minutes, the seconds.

An unknown token is ignored. Dusty’s G-code is strict ASCII: accented letters in names are transliterated (a non-ASCII character could be taken by GRBL for an immediate command). Saving the G-code does not change the project, except the counter of the variable text when its auto-advance is checked.

All pages, one folder per page (project with several pages): the G-code of each page, with the same format, in a folder named after the page — “all pages at once” series machining. Pages with nothing to machine and those that still have variable text (the template of a series) are skipped, with a warning.

The Machine panel also offers Save G-code…: it saves exactly the program of the job that would be sent.

This manual is also built into Dusty: press F1, or open the Help menu, to read the topic for what you are doing. A mistake, a missing answer? Tell us

Try it in Dusty, for free.

Free CNC milling software: design, toolpaths and machine control. Mac, iPad, iPhone, Windows and Linux.