Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: rcaffin on December 02, 2017, 01:20:26 AM

Title: G16 and G83 interaction (again)
Post by: rcaffin on December 02, 2017, 01:20:26 AM
Hi all.

The Mach3Mill manuals states (10-19) that you can put Mach3 into polar mode, but that this only works for G0 and G1 instructions (Note 1, 10-20). I have no problems so far.

But the same part of the manual goes on to provide an example which drills holes on a circle using a G83 instruction, ignoring the restriction in Note 1. At least on my system, programming a ring of holes this way produces a screenful of rubbish. Trying to run the code does likewise. Changing the G83 instruction (or G81) to a simple G1 results in the program working perfectly.

My interpretation is that the command sets a flag saying 'polar', but that only G0 and G1 check this flag. Executing G0 x10 y20 works fine, and saves 10 and 20 in the 'current X&Y registers'. But note that these are POLAR values. If you then issue a G83 z-5 instruction, the interpreter first sends the spindle to X=10 Y=20 and then does the peck drill. But these are CARTESIAN coordinates!

This is as expected if you believe the restriction in Note 1 that polar coords only work for G0 and G1 instructions. It is a pity that the example in the manual violates that restriction.

Or do others get different results?

Cheers
Roger
PS: Brian Barker's hole drilling wizard uses the G83 instruction - but does NOT use polar coords. Of course it works fine.

Title: Re: G16 and G83 interaction (again)
Post by: RICH on December 04, 2017, 07:49:48 AM
rcaffin,

Are the pages you refer to correct?

RICH
Title: Re: G16 and G83 interaction (again)
Post by: RICH on December 04, 2017, 08:03:46 AM
I have not used the g15 g16 commands, BUT, not sure your interpretation is correct.
One needs to be carefull how they are using the G0 and G1 when in G16.  
Guess I need to play some with the code and see how it works and compare to what the manual says...............whenever that may be ......

RICH
Title: Re: G16 and G83 interaction (again)
Post by: rcaffin on December 04, 2017, 03:31:13 PM
Hi Rich

From my experiments, I would say that the restrictions on 10-20, that you can only use G0 and G1 within a G16/G15 scope, ARE correct.
But the example included in the manual which uses the G83 instruction withing a G16/G15 scope is NOT correct. (I tried it out.)

My suspicion is that EITHER the example was written down but never checked, OR that the example may have worked a few years/versions ago, OR that the NIST Standard meant it to work but it was never implemented correctly. Dunno which one. I note that the same text and example are found in the Mach2Mill manual.

On the other hand, the G16 instruction is not listed in the HAAS manual for the VF/-HS series. HAAS do list a couple of bolt holes in a circle codes.

Cheers
Roger

Title: Re: G16 and G83 interaction (again)
Post by: BR549 on December 07, 2017, 05:46:38 PM
There a several ways it can be done here is one.


F20 F90
G0 X0 Y0 Z0

G16

G83 X3 Y0 Z-1 F10

G83 X3 Y45 Z-1 F10

G83 X3  Y90  Z-1 F10

G83 X3 Y135  Z-1 F10

G83 X3 Y180 Z-1 F10

G83 X3  Y225  Z-1 F10

G83 X3 Y270 Z-1 F10

G83 X3 Y315 Z-1 F10

G15
G0 X0 Y0
G90
M30
Title: Re: G16 and G83 interaction (again)
Post by: joeaverage on December 07, 2017, 06:05:47 PM
Hi BR549,
good to hear from you...

Craig
Title: Re: G16 and G83 interaction (again)
Post by: rcaffin on December 07, 2017, 06:39:19 PM
Hi Terry

Bit of a problem with that code.
For a start, it won't load under Mach3 as it has TWO feed instructions on the 1st line: F20 and F90. That is not permitted.

Then there is the strange business of telling Mach3 that the Feed is 20, then that it is 90, then each G83 line has an F10 at the end. Methinks the CAM program used here is a shade wonky, or at least the post is.

Then we come to the real humdinger. One can put the X and Y values in the G83 instruction explicitly on every line, as your example shows, or one can do what the Mach3 manual shows on 10-19, and replace the explicit X&Y values with an intermediate G0 instruction. The following extract shows the Mach3 manual version.
g0 x3 y45
g83 z-1
Yes, this is legal by itself, as long as the g83 instruction is not missing the X, Y and Z values (see 10-26).
Going on from here, if the Z-1 is omitted in all lines except for the first g83 (but X & Y are included), that too works fine. The previous Z value is retained.

BUT BUT BUT
The first two versions (explicit and implicit X & Y values) give wildly different results in polar mode.
With the X & Y values explicit in every g83 instruction, it works. See Test1RNC.jpg
But without the explicit X & Y in every g83, relying on the previous g0 to set them up, then you get a total disaster. See Test2RNC.jpg for this.

My conclusion is that when the g83 instruction is interpreted, if Mach3 has to go get previous values for X & Y, the program stuffs up. There is a major bug in the code.

OK, in the spirit of free enquiry, what happens if one makes the Y explicit but not the X? Like this
G16
G83 X3 Y0 Z-1
G83 Y45
G83 Y90
G83 Y135
G83 Y180
G83 Y225
G83 Y270
G83 Y315
G15
Oh Dear. More strange things! See Test4RNC.jpg to see.

Well, there's a bug. Know about it and work around it.

Cheers
Roger
Title: Re: G16 and G83 interaction (again)
Post by: BR549 on December 08, 2017, 09:49:15 AM
A lot of things hinge on IF you are in G90 or G91 mode. Yes I fat fingered the F90 instead of a G90 (;-) Once you invoke the G16 then all XY moves are Radius(x) and polar values(y) until the G15 is called to cancel the mode.

