Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: brcarls on April 02, 2013, 01:59:09 PM

Title: G18 and G02 G03 problem
Post by: brcarls on April 02, 2013, 01:59:09 PM
This is my second G-code program ever, so please forgive me if I did something stupid :)

The part should be symmetrical, a slot with 2 opposing "fingers".   The bottom arc of the finger closer to the origin always goes clockwise (I think) whether I use G02 or G03....  Am I doing something wrong, or is this a Mach3 bug?   The problem arc is at the bottom of the program with a (******) comment above it.

I'm using IJ in incremental mode.

%
G20 (inches) G90 (absolute coords) G64 (best speed path)
M6 T3             (0.375 end mill)
G40
F15             (feed rate)
G00 Z0.1
G00 X 0.570 Y-0.190   
M98 P100 L3         (slot the stock)
(G00 Z2)         (retract for tool change)

M6 T6            (Enco 327-1933  1/2X3/64 NARROW USA STRTOOTH KEY CUT .047  )

G00 X 0.928 Y-0.260 (rough undercut)
G00 Z-0.156
G01 Y 0.760
G00 X 0.572
G01 Y-0.260

G00 X 0.928
G00 Z-0.129
G01 Y 0.760
G00 X 0.572
G01 Y-0.260

G00 X 0.938 Y-0.260 (finish undercut)
G00 Z-0.156
G01 Y 0.760
G00 X 0.562
G01 Y-0.260

G00 X 0.938
G00 Z-0.129
G01 Y 0.760
G00 X 0.562
G01 Y-0.260

G00 X 0.908 Y 0
M98 P200 L11    (round fingers on right side)
G91 G01 Y 0.025
G90
G00 x 0.592
M98 P300 L11    (round fingers on left side)

G00 X 0.750       (get in the middle to retract)
G00 Z0.1
M30    

(----------------------------------------------------------------)
O100                (Cut the slot)
G40
G91 G01 Z-.052   (conventional milling... maybe try climb)
G90
G01 Y 0.690
G01 X 0.930
G01 Y-0.190
G01 X 0.570
M99

(----------------------------------------------------------------)
O200               (undercut the finger right side)
G40 G90               
G91 G01 Y 0.025
G90
G18              (XZ plane)
G03 X 0.867 Z-0.088 K 0.041      (90 degree arc)
G01 Z -0.042               (Move up the width of the keyway cutter)
G03 X 0.908 Z-0.001 I 0.041      (90 degree arc)
G91 G01 Y 0.025
G90
G02 X 0.867 Z-0.042 K-0.041      (90 degree arc)
G01 Z -0.088               (Move up the width of the keyway cutter)
G02 X 0.908 Z-0.129 I 0.041      (90 degree arc)
G17            (XY plane)
M99

(----------------------------------------------------------------)
O300            (undercut the fingerleft side)
G40 G90               
G91 G01 Y -0.025
G90
G18              (XZ plane)
G02 X 0.633 Z-0.088 K 0.041      (90 degree arc)
G01 Z -0.042               (Move up the width of the keyway cutter)
G02 X 0.592 Z-0.001 I -0.041      (90 degree arc)
G91 G01 Y -0.025
G90
G03 X 0.633 Z-0.042 K-0.041      (90 degree arc)
G01 Z -0.088         (Move up the width of the keyway cutter)


(************** the following line always goes the wrong way whether I use G02 or G03)
G03 X 0.592 Z-0.129 I -0.041      (90 degree arc)


G17            (XY plane)
M99
            


%
Title: Re: G18 and G02 G03 problem
Post by: Atlas56 on April 02, 2013, 10:00:36 PM
Delete the problem line below and you will find you still have  a problem in the remaining code.
(************** the following line always goes the wrong way whether I use G02 or G03)
G03 X 0.592 Z-0.129 I -0.041      (90 degree arc)

Did you write this code by hand?


