Hello Guest it is September 28, 2020, 06:40:49 PM

Author Topic: New Cutter Comp code and Examples  (Read 25694 times)

0 Members and 1 Guest are viewing this topic.

New Cutter Comp code and Examples
« on: December 22, 2008, 01:05:20 AM »
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 1

I 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... ;)

Code: [Select]
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... :)

Code: [Select]
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 3

Not 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.
 
Code: [Select]
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 4

In 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... :)

Code: [Select]
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.

Code: [Select]
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
« Last Edit: December 22, 2008, 08:30:16 AM by Brian Barker »
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: New Cutter Comp code and Examples
« Reply #1 on: December 22, 2008, 02:02:14 AM »
Hi Brian,

Looking nice!
I've a couple of detail questions -
In your post you gave some rules:

1. You can only do Comp on and Comp off moves with G2 or G3
?: Is this what you meant to say? I'm a tad confused as I would have thought that the comp moves woudl have to be linear and NOT arcs, but the sentence seem to me to say the opposite. The examples seem to do G01 moves on the G41 lines...
Example 1 has "G01 G91 G41 D2 Y1.0F30 (.5 for the tool DIA)"    - have I misunderstood?

2. All moves should be longer than the amount that you would like to offset (no small segmented files)
?: I think you meant all "comp on/off" moves - correct? I'd think that one can move the cutter by an amount less than the radius comp amount.

3. All inside arcs must be greater then the amount you are comping
?: OK, I think this means "don't try to squeeze a .5 cutter into a .25 radius hole".
What does mach do if you try?
Throw an error?
Is this checked for when mach simulates the code?

4. G20 G21 and G30 CAN NOT bu used when comp is on..
?: I think you mean that you can not change from G20 ro G21 or vise vera while comp is on - but that either G20 or G21 can be an active mode while comp is active - correct?
G30 is verboten, how about G28 and G28.1?

5. No more then 50 non movement lines in a row in the file ( this is all we have for a lookahead buffer)
?: Is this really non-movement "lines" or is it non-movement "blocks"? I.e does two lines, each with 3 m-code blocks on each line count as 2 or 6? I'd guess 6, could you confirm which is correct?

Dave

Offline Graham Waterworth

*
  • *
  •  2,159 2,159
  • Yorkshire Dales, England
    • View Profile
Re: New Cutter Comp code and Examples
« Reply #2 on: December 22, 2008, 08:20:26 AM »
I think Brian is a bit punch drunk with programming code so let me try to clarify this.

Rule 1.

You can not apply or cancel cutter comp on a G02 or a G03 command :-

e.g.

G01 G42 P2.5 X20. is legal code

G02 G42 P2.5 X20. Y0 R10. is NOT

Rule 2.

The lead in and lead out lines must be longer than the rad of the cutter, so if you are using a .5" diameter cutter the lead lines must be longer than .25", the general rule is 1.5 X radius of cutter.

Rule 3.

You can not use a cutter larger than the smallest internal diameter, if your smallest rad is .25" then the largest cutter you can use is .4999" diameter.

Rule 4.

G20, G21, G28, G28.1, G30, G31 and G52 can NOT be used with in a block of comp code, e.g. these g-codes must not be used between G41/42 and the G40

Rule 5.

You can NOT have 50 consecutive lines of code without a movement command, e.g. X,Y

A line is 1 or more blocks terminated by a return

I hope this clears the confusion.

Graham
 
« Last Edit: December 22, 2008, 05:34:17 PM by Graham Waterworth »
Without engineers the world stops
Re: New Cutter Comp code and Examples
« Reply #3 on: December 22, 2008, 08:33:09 AM »
Yeah I was up way to late making that post.. in other news I now have about 16" of new snow LOL

Thanks for setting that straight for me Graham!
Brian
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

vmax549

*
Re: New Cutter Comp code and Examples
« Reply #4 on: December 22, 2008, 10:21:18 AM »
Brian had me worried(;-) BUT Graham got my heart back started again(;-)

Brian don't you have a CNC snow shovel powered by MACH ? Heck we even have snow shovels down here (to pick up the fall leaves)

(;-) TP
Re: New Cutter Comp code and Examples
« Reply #5 on: December 22, 2008, 10:56:01 AM »
I took out the 60 Hp 4wd tractor with the loader :) that made short work of the problem LOL

Yeah I made that post after I got in from plowing and was ready for bed..

Shoudl have this version out soon for you to play with!

Thansk
Brian
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: New Cutter Comp code and Examples
« Reply #6 on: December 22, 2008, 12:03:07 PM »

Rule 3.

You can not use a cutter larger than the smallest internal diameter, if your smallest rad is .25" then the largest cutter you can use is .5" diameter.


Rule 3 is the only one I think is a problem with the new comp. Firstly the rule says the inside arcs must be greater than the comp, and I found this to be the case in my testing of the new comp code.

So if the smallest rad is .25 then the largest cutter must be .4999 or smaller. A .5 cuter with a comp of .25 wont work as its equal to the smallest arc. Very limiting as code with .125 inside arcs almost cant be cut now.

Graham Hollis



Re: New Cutter Comp code and Examples
« Reply #7 on: December 22, 2008, 12:27:16 PM »
Is there any way that cutter comp can be used on the X/Z plane (G18). I want to use the equivilent of a ball end mill to cut a sort of semi circular path with the X/Z axis using comp with re ground tools. Alternatively could I use the scaling facility by working out how much under nominal size my cutter is then scaling the program to compensate.

Offline Graham Waterworth

*
  • *
  •  2,159 2,159
  • Yorkshire Dales, England
    • View Profile
Re: New Cutter Comp code and Examples
« Reply #8 on: December 22, 2008, 02:49:04 PM »
Quote
So if the smallest rad is .25 then the largest cutter must be .4999 or smaller. A .5 cuter with a comp of .25 wont work as its equal to the smallest arc. Very limiting as code with .125 inside arcs almost cant be cut now.

so what is wrong with using a 6mm (.236") cutter

Graham
Without engineers the world stops

vmax549

*
Re: New Cutter Comp code and Examples
« Reply #9 on: December 22, 2008, 03:19:17 PM »
HUM so you guys are saying we still can't cut a .250 radius with a .500 cutter??  WHere this comes into play is with deep pockets where it would be best to use as large a tool as possible. Reaching down 2.000" into a pocket is better cut with a .500 tool rather than to back up to a  .437 or .375 tool (flex).

OR can we fudge and say the cutter is .4999 and it will still run????

(;-) TP

« Last Edit: December 22, 2008, 03:23:18 PM by vmax549 »