Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: Psad on August 01, 2006, 12:18:40 PM

Title: G42 problem
Post by: Psad on August 01, 2006, 12:18:40 PM
I posted this on the lazycam forum but i think it may be more of mach 3 issue.  Attached is a tap file created with LC latest release.
When i run this file using a .250 cutter in tool #1 the cutter is weird at the leadin area.  It appears there is an issue right after the G42 command.  It appears that Line 60 and 65 combine instead of 60 completing before 65 starts.  As the leadin finishes there is a slight angle as it moves to the tool path.  It does not make sense because according to the code it should not combine the too moves.  If it did the angle would be the entire length of the first compensated toolpath. 

In my first post i recieved a reply from someone (ger21) telling me i had not put in enough information for tool # or tool dia but that does not seem to be the issue.  The file runs fine from LC except for this one issue.  I tried modifying the code file with that Ger21  suggestion, still same problem.  I also tried this with other leadins and with version 90.60 still same issue.

Am i nuts or am i doing something wrong.

LZ postion is also about g42 problems about #3 down the list.
Title: Re: G42 problem
Post by: Graham Waterworth on August 01, 2006, 09:26:15 PM
What is the code like if you tell LZ that the cutter is .125" dia

Graham.
Title: Re: G42 problem
Post by: ger21 on August 02, 2006, 08:05:52 PM
N40    X0.5817 Y0.5729
N45 M3 S100
N50    Z0.1000
N55 G1 Z-0.2500  F3.00
N56 G42 p0.125
N60    Y0.4004  F10.00
N65    X0.2129

It appears to me to be working exactly as it should. It's not combining the moves. I think you don't understand how the advanced comp works in Mach.

When you use comp, at the position prior to the G42, the center of the tool is at that position, in this case X .5817 Y .5729 is the center of the tool. As the tool begins to move, it moves to a postion where the tool edges are tangent to the next two moves. Imagine drawing an angle through your 3 points.

X .5817 Y.5729
X .5817 Y .4004
X .2129 Y .4004

After the comp, the tool is tangent to the 2 sides of the angle.

I did a sample drawing. The blue circle is the tool before the G42. Red line is the g-code without the comp, which is what Mach displays. Green line is the actual comped path. The first angled move is the G1 Y.4004 move. As the comp is applied, the tool moves to the tangent point of that move and the next move. Notice how it's tangent to the red line.

This is exactly how it's supposed to work. If you want the tool to start on your part at the same place it ends, you'll need to apply the comp one move sooner.
Title: Re: G42 problem
Post by: Psad on August 03, 2006, 06:39:57 AM
Your right I did not understand how it worked.  as they say a picture is worth a 1000 words.
thanks.  Should the last cut then remove the small angle since it is going back to the center of the green circle???? 
Title: Re: G42 problem
Post by: ger21 on August 03, 2006, 07:54:59 AM
  Should the last cut then remove the small angle since it is going back to the center of the green circle???? 

No, the last cut does not go back to the green circle. You need to start your cut farther to the right and overlap slightly, or enter and exit using tangent arcs at the same point and apply the comp before you get to the entry arc.
Title: Re: G42 problem
Post by: Psad on August 04, 2006, 09:17:07 AM
Now i see the advantage of the 45 and arc type leadins as opposed to the straing in.
Never to old to learn soemthing new.
Title: Re: G42 problem
Post by: C.Michael on December 01, 2006, 09:50:34 PM
N40    X0.5817 Y0.5729
N45 M3 S100
N50    Z0.1000
N55 G1 Z-0.2500  F3.00
N56 G42 p0.125
N60    Y0.4004  F10.00
N65    X0.2129

On line N56...if you replaced the G42 with G41 would the offset be on the left side of the path..I just imagine that I am the cutter bit going down the path like a highway..wouldn't a G41 place me in the left lane and a G 42 place me in the right lane and no offset code would put me in the middle lane..Am I thinking right here?? ???
Title: Re: G42 problem
Post by: Graham Waterworth on December 02, 2006, 01:42:23 AM
That would depend on where you live UK or US  ;D

G41 and G42 are dependent on the direction you are traveling clockwise or counterclockwise

This should help to explain it :-

O0001 (COMP G41 AND G42)

G21 G40
G91 G28 X0 Y0 Z0