(;-) TP
Title: Re: G16 and G83 interaction (again)
Post by: BR549 on December 08, 2017, 10:24:02 AM
Here is another way (normal) to write it in G90 mode.

F20 G90 G20
G0 X0Y0
G16
X3 Y0
G81  Z-1 F10
X3 Y45
X3 Y90
X3 Y135
X3 Y180
X3  Y225
X3 Y270
X3 Y315
G15
G80
M30
Title: Re: G16 and G83 interaction (again)
Post by: BR549 on December 08, 2017, 10:35:10 AM
Here is an example in G91 mode. Do keep in mind that at times Mach3 cannot display the toolpath correctly with some gcode programs. OLD bug.

F20 G90 G20
G0x0y0
G91
G16
X3 Y0
G81 X0 Z-1 F10
 Y45
 Y45
 Y45
 Y45
 Y45
 Y45
 Y45
G15
G90
G80
M30
Title: Re: G16 and G83 interaction (again)
Post by: rcaffin on December 08, 2017, 03:13:03 PM
I don't think it was the display bug as I did try running the test programs. The DROs matched the screen.
Mind you, I agree 100% that the display itself has some problems. Apparently the display driver uses slightly different code from the axis driver and can lose track of some things, especially G52 origin shifts. OK, we know about that one - although novices have to be warned regularly.

Of the two programs above:

The first works fine, but I personally do NOT like the coding style. The 4th line, 'X3 Y0' is seriously obscure: you have to go several lines backwards to see what it refers to. Ditto the 5th line in 2nd example. In my world that is not good code, and today with PCs with Gigabytes of memory there is no need for this sort of thing. We are not running paper tape and 2400 baud serial lines any more. OK, that's my preference; ymmv.

I don't like the incremental style in the 2nd example as it can lead to all sorts of bungles. It takes a bit of thinking to figure out how it works. Now, to be sure, the machine can do that, but if you ever have to modify that sort of  program it will take some time to get it right. I prefer my programming to be as clear as possible - for later maintenance. Again, ymmv.

And my 2nd and 3rd variations still don't work. There is a bug. Oh well.

Cheers


Title: Re: G16 and G83 interaction (again)
Post by: RICH on December 08, 2017, 04:56:20 PM
Different styles of programing, yes there certainly are...........
BUT

G16 (Hi guy you are in polar mode)
X3 Y0  (X=3 radius and Y=degrees and don't care about where I came from as that part is done and over)

Guess we all think differently.............. ;D

RICH
 
Title: Re: G16 and G83 interaction (again)
Post by: rcaffin on December 08, 2017, 05:03:46 PM
Hi Rich

Yes, but are you saying that you can issue a command line 'X3 Y0' just like that, without any g-code, or does it revert to the G0 from several lines back?
I really do not like that sort of obscurity and ambiguity!  Life is difficult enough already ...

Cheers
Roger
Title: Re: G16 and G83 interaction (again)
Post by: RICH on December 08, 2017, 10:18:47 PM
Roger,
I think that the intent of the G16 was to make it easy to drill about a point without figuring out or doing any calculations. As the command definition says, the current coordinates of the controlled point is the pivot point.

So you move to some location, and then using G16 you just tell the controller on what radius and angle you want to drill the holes.

If you have that thought in mind when using it then it is not confusing at all. If the radius stays the same then only need to define the angle if in incremental mode as Terry showed.

The AR is hungry and need to make up some food for it.....later

RICH

Title: Re: G16 and G83 interaction (again)
Post by: rcaffin on December 09, 2017, 01:00:59 AM
Hi Rich

I know that of course. But drillling a ring of holes is not the only use for polar coordinates.
My current application steps through Y over a full rev in 1 or 2 degree increments, and recalculates X (radius) for each angle. Parametric subroutines and all that. As Z also comes into play here, I need very clear code or I get lost in the wilderness...

Cheers
Roger
Title: Re: G16 and G83 interaction (again)
Post by: BR549 on December 09, 2017, 06:45:15 PM
Actually Inc programming is among teh simplest ways one can program. It is teh easiest to follow most modern blueprint values. Rarely do you see drawings in ABS values. Now can it get complicated ?? yes if you want it to be (;-). The best part about it is it is easy to use the same code over and over again. For expmple if you program to machine a hole if you do it in inc you can use that same code anywhere as the code describes teh hole function NOT where you are going to bore it. Works very well in SUBS and parametric programing.

In teh old world we always moved to teh center point location before starting to machine a circle , hole ,bolt circle, anything circular. This allows a quick check to make SURE teh function is located correctly. Teh move to a center point is also always notated in teh Gcode

G0 X0 Y0 ( Center point of Bolt Circle)

But as always to each their own (;-) TP
Title: Re: G16 and G83 interaction (again)
Post by: rcaffin on December 09, 2017, 06:52:23 PM
Hi Terry

To be sure, it makes a nice little sub for drilling a ring of holes - as long as you do NOT use the code example in the Mach3 manual. There is still that bug.

Cheers
Roger
Title: Re: G16 and G83 interaction (again)
Post by: BR549 on December 09, 2017, 08:56:14 PM
That really is not a bug but a code example that was not written correctly.

(;-) TP
Title: Re: G16 and G83 interaction (again)
Post by: rcaffin on December 09, 2017, 09:39:44 PM
Does it work?
No.
That's all that matters.

Cheers
Roger
Title: Re: G16 and G83 interaction (again)
Post by: BR549 on December 09, 2017, 11:37:05 PM
It would work IF it were written correctly (;-)

(;-) TP