Subprograms and program-section repeats

Programming techniques are useful in structuring your NC program and avoiding unnecessary repeats. By using subprograms, you need to define machining positions for multiple tools only once, for example. Program-section repeats, on the other hand, help you avoid multiple programming of identical, successive NC blocks or program sequences. By combining and nesting these two programming techniques, you can keep your NC programs rather short and restrict changes to a few central program locations.

Subprograms and program section repeats with the label LBL

Defining labels

With the G98 NC function, you define a new label in the NC program.

Each label must be unambiguously identifiable in the NC program by a number or a name. If a number or a name exists twice in an NC program, the control shows a warning ahead of the NC block.

If you define a label after M30 or M2, it corresponds to a subprogram. Subprograms must always be concluded with a G98 L0. This number is the only one which may exist any number of times in the NC program.

NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.

  • Change the following contents as needed:
  • Tools
  • Cutting parameters
  • Feed rates
  • Clearance height or safe position
  • Machine-specific positions, e.g. with M91
  • Paths of program calls

Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.

In addition, test the NC programs using the simulation before the actual program run.

 
Tip

With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.

N110 G98 L1

; Start of subprogram defined by a number

N120 G00 Z+100

, Retract at rapid traverse

N130 G98 L0

; End of subprogram

NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.

  • Change the following contents as needed:
  • Tools
  • Cutting parameters
  • Feed rates
  • Clearance height or safe position
  • Machine-specific positions, e.g. with M91
  • Paths of program calls

Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.

In addition, test the NC programs using the simulation before the actual program run.

 
Tip

With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.

N110 G98 L "UP"

; Start of subprogram defined by a name

G98 L corresponds to the LBL Klartext syntax.

Defining a label with LBL SET

Calling a subprogram

With the L NC function, you call a subprogram programmed after M30 or M2.

When the control reads the L NC function, it will jump to the defined label and continue execution of the NC program from this NC block. When the control reads G98 L0, it will jump back to the next NC block after the call with L.

NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.

  • Change the following contents as needed:
  • Tools
  • Cutting parameters
  • Feed rates
  • Clearance height or safe position
  • Machine-specific positions, e.g. with M91
  • Paths of program calls

Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.

In addition, test the NC programs using the simulation before the actual program run.

 
Tip

With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.

N110 L1

; Call subprogram

L without G98 corresponds to the CALL LBL Klartext syntax.

Calling a label with CALL LBL

Program-section repeat

Program-section repeats allow you to have a particular program section executed any number of times. The program section must start with a G98 L label definition and end with L. With the numeral after the decimal point, you can define optionally how often you want the control to repeat this program section.

NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.

  • Change the following contents as needed:
  • Tools
  • Cutting parameters
  • Feed rates
  • Clearance height or safe position
  • Machine-specific positions, e.g. with M91
  • Paths of program calls

Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.

In addition, test the NC programs using the simulation before the actual program run.

 
Tip

With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.

N110 L1.2

; Call label 1 twice

L without 98 and the numeral after the decimal point correspond to the CALL LBL REP Klartext syntax.

Program-section repeats