All further system-specific information refers to NIST's EMC program, but much of it applies to most modern CNC controls. My method of checking these programs is to first select tool zero, which always has a diameter of zero, so offset commands are essentially ignored. Then, I tape a sheet of paper to a piece of material that sits level in my vise, as a sort of platen. I install a spring-loaded pen in the spindle. This is a standard ballpoint pen refill cartridge made of metal, in a 1/2" diameter steel housing. It has a spring that loads the pen against the front, and a 'collet' at the front that allows the pen to retract against the spring, but keeps it centered within a few thousandths of an inch. I run the program with tool zero selected, and it draws a line at the actual part's outline. (see figure below) Then, I select a tool with the diameter of the tool I intend to use, and run the program again. (Note that Z coordinates in the program may need to be changed to prevent plunging the pen through the platen.) Now, I get to see whether the G41 or G42 compensation that I specified will cut on the desired side of the part. If it doesn't, I then edit the opposite compensation command into the program, and try again. Now, with the tool on the correct side of the work, you get to see if there are any places where the tool is 'too fat' to fit in a concave part of the surface. My old Allen-Bradley 7320 was pretty forgiving on this, but EMC is a complete stickler. If you have ANY concavity where two lines meet at less than 180 degrees on the side that a tool of finite size cuts on, EMC will stop with an error message there. Even if the gouge will be .0001" deep. So, I always make the approach on the lead-in and lead-out moves such that they just nip the corner of the part a tiny bit, providing an angle just over 180 degrees, so that EMC won't squawk. This requires some careful adjustment of the starting and ending points, which are not compensated by cutter radius, but must be chosen with an approximate radius in mind.
The operative commands are :
G40 - Cancel Cutter compensation
G41 - Cutter Compensation, Tool Left of Path
G42 - Cutter Compensation, Tool Right of Path
Here is a short file that cuts one side of a part with multiple convex and concave arcs, and several straight cuts, too. It is to clamp a high speed drilling spindle to the side of the main Bridgeport spindle. Most of these commands are straight from Bobcad/CAM, but lines N15 and N110 were added by me, and some of the coordinates around those lines had to be fudged a bit by me.
N10 G01 G40 X-1.3531 Y3.4
N15 F10 G17 G41 D4 X-0.7 Y3.1875 (COMP LEAD IN)
N20 X0. Y3.1875
N40 X0.5667 F10
N50 G03 X0.8225 Y3.3307 R0.3
N60 G02 X2.9728 Y4.3563 R2.1875
N70 G01 X7.212 Y3.7986
N80 G02 X8.1985 Y3.2849 R1.625
N90 G03 X8.4197 Y3.1875 R0.3
N100 G01 X9.
N110 G40 X10.1972 Y3.432 (COMP LEAD OUT
N220 M02
Line 15 contains G41 D4, which means that the diameter of the tool described as tool #4 in the tool table will be used to offset the spindle by 1/2 the diameter, which is, of course, the tool's radius. Note that the line with the G41 command contains the endpoint of the move where the radius compensation is interpolated in. What this means is that at the beginning of this move, there is no compensation in effect, and at the end, the tool is offset by 100% of the selected tool radius. Immediately after the G41 is D4, meaning that the offset is by the radius of tool number 4 in the tool table. Note that tool DIAMETERS are entered in the tool table. (Jon's tool diameter is about 0.4890)
But, note that in line 110, where the G40 'cancel cutter compensation' command is, that cutter compensation will be interpolated out in this move. The way I have these set up, the moves in lines 15 and 110 are almost exactly parallel to the X axis, and the difference in Y coordinates is to line the tool up outside the portion of the program where cutter compensation is in force.
Some other things to note are that the program starts with a G40, to turn off any compensation that was in effect. This saves a lot of hassle when the program stops due to a concavity error, but leaves the compensation turned on. Also note in line 15 that G17 is used to select the XY plane for circular interpolation. I have used the radius form of arc center specification rather than the I,J form. EMC is very picky about the radius it computes from I,J coordinates, and they must match at the beginning and end of the move to within 10^-11 internal units, so you will have lots of problems with arbitrary arcs. Usually, if you do an arc of 90 degrees, centered at (1.0,1.0) with a radius of 1", everything will go fine, but if it has a radius that can not be expressed exactly in just a few significant digits, or the arc is a strange number of degrees, then there will be trouble with EMC. The R word clears up all that mess, and is a lot easier to work with, anyway. If the arc is more than 180 degrees, R should be negative.