# Tapping (G331/ G332)

## Release Note

This function is available as of CNC Build V3.1.3067.01.

Syntax example of tapping in Z direction:
G331 Z.. K.. <spindle_name>.. | Thread tapping | modal
G332 Z.. [ K.. ] [ <spindle_name>.. ] | Thread tapping, retract | modal

G331 | Thread tapping
Z.. | Thread depth (target point) in the tapping axis in [mm, inch]
K.. | Thread pitch in assigned interpolation parameter in [mm/rev, inch/rev]
<spindle_name>.. | Spindle speed consisting of spindle name according to P-CHAN-00053 and speed value in [rpm]
G332 | Retract from threaded bore (Retract). G332 causes an automatic direction reversal of the spindle on retraction.
Z.. | Retract position of tapping axis after tapping in [mm, inch]
K.. | Thread pitch in assigned interpolation parameter in [mm/rev, inch/rev]. The thread pitch must be the same pitch as used for the threaded bore assigned in G331. The parameter is optional. If not programmed, the pitch in block G331 applies.
<spindle_name>.. | Spindle speed consisting of spindle name according to P-CHAN-00053 and speed value in [rpm]. The parameter is optional. If not programmed, the speed in block G331 applies.

This type of tapping (G331/ G332) requires a position-controlled spindle which is tracked by the CNC synchronous to the path motion. In this case the spindle and the feed motion of the participating axes are matched precisely and dynamically. A compensatory chuck is not required.

The thread type is defined by specifying a sign for thread pitch.

- Pitch without or with positive sign (+): Right-hand thread, e.g. K2 or K+2
- Pitch with negative sign (-): Left-hand thread, e.g. K-2

The thread tapping axis feedrate is a product of the programmed pitch and the spindle speed. The permissible speed limits apply to the internal calculation. An error message is output if these limits are violated.

The feed rate continues to apply after tapping is completed. With the following G331/G332, the feedrate is again calculated from the related programmed or saved values of pitch and spindle speed.

G331/G332 is deselected by selecting a different modal block type (e.g. linear motion G01) and the spindles are released from the coordinated motion. A non-modal block type (e.g. dwell time with G04) does not deactivate G331/ G332.

An error message is output if the pitch or spindle speed with G331/G332 are equal to zero or the tapping axis and pitch parameters fail to match. Valid combinations are X with I, Y with J and Z with K.

M03, M04, M05, M19 cannot be programmed in combination with G331/G332.

## Attention

The spindle (or the thread tapping drill) must be at standstill when G331 is selected. This can be achieved by previously programming M05 (Stop spindle) or M19 with S.POS (Position spindle).

## Programing Example

Tapping (G331/ G332)

Tap right-hand thread with pitch 2 mm, thread depth 50 mm, spindle speed S 200 rpm, Z is tapping axis:

;…

G01 F2000 G90 X0 Y0 Z0 ; position axes

M19 S.POS=0 M3 S100 ; stop and position spindle

;…

G331 Z-50 K2 S200 ; tap in Z

G332 Z10 K2 S200 ; retract

G01 F1000 X50 ; reposition, deselect tapping

G331 Z-50 K2 S200 ; tap in Z

G332 Z10 K2 S400 ; retract at increased speed

G01 F1000 X100 ; reposition, deselect tapping

G331 Z-50 K2 S200 ; tap in Z

G332 Z10 ; retract, K and S from G331

G01 F1000 X150 ; reposition, deselect tapping

;…

Tap right-hand thread with pitch 1.5 mm, thread depth 60 mm, spindle speed S 150 rpm, X is tapping axis:

;…

G01 F2000 G90 X100 Y0 Z0 ; position axes

M19 S.POS=0 M3 S100 ; stop and position spindle

;…

G331 X40 I1.5 S150 ; tap in X

G332 X110 I1.5 S150 ; retract

:

## Programing Example

Tap at relative speed

%Tap at relative speed

N010 G91 G19 G0 X100 M03 S2000

N020 S2[MC_GearIn Master=S1 \ ; couple tool
RN=1 RD=1 Mode=256 \ ; spindle S2 to the

PhaseShift=1800000 WAIT_SYN] ; main spindle S1

N030 #MAIN SPINDLE[S2] ; main spindle tool spindle S2

N040 G331 Z-100 K1.5 S200 ; tap right-hand thread

N050 G332 Z100 K1.5 S200 ; retract from threaded bore

N060 G01 X300 F1000

N070 S2[MC_GearOut WAIT_SYN] ; release coupling to main spindle

N080 #MAIN SPINDLE[S1]

N090 M30