(OUTSIDE CW)
G54 G00 G90 G43 X-19.445 Y35.91 Z25. H3 S2500 M3
G00 Z1.
G01 Z-1. F500.
G01 G41 D23 X-5.303 Y14.697 F800. S2500
G03 X0. Y12.5 R7.5
G02 X10.827 Y-6.248 R12.5
G02 X-10.827 R12.5
G02 X0. Y12.5 R12.5
G03 X5.303 Y14.697 R7.5
G01 G40 X19.445 Y35.91
G00 Z25.

(INSIDE CW)
G00 X46.25 Y3.75
G00 Z1.
G01 Z-1. F500.
G01 G42 D23 X50. Y12.5 F800. S2500
G02 X60.827 Y-6.248 R12.5
G02 X39.173 R12.5
G02 X50. Y12.5 R12.5
G01 G40 X53.75 Y3.75
G00 Z25.

(INSIDE CCW)
G00 X53.75 Y-46.25
G00 Z1.
G01 Z-1. F500.
G01 G41 D23 X50. Y-37.5 F800. S2500
G03 X39.173 Y-56.248 R12.5
G03 X60.827 R12.5
G03 X50. Y-37.5 R12.5
G01 G40 X46.25 Y-46.25
G00 Z25.

(OUTSIDE CCW)
G00 X19.445 Y-14.09
G00 Z1.
G01 Z-1. F500.
G01 G42 D23 X5.303 Y-35.303 F800. S2500
G02 X0. Y-37.5 R7.5
G03 X-10.827 Y-56.248 R12.5
G03 X10.827 R12.5
G03 X0. Y-37.5 R12.5
G02 X-5.303 Y-35.303 R7.5
G01 G40 X-19.445 Y-14.09
G00 Z25.

G91 G28 Y0 Z0
M30

Title: Re: G42 problem
Post by: Chaoticone on December 02, 2006, 10:38:05 AM
Let no Man nor Beast question the infinite knowledge of the G Code Guru. ;D Nice break down Graham. Even I can understand that.
Title: Re: G42 problem
Post by: ger21 on December 02, 2006, 10:39:52 AM
Make sure you have a tool size for tool #23 in your tool table before running Graham's code, or you won't see any comp occuring.
Title: Re: G42 problem
Post by: Graham Waterworth on December 02, 2006, 10:48:54 AM
Oops, Good point Gerry, forgot to mention that bit,

Its a work habit, we have 20 tools in our machines so we always add 20 to the tool number for the dia offsets as our machines don't have length and dia in one offset.

The circles are 25mm dia on a 50mm grid.

Graham.


Title: Re: G42 problem
Post by: C.Michael on December 02, 2006, 11:55:12 AM
I think I have it...Let me see if I have the concept by trying to explain it back to you..If I have a straight level line on my screen horizontal...If the code has the bit traveling left to right and I want the bit to be offset to the north side (top) then a G41...traveling the same direction but offset to the south (bottom) then a G 42....If the code has the bit traveling right to left...and I want the bit offset to the north,then a G42,,,If I want it to the south then a G41...With no tool changer then the code would be G41p.0625...if I had a router cutter bit of .125 inches...Sir Graham..can you grade my test please  : )
Title: Re: G42 problem
Post by: Graham Waterworth on December 02, 2006, 12:35:16 PM
10 out of 10, go to the top of the class  ;D

Graham.
Title: Re: G42 problem
Post by: Graham Waterworth on December 02, 2006, 01:59:24 PM
Here is what you are talking about,  I think I have put in all the detail this time.

Tool dia 10mm
Height offset 3
Using 'P' this time, set to 5.0mm

Graham.

O0002 (G41 - G42)

G21 G40
G91 G28 X0 Y0 Z0

N1 (10MM END/SLOT DRILL)
(TOP LEFT EDGE)
G54 G00 G90 G43 X-2.5 Y12.5 Z25. H3 S2500 M3
Z1.
G01 Z-1. F500.
G41 P5.0 X-7.5 Y7.5
G03 X0. Y0. R7.5
G01 X25.
G03 X32.5 Y7.5 R7.5
G01 G40 X27.5 Y12.5
G00 Z25.

(TOP RIGHT EDGE)
G00 X77.5 Y12.5
Z1.
G01 Z-1.
G42 P5.0 X82.5 Y7.5
G02 X75. Y0. R7.5
G01 X50.
G02 X42.5 Y7.5 R7.5
G01 G40 X47.5 Y12.5
G00 Z25.

