Tool Radius Compensation (D, G40, G41, G42)
D
D<v>
Select tool v. The new tool applies to its own block and all succeeding blocks until a new tool is selected. Tool 0 is special. Its selection deactivates any tool compensation. Tool 0 can be regarded as tool where all tool parameters are set to zero. It is selected by default.
Example:
In the following example tool 1 is defined to have a Y-offset of 10 and tool 2 to have an Y-offset of 20. Block N10 and block N50 use tool 0. Tool 1 applies to block N20 and to block N30. In block N40 tool 2 is active. Figure “ExampleD” shows the resulting programmed path (dotted line) and the resulting tool center point path (solid line).
!toolSet(index:=1, nr:=1, offsetY:=10);
!toolSet(index:=2, nr:=2, offsetY:=20);
N10 G01 X10 Y0 F6000
N20 G01 X20 Y0 D1
N30 G01 X30 Y0
N40 G01 X40 Y0 D2
N50 G01 X50 Y0 D0
M02
Figure “ExampleD”.
G40
Command | G40 (default setting) |
Cancellation | G41 or G42 |
Deactivate Tool Radius Compensation (TRC).
G41
Command | G41 |
Cancellation | G40 or G42 |
Activate tool radius compensation (TRC). After activation the programmed path is shifted left by the radius of the currently selected tool. (See D.)
![]() | On activation, a tool with a nonzero index must be selected. |
Example:
The following example demonstrates the activation and deactivation of tool radius compensation. The programmed path (dotted line) and the compensated path (solid/ dashed line) are shown in Figure “ExampleG40G41”.
- The first line of the GST program sets the
offsetparameter to5 mm. Therefore, the adjacent segments of a gap are extended by5 mm. The remaining gap is closed by a circular arc. - The second line defines the approach and depart behavior to use a circular arc with a radius of
5 mmand an angle of90degree. - The third line defines tool
1to have a radius of10. - Block
N10describes a linear movement to[10,0,0]. - The next block
N20selects tool1and activates tool radius compensation, whereD1comes into effect beforeG40is processed andG40is active beforeX20is processed. Therefore, the end of segmentN20is subject to TRC (tool radius compensation). The linear movement from the end of segmentN10to the end of segmentN20in the programmed path is substituted by an approach-segment (dotted line) from the end ofN10to the end ofN20'in the compensated path. - In the next three lines a linear movement along
N30,N40andN50is programmed. Since segmentN40would result in a collision, it is eliminated from the compensated path. - In the next line a circular arc along
N60is programmed. The gap between the end ofN50'and the beginning ofN60'is closed as described earlier. - The line along
N70is the last segment that is subject to TRC (tool radius compensation), since its deactivation becomes active before the end ofN80. The line alongN80is replaced by the depart-segmentN80', similarly to the approach-segment.
!trcOffsetSet(offset:=5);
!trcApproachDepartSet(approachRadius:=5, approachAngle:=90, departRadius:=5, departAngle:=90);
!toolSet(index:=1, tooltype:=tooltypeMill, radius:=10);
N10 G01 X10 F6000
N20 X20 G41 D1
N30 X35
N40 X40
N50 Y20
N60 G02 X50 Y10 U10
N70 G01 X70
N80 X80 Y0 G40
N90 X90
M02
Figure “ExampleG40G41”.
G42
Command | G41 |
Cancellation | G40 or G41 |
This function is the same as G41, except that the path is shifted to the right. See G41 for details.
