2012-08-04 20:34:22 (CET)

G Codes ( G38.2 - G42.1 )

Straight Probe - G38.2  

 

The Straight Probe Command  

Program G38.2 X… Y… Z… A… to perform a straight probe operation. The rotational axis words are allowed, but it is better to omit them. If rotational axis words are used, the numbers must be the same as the current position numbers so that the rotational axes do not move. The linear axis words are optional, except that at least one of them must be used. The tool in the spindle must be a probe.

It is an error if:

  • the current point is less than 0.254 millimeter or 0.01 inch from the pro­grammed point.

  • G38.2 is used in inverse time feed rate mode,

  • any rotational axis is commanded to move,

  • no X, Y, or Z-axis word is used.

     

    In response to this command, the machine moves the controlled point (which should be at the end of the probe tip) in a straight line at the current feed rate toward the programmed point. If the probe trips, the probe is retracted slightly from the trip point at the end of command execution. If the probe does not trip even after overshooting the programmed point slightly, an error is signaled.

     

    After successful probing, parameters 5061 to 5066 will be set to the program coordinates of the location of the controlled point at the time the probe tripped. The variables 5051 to 5056 will contain the machine coordinates. Useful for measuring tools in absolute machine positions. G53 G38.2 will move in machine coordinates.

     

 

Using the Straight Probe Command  

Using the straight probe command, if the probe shank is kept nominally parallel to the Z-axis (i.e., any rotational axes are at zero) and the tool length offset for the probe is used, so that the controlled point is at the end of the tip of the probe:

  • without additional knowledge about the probe, the parallelism of a face of a part to the XY-plane may, for example, be found.

  • if the probe tip radius is known approximately, the parallelism of a face of a part to the YZ or XZ-plane may, for example, be found.

  • if the shank of the probe is known to be well-aligned with the Z-axis and the probe tip radius is known approximately, the center of a circular hole, may, for example, be found.

  • if the shank of the probe is known to be well-aligned with the Z-axis and the probe tip radius is known precisely, more uses may be made of the straight probe command, such as finding the diameter of a circular hole.

 

If the straightness of the probe shank cannot be adjusted to high accuracy, it is desirable to know the effective radii of the probe tip in at least the +X, -X, +Y, and -Y directions. These quantities can be stored in parameters either by being included in the parameter file or by being set in an RS274/NGC program.

Using the probe with rotational axes not set to zero is also feasible. Doing so is more complex than when rotational axes are at zero, and we do not deal with it here. 

 

Example Code  

 

As a usable example, the code for finding the center and diameter of a circular hole is shown in Table 3-5. For this code to yield accurate results, the probe shank must be well-aligned with the Z-axis, the cross section of the probe tip at its widest point must be very circular, and the probe tip radius (i.e., the radius of the circular cross section) must be known precisely. If the probe tip radius is known only approximately (but the other conditions hold), the location of the hole center will still be accurate, but the hole diameter will not.

 

In Table 3-5, an entry of the formis meant to be replaced by an actual number that matches the description of number. After this section of code has executed, the X-value of the center will be in parameter 1041, the Y-value of the center in parameter 1022, and the diameter in parameter 1034. In addition, the diameter parallel to the X-axis will be in parameter 1024, the diameter parallel to the Y-axis in parameter 1014, and the difference (an indicator of circularity) in parameter 1035. The probe tip will be in the hole at the XY center of the hole.

 

The example does not include a tool change to put a probe in the spindle. Add the tool change code at the beginning, if needed.

 

Table 3-5 Code to Probe Hole

 

N010 (probe to find center and diameter of circular hole)

N020 (This program will not run as given here. You have to)

N030 (insert numbers in place of.)

N040 (Delete lines N020, N030, and N040 when you do that.)

N050 G0 ZF

N060 #1001=

N070 #1002=

N080 #1003=

N090 #1004=

N100 #1005=[/2.0 - #1004]

N110 G0 X#1001 Y#1002 (move above nominal hole center)

N120 G0 Z#1003 (move into hole - to be cautious, substitute G1 for G0 here)

