Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Tarak on September 27, 2010, 09:50:22 PM

Title: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: Tarak on September 27, 2010, 09:50:22 PM
Below is a copy of a program that produces the strange movement.
If I enter a value for the corner radius on our grinding wheel it seems to offset correctly except when moving, it will move Y12 but also moves X  the value of the wheel radius.
If you alter the tool diameter and watch the movement of the Y12 you will see what I mean.
Got me pooched!!.......Can someone please offer some insight?


(strange tapering of parallel movement)
#1=4       ;No of Cuts
#2=400    ;Feedrate
#3=0.05   ;Cut Size
#4=1.      ;Corner Radius on Wheel

#6=[#1*#3] ;(No of Cuts * Depth of Cuts)
G90 G54 G21 G40
G41 G0 X0. Y0. P#4
M1
M98 P1 L[#1-1]
G40
M30



O1
G91 G0 X#3 Y[#3-[#3*2]]
G0 Y-18.
X5.
G1 Y12. F#2 ;Tapers this parallel movement the amount of radius comp that is put on
G2 X1. Y1. I1. J0.
G1 X5. ;Does this line correct (one axis only)
X5. Y5.
G0 X-16.
M99

Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: BR549 on September 27, 2010, 10:42:38 PM
IS this Mill or Turn code??? YOu mention grinder wheel radius.

(;-) TP
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: Tarak on September 27, 2010, 11:03:20 PM
Oh, sorry forgot to mention, mill code, it's actually used on an XY stage for a tool and cutter.
Very much the same as a router, except uses a grinding wheel, not a cutter.
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: BR549 on September 28, 2010, 12:07:53 AM
YOU have alot of things going on at once(;-). YOu may want to move the G41 inside of the SUB. AS is you have the G41 in effect in G90 mode then switch to G91 mode probably confused MACH.

Notice that the the Next G1 move after your G41 is the same line you have taper. Mach needs to have a move to comp the toolpath BEFORE it gets to the start point of the offset and it needs to be at least the same length as the radius you are comping(depending on version) SO it looks like MACH is using the move to comp itself ending up as a taper???



Just some thoughts, (;-) TP
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: Tarak on September 30, 2010, 05:43:24 PM
Thanks BR549, but nah still no go.
It's really strange, if I enter G1 Y1 on the line before the G1 Y12. it adds the compensation into that small movement, so I thought I'll just get it to do that on a line earlier in the program.
But if I put it anywhere else it starts doing weird stuff, big circles and so on.
I can only get it to sorta work if I put a Y movement on the line before G1 Y12.
I does the comp correctly, except it comes in then moves out the comp amount, so therefore it would dive into the job, then pull away.
Hmmmmmmmm ???
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: BR549 on September 30, 2010, 09:14:30 PM
YOU can't just add the comp anywhere it has to have a leadin to setup the comp for the cut and usally a leadout to end the comp.  Might want to readup on using comp. It is a simple process BUT can get very complex to program by hand.

(;-) TP
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: BR549 on September 30, 2010, 10:04:31 PM
OK I am deciphering your Parametric code I see the shape you are Grinding. WHat exactly is the code suppose to do after the first pass through the code?

(;-) TP
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: Tarak on September 30, 2010, 10:55:04 PM
Take a small cut (Value #3) then repeat the cycle until the number of cuts has been completed.
Darc
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: BR549 on October 01, 2010, 12:02:42 AM
Take a small cut where? further into the profile?

(;-)
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: BR549 on October 01, 2010, 12:23:34 AM
I see the #6 variable calculates a Value BUT I don't see where it is applied??

(;-) TP
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: Graham Waterworth on October 01, 2010, 07:28:22 AM
I suspect having the G41 applied before the sub call and the rapid moves is causing the problem.  Try applying the G41 within the sub and cancelling it before it exits the sub.

Graham
 
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: BR549 on October 01, 2010, 10:17:57 AM
I also see some problems with the incremental code. It does not add up correctly to do loops and some of the formulas do not make sense. To actually cut that profile you have to go about it in a different approach. And yes you have to do the comp as G1 as you lead into the profile and remove it as a G1 as you pull out of the profile.


But that is just my opinion, Your milage may vary. (;-) TP
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: Tarak on October 07, 2010, 01:44:26 AM
Hi Guys, sorry been away for a while.
Thanks for all the suggestions, but buggered if I can get it to work.
BR549, the values don't add up correctly due to the cut size being applied after each repetition.
Thanks anyway guys.
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: BR549 on October 08, 2010, 02:37:25 PM
Darc I had some time today so I took your code apart and reaaranged it both in Abs mode and Inc mode.

Abs runs just fine BUT there appears to be a BIG ole bug in the G41  INCremental side dealing with arcs. After the first pass around it will DOUBLE the arc radius for the arc so it HAS to make a big circle to get all the arc in the same space(;-)

I tried in R mode and IJ mode same thing.

So you are not crazy.  AND your code, once I took full time to draw it out and review it WAS spot on. NICE JOB on parametric Incremental code.  I DID have to move the leadin and leadouts to make it work correct AND I had it all working EXCEPT for the one arc and mach took a holiday on that move(;-)

(;-) TP
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: BR549 on October 08, 2010, 08:09:42 PM
Darc it seems to be a G41 bug. IF you program the part in the opposite direction of rotation  AND use a G42 in place of the g41 it seems to work ok.

(;-) TP
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: Tarak on October 10, 2010, 04:16:18 PM
Hi BR549, thanks for taking a closer look, also thanks for confirming I'm not a spazz (well a total spazz anyway).
I'll try it running the other way and with G42 instead.
Thanks!
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: BR549 on October 10, 2010, 08:06:36 PM
Funny , the first loop through every thing works as expected. Then in the middle of the second loop it all goes to heck.

Still playing with it, (;-) TP
Title: Re: G41, Strange movement, I can't figure out what dumb mistake I'm making!
Post by: BR549 on October 11, 2010, 03:44:00 PM
Darc I was wrong it will do the same with G42. I have banged on it for several days now AND see the problem but I can't find any way around it as is.

The problem as I see it is that MACH is NOT carrying over the math beyond the first loop in a sub, It seems to start all over again each loop. If you run it slow and single step it you can see the problem. BUT I cannot figure a way around the problem and I have tried it 39 ways to sunday so far.

Even tried each loop being a separate function of G41/G40 same problem.

Also tried it AS a continuous SPIRAL for each loop , Same thing

The parameteric side is NOT a problem tried it with and without same thing

I can Write code that will do the job but NOT inc parametric with SUBS and G41/42.

I don't KNOW if the NEW Comp code will solve the problem. If I can find the test version I will give it a whirl to see.

(;-) TP