Help writing G-code pocket program for mill
This is going to be pretty basic. I just want to see how someone would write a code to pocket a circle with cutter comp active.
I thought it would be simple but then I realized that I'd want overlap at the center of the circle, and got confused :X
Anybody wanna help, let's say 2" circle 1/8" deep with 1/2" cutter, and 50% overlap?
If you're talking strictly fingerCAM, then I'd do tool-center in the middle of the circle and only comp the "wall" pass.
That is by the way most CAM programs do it also.
In this case, assume X/Y0 being the circle center:
G00 G43 H01 D01
G00 X0 Y0 Z1.
G01 Z.05 F200.
G01 Z-.125 F5.
G03 I-.25 J0
G03 I-7. J0
G01 G41 X1.
G03 I-1. J0
G01 G40 X0 Y0 Z1. F200.
Or, you can ramp into the arc and down to the bottom rather than plunge:
G00 G43 H01 D01
G00 X.25 Y0 Z1.
G01 Z.05 F200.
G03 Z-.05 I-.25 J0 F5.
G03 Z-.125 I-.25 J0
from here same as before
There are lots of ways to do it, depending on how much effort you want to put in to it, what make and model control you have, and what your cutter is capable of.
You are right that attempting to start at the center with cutter compensation active without giving the control a large enough radius to avoid overlap will be troublesome. However, if you mill/drill away at least a cutter diameter in the center during your plunge, then your first circle can have a programmed radius twice the cutter radius, and still only have a 50% width of cut.
The approach you take to cutter compensation lead-in will depend on your make and model of control. Some controls can start comp with a zero-length move; some require any non-zero length (say >= 0.001"); and some require a move at least as long as the cutter radius or diameter.
Supposing that you need a long lead-in; that the final pocket diameter is more than twice the tool diameter; that you can plunge straight down with your tool (e.g. 2-flute end mill in easy-cutting material); that you want to approximate a spiral out; and that you want to climb mill the whole thing:
Rapid to pocket center, Z clearance
Feed Z at plunge rate to cutting depth
Activate comp left (G41)
Feed to one cutter diameter X+ of pocket center
CCW arc (G3) 360 degrees (this may take multiple lines, depending on your control)
CCW arc approx. 90 degrees, to X center, Y center+diameter+1*stepover
CCW arc 270 degrees, to X center+diameter+1*stepover, Y center
CCW arc approx. 90 degrees, to X center, Y center+diameter+2*stepover
... Repeat 90/270 until within finish allowance, then spiral out to finish dimension
CCW arc 360 degrees, ending at 12:00 position (X center, Y+pocket radius)
CCW arc 180 degrees, ending perhaps halfway to 6:00 position (X center, Y-pr/2)
Cancel cutter comp (G40)
Line back to pocket center
Rapid Z back to clearance
For the spiral step-out moves (approx. 90 degrees, from 3:00 to 12:00) use the radius that you are stepping out to as the radius of the arc.
G0 X0 Y0 Z.1
G1 F6 Z-.125
G1 F12 X.5
G3 X0 Y.75 R.75
G3 X.75 Y0 R-.75
G3 X0 Y.99 R.99
G3 X.99 Y0 R-.99
G3 X0 Y1 R1
G3 X0 Y-.5 J-.75
G1 X0 Y0
Last edited by MLeonard; 09-23-2008 at 09:25 PM.
Reason: Added G code
This is basic its for a fanuc control.
O1234( 2 inch circle .125 deep )
T01M6 (.5 END MILL)
GO G90 G54 X0 Y0 S3500 M3
G43 H1 Z.1
G41 D1 Y1 (CUTTER COMP. ON )
G1 G40 Y.5 (CUTTER COMP. OFF)
Interesting everybody does it alittle different but the results are the same.
Wow thank you guys for putting the work into helping me, I've read everything closely.
The G-code I want to write is for a Milltronics machine with Centurion 7 control. I'll figure out the specifics through the manual and maybe a chirp here or there.
Thank you for the extensive G-code experience, though. This will be a major help in getting started.
Does any machine builder make a G-code canned cycle for roughing pockets, frames, etc. on a mill? I'm used to Hurco, which has a control I would give awards to. Slap a Fischer-Price logo on the corner of the control box and it wouldn't seem out of place! That's not a disparaging comment either, given my recent struggles with Fanuc and G-code. :>
The G150 deal on the Haas works pretty good.
The A2100 had a bunch of canned cycles for pockets and frames.
I think the Dynapath does too.
I am not sure about the manwell guide on the Fanucs.
Circle pocket for that 2" diameter on a Haas with full cutter comp looks like this:
G13 I.5 K1. Q.25 F5.
Is the Hurco any simpler?
With Hurco, you'd add a new block in conversational. Pick Milling, then Mill Circle.
Then you go into the block and change it to inside circle, select what tool, change from climb/conventional to pocket, finishing tool if you want, and put in the coordinates X0 Y0, Z start, Z bottom, peck depth, Auto, cycle start.
Hmm... LIke I've said
On Haas G12 is conventional, G13 is climb.
One block and one block only to define start radius, finish radius, radius increment, Z-depth and # of steps to get to Z depth. WIth full comp unless D0 is specified in which case no comp is applied.
The credit however should go to Yasnac as it is their command which is implemented by Haas.
No need to mess with stinkin' conventional either, just plunk it into your G-code whenever there is a circle pocket.
So, is the Mighty Mushroom still open? I lived there a long time ago. Joyce's pizza kept me alive.
Yeah I was thinkin about your post Seymour, that is a pretty slick code. I think that beats Hurco for simplicity in this case.
Originally Posted by SeymourDumore
However, on Hurco -everything- is conversational. It isn't like some machines where the conversational is like an add on. On Hurco the conversational is the interface.
If you wrote that program block to pocket mill on a Hurco, you'd basically slam right through the important stuff, scan over your options, and move on. The nice thing is that although the Haas/Yasnac G-code you posted is short, remember that you've got to program to change tools, start the spindle, move to start position, and move back out of the cutting zone when you're done. With Hurco, that's all accomplished with the mill circle block.
Matt, not sure if I've eaten at either of those places. I'll check it out though, I've only been in Florida for a year. I've been living over in Palm Bay but will move to probably West Melbourne or Eau Gallie soon.
Yean man love Yasnacs,we have 6 vmc's with Yasnac controls. I like using g13 whenever I can.
I've never seen a Hurco control,but I have run plenty on mazak mazatrols. G13 is the same as choosing a circle mill,the conversational controls just do all the other inputing for you.
I grew up on Mitzy's ..... G 13's and G 12's are like a pair of 6-shooters for a cowboy.
Originally Posted by Mfassler
On worn or heavilly compensated mills, you can get a perfect, interpolated circle......by using one of each , and a dead-pass of each.
eliminates the opposite kiddy-corner, high and low results.
when G-coding by finger-cam. Be care-full which line you turn comp off.
or your last move will cut to tool-center.
For some reason guys who came from say Master-Cam first.....
and have to write-yer-own.....miss the G1 G40 sometimes.