(BOTTOM LEFT EDGE)
G00 X-2.5 Y-62.5
Z1.
G01 Z-1.
G42 P5.0 X-7.5 Y-57.5
G02 X0. Y-50. R7.5
G01 X25.
G02 X32.5 Y-57.5 R7.5
G01 G40 X27.5 Y-62.5
G00 Z25.

(BOTTOM RIGHT EDGE)
G00 X77.5 Y-62.5
Z1.
G01 Z-1.
G41 P5.0 X82.5 Y-57.5
G03 X75. Y-50. R7.5
G01 X50.
G03 X42.5 Y-57.5 R7.5
G01 G40 X47.5 Y-62.5
G00 Z25.
G91 G28 Y0 Z0
M30

Title: Re: G42 problem
Post by: C.Michael on December 03, 2006, 02:57:31 AM
(TOP LEFT EDGE)
G54 G00 G90 G43 X-2.5 Y12.5 Z25. H3 S2500 M3
Z1.
G01 Z-1. F500.
G41 P5.0 X-7.5 Y7.5               I see the g41 code here with P offset and the offset coordinates...  How are you coming up with these coordinates??
G03 X0. Y0. R7.5                    Do you have to have these coordinates?   I thought you just put in the P5.0 and you were done??
G01 X25.                               
G03 X32.5 Y7.5 R7.5
G01 G40 X27.5 Y12.5
G00 Z25.
Title: Re: G42 problem
Post by: Graham Waterworth on December 03, 2006, 04:57:43 AM
The top left line starts at X0 Y0 and ends at X25. Y0,  by starting the cut at a known point in free space that is larger than or equal to the cutter radius you don't get pips on the edges of the start and finish cut.

I tend to use 1.5 times the cutter radius

The cutter is 10mm dia so, 10/2=5  then 5*1.5=7.5

By applying the comp on the move to x-7.5 y7.5 the tool is in the right place ready to blend without any uncut edges.

It all makes for a much nicer cleaner cut.

If you load the code into Mach3,  double click the code viewer, then scroll down the code line by line you will see the tool path highlighted line by line.

Graham.
Title: Re: G42 problem
Post by: ger21 on December 03, 2006, 07:51:24 AM
When I'm cutting out parts, here's my method for doing comp using AutoCAD. Pick a corner of the part where you want to start and stop, and extend those lines a little more than 1/2 the tool diameter. Then I add the leadin move to the start. I use the leadin to ramp into the part, and since I work with wood, I find that an 1-1/2" long ramp works pretty well with a 1/2" tool. I try to keep in in line with the part profile, offset to the side by the radius, which will actually let the tool enter the stock on a fairly straight path while the comp is being applied.Then I add a leadout move, where I ramp out of the part, which prevents a dwell at the end of the cut which can dull the tool a little bit. I use a macro that I wrote for AutoCAD that exports the g-code directly from AutoCAD, with the G41/G42 code and ramping automatically applied.
Title: Re: G42 problem
Post by: C.Michael on December 03, 2006, 02:18:39 PM
This is the part where I feel like such a dunce...On that top left line...the cords are X0,Y0....X25,Y0   with the lead in and everything that cutter bit is going right down the middle of the line...then my part would be 1/16th too small (with a 1/8th bit)  I would need the bit to travel on the line of X0,Y.0625...X25,Y.0625...Do I need to draw my part a 1/16th of an inch bigger all away around to make the bit cut my part at the right size???
Title: Re: G42 problem
Post by: Graham Waterworth on December 03, 2006, 02:23:26 PM
You are not a dunce,

when you are using G41 or G42 you program the tool path as if the cutter had a diameter of zero, e.g. you draw it to the correct size you want to cut,  then the compensation dose the rest.

Graham.
Title: Re: G42 problem
Post by: C.Michael on December 03, 2006, 03:36:23 PM
Thank you Graham,I appreciate your fantastic help..It is amazing how much patience you have!!...This is what I am trying to do..I like to design and build model airplanes using autocad 2000...after drawing the part of the plane (a wing rib for ex.) ..I import the dxf file to Lazycam..this rib may have 3 or 4  lightening holes in it..as you know it has three options for the lead in..I do that for each hole and for the outside profile of the rib..these lead ins are a good size for a clean cut as you described..I put a check in the box that says..Use G41/G42 on lead in outputs...in the Posting options..After creating the G code, I open the file up using notepad ..You can see the lines (many of them) that has the G 41 or G42 on it...But that is all the line has...G42...nothing more...I go to each of these lines and add P0.0625...To make the line read exactly this...G42P0.0625....For a .125 router bit..If it reads G41 I put in...G41P0.0625...With the lead ins created in Lazycam and the modifying of the G41/G42 lines,I should be done ..shouldn't I  ??  Michael
Title: Re: G42 problem
Post by: Graham Waterworth on December 03, 2006, 03:43:08 PM
Email me your DXF file and the code generated by Lcam and let me see what we are talking about.

