View Full Version : G-Code table surfacing program?


Imagineering
07-26-2005, 07:27 AM
My Sacrificial Table needs surfacing to get it perfectly flat.

Is there any way of writing a Program in G-Code to do the number of passes without
hand coding every pass?
I had in mind an automatic routine that will make a full pass in the
Y-Axis direction, stepping the X-Axis one tool width and then returning to Y00,
stepping one tool width; ad infinitum, etc etc, untill done.
or, a rectangular spiraling pattern that increments/decrements by one tool width each pass.

Is this possible or is hand coding the only way to do it?

ger21
07-26-2005, 07:48 AM
Should only take a few minutes using ACE converter and any CAD program.

Imagineering
07-26-2005, 07:56 AM
Should only take a few minutes using ACE converter and any CAD program.

I'm now using TurboCAD - Ace - TurboCNC, and I'm sure that I can draw the path needed but I thought that there might be a way to actually 'program' with G-Code like you can with BASIC. ie;

05 'something' = 1
10 Do 'something'
15 'something' = 'something' + 1
20 GOTO 10

That sort of thing.

ger21
07-26-2005, 08:33 AM
You can, but for me it would be faster to do it in CAD. :) Read the TurboCNC docs, it should be in there.

Karl_T
07-26-2005, 09:02 AM
This is called parametric programing. I prefer it to CAM written programs for repetitive tasks like this. The program syntax is slightly different for every control, unfortunately. Here a program to cut the teeth in a lathe softjaw. It has two loops like you need:


;TEETH,ADJUST TRUE SOFT JAWS
;set second jaw back 0.100", third back 0.200"

(*BLEC'*',CMST';',CNDL3,CNDR4,ZRSP0,PDOF0.05,FDOV0*)

%LAPPER = 0
%ZDEPTH = 0.5000

%START:
%COUNTER = 0
%ZDEPTH = %ZDEPTH + 0.025 *;DEPTH OF CUT FOR EACH PASS
%LAPPER = %LAPPER + 1

G92 X 0.00 Y 0.00 Z %ZDEPTH
G90
G00 X 0.000 Y -0.250 Z 0.00


%LOOP:
%COUNTER = %COUNTER + 1

G42 T 02
G01 X 0.008 Y 0.000 F 3.0
G01 X 0.122 Y 0.000
G03 X 0.096 Y 0.750 I -1.304 J 0.330
G01 X 0.000 Y 0.750
G02 X 0.008 Y 0.000 I -3.986 J -0.420
G01 X 0.008 Y -0.125
G01 G 40 X 0.2857 Y -0.25
G92 X 0.000 Y -0.25 Z 0.00

IF (%COUNTER LE 9) GOTO %LOOP

G54
G00 X 0.00 Y 0.00 Z 0.00

IF (%LAPPER LE 5) GOTO %START *;DO ALL TEETH 5 TIMES

Geof
07-26-2005, 12:39 PM
This is the style of program I use for facing various size one offs on a vertical cnc. I have omitted all the stuff about tool selection, rpm, etc., this is just the tool path for a 3/4" dia. tool facing 18 inches by 14 inches.

N100 G54 X0. Y0.
N101 Z0.
N102 G91 G01 Y-0.74 F100. M97 P1000 L10
N103 G28 M30
N1000 G90 X-19.5
N1001 G91 Y-0.74
N1002 G90 X0. M99

Comments:

Line N100; Put the work zero slightly more than one tool diameter positive from the corner of the workpiece nearest machine zero.
N101 Set tool offset at the finished surface.
N102 This increments the Y slightly less than one tool diameter and calls the subroutine starting at N1000 ten times.
N1000 The uses absolute positioning to face across the X distance.
N1001 This increments the Y again.
N1002 This returns in absolute back to X 0. and returns from the subroutine.

The Y travel for each call of the subroutine is 1.48" and the total Y travel is 14.8". For different size cutters and different size parts it is only necessary to change the Y increment, the X travel and the L count.

Imagineering
07-26-2005, 09:03 PM
Thanks Gerry, Karl T and Geof,
My spindle at the moment is a Dremel which will only take a 1/8 shaft as a tool. This limits me to a 3mm dia end mill. Geof, I'll have a crack at your program and substitute your tool dia to utilise my 3mm tool. It'll take a few loops of the subroutine, but I think that this is a better way than drawing it up in CAD.

Thanks guys.

Imagineering
07-26-2005, 10:11 PM
Geof,
I thought that I could manage this program OK, but it seems not. :devious:

I've rewritten it to achieve my aims of surfacing X=500 Y=380 with a 3mm dia Tool but when 'Dry Verifying' under TurboCNC it gives me an error message of "A target line (0 Word) is required". This appears to be in line N102 and I cannot figure it out. Where have I gone wrong??

Attached File.

ger21
07-26-2005, 10:21 PM
Change P1000 to O1000. It's in the manual under M97.

ger21
07-26-2005, 10:24 PM
Not sure if TurboCNC supports the L126 in the M97, btw. It doesn't list it in the manual, anyway.

Also, you can change TurboCNC to possibly use the P instead of O by going to configure>dialect

Geof
07-26-2005, 11:03 PM
Geof,
I thought that I could manage this program OK, but it seems not. :devious:

I've rewritten it to achieve my aims of surfacing X=500 Y=380 with a 3mm dia Tool but when 'Dry Verifying' under TurboCNC it gives me an error message of "A target line (0 Word) is required". This appears to be in line N102 and I cannot figure it out. Where have I gone wrong??

Attached File.

You haven't really gone wrong; just your machine talks wood dialect I talk metal. As Gerry said O not P.