Skip to content
Contact Get Started

Cycle Program Templates

Cycle Programming lets an operator describe a part as cycles and positions. What that becomes as a program is decided by a template: a plain text file in the project, with the G-code this machine wants around each cycle, each hole and each turn of the part. The operator never opens it; every cycle program the panel produces is written through it.

The template is part of the project and travels with it. Open the channel under NC Execution in the project tree and go to its Cycle Template section. The editor there is the file; Save writes it into the project and Discard changes reverts to what is on disk.

It reaches the machine when the project is activated, together with the channel and PLC configuration. Activation is where a bad template stops:

the target refused the cycle template - it could not be read as one; the machine kept the template it already had

The machine has exactly one template. There is no per-machine override file to copy in.

A section starts with its name in square brackets on a line of its own and runs to the next one. A line that starts with ; is a note to the next engineer and never reaches a program; a comment in parentheses is part of the program and passes through.

SectionWritten
[header]once, at the top
[tool]when the tool changes: once for the first cycle, then only when a cycle names a different tool
[cycle]once per cycle step
[hole]once per position
[rotate]once per rotate step, when the part turns
[footer]once, at the end

[cycle] and [hole] must exist. The rest may be empty, and a machine with no rotary axis can leave [rotate] out.

A cycle kind can have a line of its own: [cycle drill], [cycle tap] or [cycle csink] is used for that kind instead of [cycle]. A machine that hands countersinking to a macro writes [cycle csink] and leaves the other two on the plain fixed-cycle line.

This is the file a new project starts with, without its ; notes:

[header]
O1{{programId}} ({{name}})
G17 G21 G40 G80 G90
{{workOffset}}
M08
[tool]
G80
T{{tool}} M06
G43 H{{tool}}
G00 Z{{retractZ}}
(TOOL {{tool}} - {{groupHoleCount}} HOLES)
[cycle]
S{{speed}} M03
{{returnMode}} G{{cycleCode}} Z{{negDepth}} R{{clearance}} Q{{peck}} P{{dwellMs}} L0 F{{feed}} (CYCLE {{cycleCode}} - {{posCount}} POS)
[hole]
X{{x}} Y{{y}}
[rotate]
G80
G00 Z{{retractZ}}
{{rotary}}
[footer]
G80
M05
G00 Z{{retractZ}}
M30

It calls no macros: plain G81 to G84, so a machine with nothing else installed still drills. M08 is on because this template was written for a machine where one valve serves both coolant codes; take it out if yours differs.

Usable inPlaceholders
any section{{programId}} {{name}} {{holeCount}} {{workOffset}} {{retractZ}} {{returnMode}}
[tool]{{tool}} {{groupHoleCount}}
[cycle] and [cycle <kind>]{{seq}} {{cycleCode}} {{tool}} {{diameter}} {{clearance}} {{feed}} {{speed}} {{peck}} {{dwell}} {{dwellMs}} {{depth}} {{negDepth}} {{posCount}}
[hole]{{seq}} {{x}} {{y}}
[rotate]{{seq}} {{rotary}}

How the values arrive:

PlaceholderWritten asExample
{{workOffset}} {{returnMode}}a complete codeG54, G98
{{x}} {{y}} {{retractZ}} {{clearance}} {{depth}} {{peck}} {{feed}} {{diameter}}millimetres, trailing zeros dropped, decimal point kept10., 2.5, -12.
{{negDepth}}the operator’s depth with the sign flipped-12.
{{speed}}whole revolutions per minute2000
{{dwell}}seconds0.5
{{dwellMs}}whole milliseconds500
{{cycleCode}}the number the operator’s entries selected: 81, 82, 83 or 8483
{{holeCount}} {{groupHoleCount}} {{posCount}}positions in the program, under this tool, under this cycle. A rotate step is not counted2
{{rotary}}one word per axis the step turns, in degreesA90., A90. B-45.5

{{diameter}} carries a value only for a countersink, where it is the chamfer diameter the operator typed. For a drill or a tap the hole is as wide as the tool, and the tool table holds that.

The + ROTATE key is on the editor’s insert row only when the machine has a rotary axis and the template has a [rotate] section. On a machine with a rotary axis and no [rotate], the strip at the top of the Cycle Programming page says so:

this machine has a rotary axis, but its cycle template has no rotate step - a program written from it can only drill the face the part is already showing

The form’s fields do not change with the template. A cycle kind asks the same fields on every machine.

TemplateRefused with
no [cycle] or no [hole] sectiontemplate_missing_sections
a placeholder not in the table abovetemplate_unknown_placeholder: {{angle}} in [hole]
a file that cannot be readtemplate_unreadable
no [rotate], and a program with a rotate step is savedtemplate_has_no_rotate_step, on that save

The first three are refused at activation, and the machine keeps the template it had. A placeholder that is not filled is not dropped, it is copied into the program as written, so an unknown name is refused rather than handed to the machine as an address.

L0 goes on the cycle line, before F. A cycle line with a zero repeat count stores the drilling data without drilling. That is what lets [cycle] be a setup line and each [hole] a bare coordinate. Without it, the cycle line drills a hole where the tool is standing, because Z and R already make it a move. It goes before F because the block-order check groups L with the axis words.

P is whole milliseconds and takes no decimal point. Use {{dwellMs}}, never {{dwell}}, on a P word. Half a second is P500; P0.5 is an alarm. {{dwell}} is for a template that passes seconds to a macro.

G80 opens [tool] and [rotate]. The cycle is still modal when the tool block runs, and a tool block’s own Z rapid would become a hole. The same on a turn: the part must not swing while the tool waits at the R plane.

Depth is negated for you. Write {{negDepth}} where the program needs Z-12.. {{depth}} there drills upwards.

A program named TWO-FACE: one G81 cycle on tool 3 with a hole at X10 Y20, a rotate step to A90, then the same cycle again with a hole at X30 Y40. Return mode G99, retraction plane 50 mm. Through the shipped template it becomes:

O19 (TWO-FACE)
G17 G21 G40 G80 G90
G54
M08
G80
T3 M06
G43 H3
G00 Z50.
(TOOL 3 - 2 HOLES)
S2000 M03
G99 G81 Z-12. R2. Q0. P0 L0 F250. (CYCLE 81 - 1 POS)
X10. Y20.
G80
G00 Z50.
A90.
S2000 M03
G99 G81 Z-12. R2. Q0. P0 L0 F250. (CYCLE 81 - 1 POS)
X30. Y40.
G80
M05
G00 Z50.
M30

One tool change, because the tool did not change. Two cycle lines, because the turn cancelled the first. Holes are written in the order the operator entered them; the control does not regroup them by tool.

Editing a template that programs already use

Section titled “Editing a template that programs already use”

Storing a cycle program and compiling it are two separate outcomes. SAVE PROGRAM stores the program either way; compiling it is what puts a program in the channel. A program that never compiled shows not compiled in the list, and LOAD stays off for it.

Changing the template compiles nothing on its own. Every stored program keeps the machine copy it had until it is opened and saved again. When the panel opens a program whose machine copy no longer matches the template, it opens from the stored program instead, marked as changed, and LOAD is refused until SAVE PROGRAM has rebuilt the machine copy.