Siemens CNC Milling | G331-G332 Codes | Thread interpolation


G331 and G332 Codes Introduction

G331 and G332 codes require a position-controlled spindle with a position measuring system.

By using this codes, the threads can be tapped without compensating chuck if the dynamic properties of the spindle and axis allow it. If, however, a compensating chuck is used, the path differences to be compensated by the compensating chuck are reduced. This allows tapping at higher spindle speeds.

Drilling is done using G331, retraction is done using G332.

The drilling depth is specified by specifying one of the axes X, Y or Z; the thread pitch is specified via the relevant I, J or K.

For G332, the same lead is programmed as for G331. Reversal of the spindle direction of rotation occurs automatically.

The spindle speed is programmed with S and without M3/M4.

Before tapping the thread using this codes, the spindle must be switched to the position-controlled mode with SPOS=….

Right-hand or left-hand Thread

The sign of the thread lead determines the direction of spindle rotation:

Positive: right-hand (as with M3)
Negative: left-hand (as with M4)


Note:
A complete thread tapping cycle with thread interpolation is provided with the standard cycle CYCLE84.

G331 and G332 Codes Examples

See the following illustration for tapping using G331/G332:


Axis Velocity

When programming with it, you can determine the axis velocity based on the spindle speed and the thread lead. However, the maximum axis velocity (rapid traverse) defined in the machine data cannot be exceeded; otherwise, alarms will appear.

metric thread M5,
lead: 0.8 mm/rev., hole already premachined:


N5 G54 G0 G90 X10 Y10 Z5 ;
Approach starting point
N10 SPOS=0 ; Spindle in position control
N20 G331 Z-25 K0.8 S600 ; Tapping, K positive = clockwise of the spindle, end point Z=-25 mm
N40 G332 Z5 K0.8 ; Retraction
N50 G0 X30 Y30 Z20
N60 M30