- Home
- Help Centre
- OptiNest tutorials
- CNC integration
- G-code output
G-code output
The following article explains G-code export from OptiNest, both with and without PolyBoard integration.
Important: we do not offer support in the configuration of OptiNest’s G-code output. It’s essential that you liaise with your CNC supplier to ensure the correct setup. Incorrect use of this output may damage your CNC. Use of this output is at your own risk.
The following parameter examples are not specific to any machine setup and should not be copied.
Initial import setup
OptiNest G-code with PolyBoard
OptiNest works directly with a PolyBoard post processor to export component files for nesting and G-code generation. To use this functionality alongside PolyBoard, simply export from PolyBoard using an OptiNest post processor with OptiNest 3 Native export selected as the machine format.

You can adjust simple parameters, including how different tooling types will be recognised via the Mode settings.
OptiNest G-code without PolyBoard
OptiNest’s G-code output is also available without using PolyBoard. You can simply import DXF files which will be interpreted according to OptiNest’s DXF interpreter settings.
To access the DXF interpreter, go to the Options menu > Toolings layers > select the 3 dot icon and adjust the DXF parts import options as required.

The DXF interpreter window is now available:

G-code export parameters
To create a new G-code export configuration, go to File menu > Export options > select green + icon > G-code post processor:

The following parameters are now available, for use with files imported from either PolyBoard, or in the DXF format.
General parameters

Default folder
Select a destination folder for the output files from your export.
A specific folder can be chosen relating to your file organization.
Create one folder per material
Define the folder export type requested:
- No: all files in one folder
- Yes: one folder per material
Filename
Type of file name outputted with the option of including job information to the file name.
Extension
The file format of the exported code. Currently the available options in the drop-down menu are:
- .cnc
- .gcode
- .iso
- .nc
Format
The format is how the text of the G-code file is encoded. Available options are:
- ANSI
- Unicode (UTF-8)
- Unicode (UTF-16)
Line ending
Format has a sub-heading with two options:
- CR LF: for Windows-style line endings
- LF: for Unix/Linux-style line endings
Units
Choose the units of the exported files.
G-code unit command
This tells the CNC controller what measurement system your G-code numbers are in.
- G21: millimeters
- G71: inches
Spoil board thickness
The thickness of the spoil board (sacrificial sheet).
Z reference
This will determine if the G-code references either the machine table or the spoil board for its Z-0 position.
Line numbering
This will determine if there is line numbering within the exported G-code files.
Coordinate format

Number of digits in the integer part
This dictates how many digits the G-code will use for the whole number part of coordinates.
Number of digits in the decimal part
How many digits to write after the decimal point in coordinates in the G-code.
Decimal separator
Define the separator used in the code.
Remove trailing zeros
This determines if trailing zeros will or will not follow each value in the code.
Safe start
Safe start is a position above the workpiece that the tool moves to before starting cutting moves. Some setups may require start up commands within the safe start code.
File layout
This is the layout of the G-code file. You have options to add any required initial and final text, and you can determine the order in which tooling types are executed.

Through toolings
This options allows you to manage through toolings in two different ways:
- Keep same tooling face
- Whenever possible, group all toolings on the same face
Milling unit settings

Coordinate system
The Milling coordinate system tells the controller which work coordinate system to use for the milling operations.
In OptiNest, a drop-down menu allows you to select G54 through G59, which are standard work offsets.
If your machine uses a different coordinate system or custom offsets, the G-code can also be manually entered.
Rapid movement safe Z
This is a Z height above the material where the tool can safely move rapidly. When a tool travels between cutting points without actually cutting, it rises to a designated height to safely clear the material, clamps, and the spoil board.
Circular arcs description
This is how circular arcs are defined in G-code for outline operations. CNC can interpret arcs in several ways, and OptiNest gives you options for how to output the arc commands. These options include:
- Relative to start
- Relative to end
- Center absolute coordinate
- Radius
Automatic tool change
Start command (clockwise)
The G-code command for starting the spindle rotation clockwise after a tool change. This is the standard cutting direction for most milling operations.
Start command (counterclockwise)
The G-code command used to start the spindle rotation counterclockwise after a tool change.
Stop command
The G-code command for stopping the spindle.
Tool change command
The G-code command for commencing a tool change operation.
Length compensation command
This is the compensation that adjusts the Z-axis to account for the physical length of a tool so that the tool’s tip cuts to the correct depth. This will ensure a consistent cutting depth.
Starting point
This has two available options that determine where milling operations should begin. These two options are:
- Segment center
- Segment extremity
Residual thickness
This refers to material left uncut during milling operations, used for a final finishing pass.
Part outlines
Face(s) to profile when the 2 faces are exported
This option applies when two faces of a component are exported for profile toolpaths. This allows you to select what face profiling will be executed from. You can select from:
- Face 1
- Face 2
Orientation
This selects the direction of the toolpath during milling operations. You can choose between:
- Clockwise description
- Reverse clockwise description
Vertical overlap
This is the overlap value in the vertical axis (Z) during profiling.
Tool
Tool number
The tool identity that will be used for part outlines.
Milling cutting diameter
The diameter of the milling tool.
Maximum depth
The maximum depth value the milling tool can execute in a single pass.
Cutting feed rate
The cutting feed rate is the speed in which the tool moves through the material while cutting. This information should be accessible through your supplier.
Lead-in feed rate
The lead-in feed rate is the speed at which the tool enters the material at the beginning of a cut.
Rotation speed
Also known as the spindle speed, and this determines how fast the tool spins while cutting.
Rotation direction
This refers to the spinning direction of the tool while cutting. Options include:
- Counter clockwise
- Clockwise
Default tools
This section allows you to select what tool the post processor will use for different types of milling operations. You will select tools from your tool library (more information below).
Drilling unit settings

Activate
Determines whether drilling operations are activated or ignored.
Coordinate system
The drilling coordinate system tells the controller which work offset to use for drilling operations. In OptiNest, you can select G54 through G59 from a drop-down menu. If your machine uses a different system or custom offsets, the G-code can also be entered manually.
Rapid movement safe Z
This is a Z height above the material where the tool can safely move rapidly. When a tool travels between cutting points without actually cutting, it rises to a designated height to safely clear the material, clamps, and the spoil board.
Automatic tool change
Tool change safe Z
The Z height a tool will move to before and after tool changes.
Start command
The command to begin drilling operations.
Stop command
The command to stop drilling operations.
Tool change command
The command to complete a tool change operation.
Length compensation command
This is the compensation that adjusts the Z-axis to account for the physical length of a tool so that the tool’s tip cuts to the correct depth. This will ensure a consistent drilling depth.
On-the-fly tool change
This option is only for machines with the compatibility of changing tools during operation.
Opposite drillings
Relevant when opposite holes are drilled on separate faces. You can choose to either drill them from a single face, or keep their toolpaths on the original face. Options are:
- Merge as a through drilling
- Keep both drillings
Maximum drilling diameter
This is the largest hole size to be considered as a drilling toolpath. Anything above this value will be treated as a milling operation.
Tool library

The tool library is where you add your machine’s available tools. Tools can be categorized as milling or drilling, and each tool has its own identifier and individual parameters that can be set.