N130 G38.2 X[#1001 + #1005] (probe +X side of hole)

N140 #1011=#5061 (save results)

N150 G0 X#1001 Y#1002 (back to center of hole)

N160 G38.2 X[#1001 - #1005] (probe -X side of hole)

N170 #1021=[[#1011 + #5061] / 2.0] (find pretty good X-value of hole center)

N180 G0 X#1021 Y#1002 (back to center of hole)

N190 G38.2 Y[#1002 + #1005] (probe +Y side of hole)

N200 #1012=#5062 (save results) N210 G0 X#1021 Y#1002 (back to center of hole)

N220 G38.2 Y[#1002 - #1005] (probe -Y side of hole)

N230 #1022=[[#1012 + #5062] / 2.0] (find very good Y-value of hole center)

N240 #1014=[#1012 - #5062 + [2 * #1004]] (find hole diameter in Y-direction)

N250 G0 X#1021 Y#1022 (back to center of hole)

N260 G38.2 X[#1021 + #1005] (probe +X side of hole)

N270 #1031=#5061 (save results)

N280 G0 X#1021 Y#1022 (back to center of hole)

N290 G38.2 X[#1021 - #1005] (probe -X side of hole)

N300 #1041=[[#1031 + #5061] / 2.0] (find very good X-value of hole center)

N310 #1024=[#1031 - #5061 + [2 * #1004]] (find hole diameter in X-direction)

N320 #1034=[[#1014 + #1024] / 2.0] (find average hole diameter)

N330 #1035=[#1024 - #1014] (find difference in hole diameters)

N340 G0 X#1041 Y#1022 (back to center of hole)

N350 M2 (that's all, folks)

 

 Cutter Radius Compensation - G40, G41, G41.1, G42, G42.1  

To turn cutter radius compensation off, program G40. It is OK to turn compensation

off when it is already off. Cutter radius compensation may be performed only if the XY-plane is active.

To turn cutter radius compensation on left (i.e., the cutter stays to the left of the programmed path when the tool radius is positive), program G41 D… . To turn cutter radius compensation on right (i.e., the cutter stays to the right of the programmed path when the tool radius is positive), program G42 D… . The D word is optional; if there is no D word, the radius of the tool currently in the spindle will be used. If used, the D number should normally be the slot number of the tool in the spindle, although this is not required. It is OK for the D number to be zero; a radius value of zero will be used.

It is an error if:

  • the D number is not an integer, is negative or is larger than the number of car­ousel slots,

  • the XY-plane is not active or for turning the ZX plane is not active,

  • cutter radius compensation is commanded to turn on when it is already on.

 

The behavior of the machining center when cutter radius compensation is on is described in Appendix A.

With G41.1 D… is the same as G41 D… except now the D number is not a tool number but a tool diameter.

With G42.1 D… is the same as G42 D… except now the D number is not a tool number but a tool diameter.

 


Example code for milling

This example mills out a rectangular object from the outside and inside.

On the outside we use G42, tool radius compensation right and for the inside G41, tool radius compensation left is used.

For both contours a tool-radius-compensation entry move is programmed consisting of a line which must be longer than the tool-radius used and a circle, of which also the radius is bigger than the tool.

 

By the way, all arc radii should be bigger than the tool radius. If you have inside corners, there should be always an arc, so that the tool fits.

g0 z3

g0 x-15 y15

f500

/g42.1 D6

g1 x-5 (cutter comp entry move 1)

g2 x0 y10 r5 (cutter comp entry move 2)

g1 z-3 (plunge down)

g3 x10 y0 r10

g1 x70

g3 x80 y10 r10

g1 y90

g3 x70 y100 r10

g1 x10

g3 x0 y90 r10

g1 x0 y10

/g40

g0 z3

g0 x30 y30

/g41.1 d6

g1 x20

g3 x10 y20 r10

g1 z-3

g3 x20 y10 r10

g1 x60

g3 x70 y20 r10

g1 y80

g3 x60 y90 r10

g1 x20

g3 x10 y80 r10

g1 y20

/g40

g0 z3

m30

The G42, G41 and G40 codes are programmed with a / (block delete sign) in front. This makes it easy to debug tool comp programs. The program is loaded with block delete on, this is the blue curve.

Then the program is run with block delete off resulting in the yellow curve.

 

It is clear to see what the entry move does.

 

 

 

 

 

Example code for turning

The movement starts at the right upper corner.

The blue line is the programmed contour. The yellow is the contour with tool-radius compensation G41.

The first G1 line is the tool comp entry move.

 

You can get this figure by putting a / character in front of the G41/G40 codes. The load the program with block delete on and execute it with block delete off. With block delete on the tool comp is skipped. 

Diameter programming)

(Use R word for Arcs)

g0 x-20 z20

/g41.1 d5

g1 x-20 z10

g3 x0 z0 r10

g1 x20

g2 x40 z-10 r10

g1 z-20

g3 x60 z-30 r10

/g40

m30

(Radius programming)

(Use R word for arc’s)

g0 x-10 z20

/g41.1 d5

g1 x-10 z10

g3 x0 z0 r10

g1 x10

g2 x20 z-10 r10

g1 z-20

g3 x30 z-30 r10

/g40

m30

Diameter programming)

(Use I,K programming for arc’s)

g0 x-20 z20

/g41.1 d5

g1 x-20 z10

g3 x0 z0 i10 k0

g1 x20

g2 x40 z-10 i0 k-10

g1 z-20

g3 x60 z-30 i10 k0

/g40

m30

(Radius programming)

(Use I,K programming for arc’s)

g0 x-10 z20

/g41.1 d5

g1 x-10 z10

g3 x0 z0 i10 k0

g1 x10

g2 x20 z-10 i0 k-10

g1 z-20

g3 x30 z-30 i10 k0

/g40

m30