Title: Re: G18 and G02 G03 problem
Post by: BR549 on April 02, 2013, 10:46:01 PM
G03 is the proper call in that piece of code . Mach3 does not always draw correctly in g18/19 mode (;-) But it is cutting the correct motion. WATCH the tool motion in the toolpathing  not the Predrawn motion.

(;-) TP
Title: Re: G18 and G02 G03 problem
Post by: brcarls on April 03, 2013, 12:14:45 AM
I wrote the code by hand... I haven't found a CAD/CAM solution that I can afford yet.

I can't delete that line because then the coords will be off for the following arcs and it will give an error. I guess I can try subbing in a straight move instead of an arc.   Would you give a hint as to where I goofed up?

BR549, that's kind of scarey that Mach3 can show one thing, but do another.  Are you saying if I run mach 3 in simulator mode, it will trace the correct path in the Toolpath window, or do I have to run it on my mill to see what it will actually do? (in air I guess so I don't break my tool)
Title: Re: G18 and G02 G03 problem
Post by: BR549 on April 03, 2013, 09:33:43 AM
YEP  either run it in air or go offline so the axis don't move and do a run and WATCH the tooltip on the screen. It will predraw it one way but actually move the tooltip the correct way.  That is how I knew which arc call to use to be correct. To be absolutly sure run the code in AIR and watch the tooltip to make sure.

(;-) TP
Title: Re: G18 and G02 G03 problem
Post by: BR549 on April 03, 2013, 09:42:15 AM
For a free cad /cam try

Cad:  Draftsight

Cam :  Freemill
Title: Re: G18 and G02 G03 problem
Post by: cncalex on April 03, 2013, 09:50:04 AM
Not bad for the second G code ever by hand.  ;)

Look like you don't need a cam program. :)

That toolpath thing was trapping me also sometimes.  ;D

Alex
Title: Re: G18 and G02 G03 problem
Post by: brcarls on April 03, 2013, 09:51:33 AM
I just simulated it and L.I.B. the tool tip moved the right way even though it was pre-drawn incorrectly.

I'm rethinking whether my keyway cutter can do what I'm asking (don't think it will last very long cutting vertical arcs like I want), but that's not a g-code issue.

Thanks for the recommendation on software.  I will check them out, but I also need to get comfortable with g-code.
Title: Re: G18 and G02 G03 problem
Post by: BR549 on April 03, 2013, 11:18:13 AM
The standard keyway cutter does not side cut well(;-)

Just a thought.
Title: Re: G18 and G02 G03 problem
Post by: BR549 on April 03, 2013, 03:51:47 PM
You did a great job in programming that code. (;-)

(;-) TP
Title: Re: G18 and G02 G03 problem
Post by: brcarls on April 03, 2013, 04:25:29 PM
It's getting a lot more complicated as I am rewriting it to try to minimize side cutting with the keyway cutter...    I can't turn it on it's side and do it with a tiny end mill because it's probably too deep (1/2") for a .050" or so end mill, plus I really need a fairly sharp inside corner on the underside of the "finger", plus my spindle only does 4500 rpm... 

I've been straining my brain trying to figure how to to do this without having a custom tool ground.   The answer I think is EDM, but that's not in my future any time soon.  :)
Title: Re: G18 and G02 G03 problem
Post by: BR549 on April 03, 2013, 04:39:10 PM
I think if you look at t slot millers they can do a bit of side cutting.

Just a thought, (;-) TP
Title: Re: G18 and G02 G03 problem
Post by: brcarls on April 03, 2013, 04:40:43 PM
Will do, thanks for the tip.   I just picked the keyway cutter flipping through a tooling catalog..    I'm an electrical engineer by trade and all I know about machining is that I want to remove all of the metal that isn't my part.
Title: Re: G18 and G02 G03 problem
Post by: BR549 on April 03, 2013, 04:45:51 PM
Spoken like A true chip slinger (;-)

(;-) TP