You can get my email by clicking on my user name above the picture of my car.

Graham.
Title: Re: G42 problem
Post by: C.Michael on December 03, 2006, 04:27:11 PM
Graham....The Lcam file and the tap file are on its way to you..You are more than welcome to post it here and show the file here..please do..I forgot the dxf file I will resend...Michael
Title: Re: G42 problem
Post by: Graham Waterworth on December 03, 2006, 05:49:45 PM
Michael,

No DXF file yet.

Graham.
Title: Re: G42 problem
Post by: C.Michael on December 03, 2006, 06:37:06 PM
I resent it to you zipped up
Title: Re: G42 problem
Post by: Graham Waterworth on December 04, 2006, 03:50:12 AM
Hi Michael,

I have looked at your files and all look OK,  I think the problem is with Lcam, its just not putting the compensation size (P) or a tool offset (D) into the code.

This is what I would do :-

Create your programs with Lcam

Set a tool length and diameter in the tool offset table, use tool 1 with a length of 0.00 and a diameter of .0625"

On the first G41/G42 in your program add D1, you do not need to do this for every G41/G42 as D1 is global.

e.g.

N5 (File Rib1 )
N10 (Default Mill Post)
N15 (File Posted in Mill Mode)
N20 (Sunday, December 03, 2006)
N25 G90 G80 G40 G91.1
N30 G0  Z1.0000
N35  X1.3309  Y1.9273
N40  Z0.2500
N45 M3
N50 G1  Z-0.1250  F10.00
N55 G42 D1
N60  X1.5034   F15.00
...........

This will make Mach use the tool offset you set in tool 1 for the compensation on the contours.

Try this with the tool just scratching the face of the material, you should be able to measure the size to comfirm all is well.

This is what my Sim gives as the profile.

Graham.
Title: Re: G42 problem
Post by: C.Michael on December 04, 2006, 09:46:54 AM
Thank you Graham...I didn't know you could do that with the tool offset feature..I would like to be able to make a whole table of wing ribs on one tap file and having to scroll down the multi thousand line list would not be fun, putting in P.0625 at each G 42...Thanks again for your effort!..Ill let you know how it turns out..Michael
Title: Re: G42 problem
Post by: ger21 on December 04, 2006, 10:32:28 AM
If you can get a copy of AutoCAD 2002, I have a macro that will output the g-code directly including the G42's, including the Px.********* You'll need to draw the leadin and leadout moves yourself, though. Let me know if you need a link to it.
Title: Re: G42 problem
Post by: Graham Waterworth on December 04, 2006, 11:16:10 AM
In my opinion the 'P' version of G41/42 is dangerous and a pain to use.

If you have any more than one in the code there is always the chance one could get missed when editing the size, also the code has to be output to an editor and reloaded just to do this.

Not only that but why should you have to change a whole load of them when changing 1 offset value will do it all.

It is far better to use 'D' with compensation, not only do you have the diameter offset but also the wear offset to compensate for minor tool variations.

There is the bonus of being able to have the contour in a sub program and using it for both roughing and finishing just by changing the 'D' number in the main program. If anybody wants to see how this is done, ask

Learn to do it like the professionals do it,  FORGET THE 'P'

Graham.
Title: Re: G42 problem
Post by: C.Michael on December 04, 2006, 08:41:53 PM
Well...I had my first successful cut today...that rib...I went down the list and inserted the P.0625all the way down..12 times...because each hole was cut twice at two different depths,and then the outside profile twice...next is to try the D1 way..Can"t thank you guys enough..I am having fun again

To ger21..I do have ACAD 2000...it was' E'asy looking for it by the BAY if you know what I mean... ;)...because people upgrade all the time  but they hardly ever let go of things above 2002..If you let me know where I can find 2002 it would be much appreciated...Thank you also for the help...It was really getting frustrating there...Michael