Hello all,
I have been hard at work on the Cutter Comp code (this a complete rewrite). The old code was a bit of a mess and needed to be made more like what you will see in all the training books. The new Comp code is Type C (anti-gouge). This does not mean that it will act like a CAM program (ie. intelligent enough to skip segments that it cannot cut - it *will* cut every line of code), and there are rules that you MUST follow. So, first things first, we will go over what you should *not* do:
1. You can NOT do Comp on and Comp off moves with G2 or G3.
2. All moves should be longer than the amount that you would like to offset (ie. no small segmented files).
3. All inside arcs must be greater than the amount you are comping.
4. G20, G21, and G30 CAN NOT be used when Comp is on.
5. No more than 50 non-movement lines in a row in the file (this is all we have for a lookahead buffer).
6. Leadin moves should be longer than the amount that you are going to offset.
If you follow these 5 rules, you should be all set...
Now for the fun, lets see it working!
Example 1I am going to start with a program that is mostly in Inc format and has a sub call to get it to depth. Please note that I cam calling the Comp on and off out of the sub, and that it is a simple leadin...
G90 G0 X0.0 Y0.0
Z0
G01 G91 G41 D2 Y1.0F30 (.5 for the tool DIA)
M98 P1001 L5
G40
G0 Z.5 Y-1
X3
G01 G91 G41 Y1.0
M98 P1001 L5
G40
G0 Y-1 Z.5
G90
M30
O1001
X-1
Y2
X2
Y-2
X-1
Z-.1
M99
Example 2 In this example, you will see Cap moves added and arcs trimmed to fit the intersection. Also note that the leadin moves are about 180 from where they should be! Mach3 knows that this would scrap your part, so it adds an arc to go around the end of the move to prevent gouging. This Arc move around the tip is Type C Comp at work...
G00 Z 1.0
N6G00 X1.50 Y4.5
Z.1
G01 Z-.5 F30
G01 G41 D2 X1.0Y5.52982 F100 (Dia == .5)
N11G02X4.33052Y5.17443I1.5437J-1.3165
N12X4.9639Y5.28092I0.4737J-0.8807
N13G03X4.80423Y8.29375I-7.0347J1.1378
N14G02X5.49542Y5.01642I-0.775J-1.875
N15X5.79242Y4.44694I-0.6912J-0.7227
N16G03X8.60845Y5.52982I-1.0917J7.042
N17G02X5.70512Y3.8597I-2.0227J0.1577
N18X5.25529Y3.40126I-0.9009J0.434
N19G03X7.15537Y1.05768I6.36J3.2144
N20G02X4.66981Y3.30282I-0.4751J1.9724
N21X4.09481Y3.58896I0.1344J0.9909
N22G03X2.45309Y1.05768I5.0224J-5.0554
N23G02X3.82026Y4.11537I1.7291J1.0614
N24X3.91471Y4.75066I0.984J0.1784
N25G03X1.0Y5.52982I-3.256J-6.3388
G01G40X1.50 y7.5
G00 Z.5
m30
Example 3Not all programming with comp is for Part Line programming. I like to do Center Line programming and use the Comp for wear offsetting. Here is an example of a slot being cut with Comp. The first is a Comp offset of zero and the second is .05 for an undersized end mill.
G00 Z.1
G00 X0 Y.1
G00 G41 D1 Y0.0 (Offset 0.0 - .05)
G01 Z-.2
X1.0
X0
G40
G00 Z.10
Y-.1
M30
Example 4In this example, we will see how the Comp works inside pockets. This is a nice simple ABS file that I made by hand, so sorry for the sloppy code...
G00 X-1.75 Y0.0
Z.1
G1 Z-.5 F30
G42 D4 Y-.25 F45 (.25Tool Dia)
G2 X-2 Y0.0 R.25
G1 Y1
G2 X1.5 R2
G1Y2
X3.0
Y-.5
X-2
Y0
G2 Y.25 X-1.75 R.25
G40
G01 y0.0
Z.5
M30
Example 5 Here is an example that is using the Type C Comp leadin moves, and will not gouge the part with a parallell leadin move.
G00 X0.0 Y1.5
Z-.5
G1 G41 D3 Y1.0 F10 (Tool DIA == .375)
Y0.0
G3 X.25 Y-.5 R.35
G1Y-1
G40Y-1.5
G0 Z1.0
M30
If you have any questions about what was done in the examples, I can answer them, but if you are looking for books that you can read about how this works I would highly recommend "
Programming of CNC Machines" by Ken Evans or "
CNC Programming Handbook" Peter Smid. I have found that Ken's book has more depth of knowledge about what the machine will do with odd situations, and Peter's book explains how Comp in general works, with good explanations and diagrams of the different types - both good to know...
This code is soon to be released in the 3.043.00 development version for testing, and any comments should be posted in this thread.
Thanks and enjoy!
Brian