Machsupport Forum
G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: reg2117 on February 13, 2008, 12:52:37 PM
-
Comrades,
Can someone please offer advice on using the polar mode commands G15, and G16? The manual (Rev 1.84-A2) states that G16 is used to enter polar mode and G15 is used to return to Cartesian coordinates. This is exactly opposite to the list in the Mach 3 program (the colorful list that gets brought up when the "g-code" button is pressed).
I tested the code in the manual (supplied below), using G16 G15 to start stop polar mode respectively, and G15 G16 to start stop respectively. I have selected the XY plane (G17) and am trying simply to get any polar move but seem to get only cartesian movement. A sample code known to work would be very helpful in working this bug.
Thanks in advance,
Roger
From manual
G21
G0 X10Y5.5
G16
G1 X50 Y0
G83 Z-0.6
G1 Y20
G1 Y30
G1 Y40
> ...etc...
G15
-
Roger,
here is a PCD hole macro using polar code
Graham.
#1=8 (number of holes)
G21 G40 G00 G90
G00 Z10.
M98 P0002 L#1
G15
G90
M30
O0002
G16 X25. (radius)
G91
G81 Y[360/[#1]] Z-10. F100. (drill hole)
G15
G00 Z10.
M99
-
Thank you for the reply. I tested the following program, based on the supplied code. The tool path window only generated linear motion, instead of a circular path with intervals of peck drilling. Is there a setting somewhere in Mach3 that needs to be changed to allow polar motion? Any more advice would be very welcome.
G21 G40 G00 G90
G00 Z10.
M98 P0002 L4
G15
G90
M30
O0002
G16 X25. (radius)
G91
G81 Y90 Z-10. F100. (drill hole)
G15
G00 Z10.
M99
-
OK, try it this way.
Graham.
%
#1=8 (number of holes)
#2=0
G21 G40 G00 G90
G00 Z10.
M98 P0002 L#1
G15
G90
M30
O0002
G16
X25. Y[[360/[#1]]*#2]
G15
G81 Z-10. R1. F100. (drill hole)
G80
#2=[#2+1]
G00 Z10.
M99
%
-
Here is a straight example of the polar moves.
G0 z0.000
X0.000 Y0.000 (sets the pivot point)
G16
G81 x2.5 y0.0 R0.0 Z-.1 F3 ( in g16 mode the x becomes the offset from center and the Y becomes the degrees of rotation from the center of offset)
X2.5 Y90.0
X2.5 Y180.0
X2.5 Y270.0
G15 ( cancells the g16)
G80 ( cancells the canned cycle)
zo
X0y0
M30
THis will give you a four hole pattern based on a 2.5" offset(5"circle) and starting at 3oclock
Just another example. (;-) TP
-
Hi,
I just found the same thing, it seems like Mach3 doesn't like canned cycles when there is no X / Y specifed on the line
i.e.
G16
G1X?Y?
G81Z-1
doesn't work
but
G16
G81X?Y?Z-1
does work
-
Has this inconsistency with the manual and the help file been addressed?
I am trying to drill holes every 15 degrees over 1/2 a circle knowing the radius, and the centre of the circle. Copying the example straight from the manual does not work. Have only found 4 or five posts that contain g15 or g16 and most of the example in those do not work. Mostly just get linear motion with strange points. No circularity at all.
Using demo version of .020 version current lockdown.
Jim H
-
There is a circluar bolt hole wizard that should do what you want.
I know that is not hand programing. Never used it, may be worth looking at the gcode it
generates.
RICH
-
HERE you go an example piece of code ( actually it is the same as 3 post up ^)
G0 z0.000
X0.000 Y0.000 (sets the pivot point)
G16
G81 x2.5 y0.0 R0.0 Z-.1 F3 ( in g16 mode the x becomes the offset from center and the Y becomes the degrees of rotation from the center of offset)
X2.5 Y90.0
X2.5 Y180.0
X2.5 Y270.0
G15 ( cancells the g16)
G80 ( cancells the canned cycle)
zo
X0y0
M30
THis will give you a four hole pattern based on a 2.5" offset(5"circle) and starting at 3oclock
(;-) TP
-
Rich;
Yes I had thought of that as well. However, the bolt hole wizard produces the same linear motion rather than a bolt pattern. I had hoped to use the generated code to reverse engineer what works.
Vmax;
Will test your sample. Have cut and pasted the other samples in this thread and either I am expecting something different or they don't function in demo mode.
From the Mach manual I understand that one should be able to set a center point for rotation. Then with a specified radius, be able to create points at any chosen angle of rotation, about that point. The axis for the rotation of 0 degrees is not defined or identified. So one would have to test to see where the angle of 0 deg rotation is oriented. One would expect that a degree could be + or - from a given axis or a defined starting line.
If this fails I will test the SIN, COS, and TAN functions of Mach to calculate where the points should be. A simple subroutine passed the correct parameters should be able to calculate the endpoints. Might need 4 subroutines for the 4 quadrants but if the math functions work it will be quicker than experimenting with broken code or manuals. Much of the Mach G-Code and M-Code manual is a straight lift from the NIST interpreter manual with the added advantage of numerous typos. I suspect that some of the examples in the manual have never been tested on a production version of Mach.
Thanks
Jim H
vmax.
Just fired up my Mach unit and tested it. It works today. Could it be a machine parameter left over from other tasks? Will now test using assigned parameter values rather than explicit values.
Again Thanks
Jim H
-
To get the arcs to drill properly I used the code from vmax as a start and modified it as below.
Note that I declared all the parameters first. Note the one related to the G16 such as center point etc are all assigned to 4 decimal places.
This drills 4 arcs, two arcs of two rows of holes, 5 holes per arc, 15 deg apart, skipping the 90 deg position.
Some parameter assignments are not used in this code snippet.
It appears that the G81 is not completely modal when in G16 mode. You must define the X and Y on each line. True modality would not require this.
So it appears that nesting a modal command in G16 has a minor shortcoming.
F40 G20 G90 G0
#24=0 ( SETS PARAMETER FOR X AXIS TO ZERO )
#25=0 ( SETS PARAMETER FOR Y AXIS TO ZERO )
#26=0 ( SETS PARAMETER FOR Z AXIS TO ZERO )
#40=0.0000
#41=0.0000
#42=0.0000
#43=0.0000
#60=0.0000
#61=0.0000
#30=0.2686 ( WAS 2812 THEN 2801 NOW 2790 IS GAP BETWEEN TRACK HOLES 2686 IS FINAL VALUE)
#31=0.3740 ( GAP BETWEEN GROUPS OF HOLES WAS 3750 NOW 3740 )
#40=2.2187 ( X VALUE FOR CENTER OF LARGE ARC )
#41=11.2500 ( Y VALUE FOR CENTER OF LARGE ARC )
#42=1.2626 ( SMALL RADIUS FOR LARGE ARC )
#43=1.5312 ( LARGE RADIUS FOR LARGE ARC )
#50=-4.6000 ( Z DRILL DEPTH )
#51=[#50+0.600] (RETRACT OR CLEARANCE FOR DRILLING )
#60=165.0000 ( STARTING ANGLE FOR LARGE ARCS JUST ABOVE 9 OCLOCK POSITION )
#61=210.0000 ( STARTING ANGLE FOR SMALL ARCS JUST BELOW 9 OCLOCK POSITION )
% THE LARGE ARC PATTERN HERE. THIS DRILLS TWO CIRCULAR ROWS OF HOLES ONE INNER, ONE OUTER AT SAME ANGLES
% THE 90 DEG POSITION IS SKIPPED
G0 X#40 Y#41 (sets the pivot point)
G16
G81 x#42 y#60 Z#50 R#51 F16 ( in g16 mode the x becomes the offset from center and the Y becomes the degrees of rotation from the center of
offset)
X#43 Y#60 #60=[#60-15.00] ( WE ARE DECREMENTING THE ANGLE BY 15 DEGREES AFTER EVERY 2 HOLES )
X#42 Y#60
X#43 Y#60 #60=[#60-15.00]
X#42 Y#60
X#43 Y#60 #60=[#60-15.00]
X#42 Y#60
X#43 Y#60 #60=[#60-15.00]
X#42 Y#60
X#43 Y#60 #60=[#60-30.00] ( WE SKIP THE 90 DEGREE POSITION )
X#42 Y#60
X#43 Y#60 #60=[#60-15.00]
X#42 Y#60
X#43 Y#60 #60=[#60-15.00]
X#42 Y#60
X#43 Y#60 #60=[#60-15.00]
X#42 Y#60
X#43 Y#60 #60=[#60-15.00]
X#42 Y#60
X#43 Y#60
G15 ( cancells the g16)
G80
z0
X0y0
M30
-
THat is a lot of code for a few simple holes (;-)
With the G15 the starting point of zero is always 3 o'clock.
Yes "with" the drill cycle x&y are required for each point only because of the nature of the G15 not the g81.
Yes it should run as g90 or G91 BUT the G91 is kinda busted it will do the circle properly but it offsets from pivot point.
HOPE that helps, (;-) TP
Yes the Math works if you want to calculate the points in Gcode
AND the NFW drill circle wizard does work well.
-
Vmax I must thank you for your guidance. It got me over a frustrating delay.
Yup it is a lot of code for a batch of 20 holes. But because it is parametric driven, it can be modded in a few seconds in any simple editor. Could not get the L or Loop to work cleanly, so did it with line pairs of code. In fact this is part of the code that drills a cribbage board. The main program will drill 3 boards in one fixture with 9 or 12 lines of code. Has 4 subroutines of which the above is most of one of them. Another very similar and two for the groups of holes. One heading toward +Y and the other toward -Y. Will be changing that to use only one, with the direction defined in the parameters. All parametrically driven. So can change the length of board, hole spacing, number of tracks etc with only a few changes in the header or parameter file.
I am really quite lazy and only want to write this once. Want it to be as flexible as possible with the fewest lines.
Jim H
-
Don't get me wrong I love parametric code. I have wrote MANY MANY Param Gcode programs but in Fanuc macroB Parametric code in MACH without conditional statements is a PAIN in the rear. There is a way around it thought.
ANother note you know that there IS a VAR monitor in MACH that lets you veiw the values of VARs
Also Brian Has hinted that he CAN create in MACH a Gcode window that can display the values of the vars as it runs parameteric code. Neat HUH?
ANd by the way the G16 in G91 mode IS fixed I tested it last night.
I would also consider Sub programming for that project.
Looks GOOD from here(;-) Keep up the good work
(;-) TP
-
4 pictures say it all. Just the final fixtures to make on this machine. 1 hour 17 minutes 29 seconds 745 holes 1/2 inch deep.
Jim H