top of page

A letter engraving custom macro

by Bruce Litton


Here is a letter engraving program that will engrave the letters A-Z (any size) for any Fanuc or Fanuc compatible control having custom macro B. The control system we currently have is the Yasnac MX3, (programs should work on Fanuc 10m,11m,16m,18m controls). Without the control option for scaling the task of making letters of different size was challenge!


Instructions for use:.

O7000 is an example program that engraves the word "HELLO". We'll use it to explain the use of variables:

  • %

  • O7000(MASTER ENGRAVING PROGRAM)

  • G90G54J1

  • N10M3S8000

  • G90G0X-.2Y0. M8

  • G43H20Z3.

  • #503=1.000

  • #500=[#503/1.782]

  • #501=.100

  • #502=1.000

  • G65P7001A8.0B-0.02C15.0D40.0E1.0 (H)

  • G65P7001A5.0B-.02C15.0D40.0E1.0 (E)

  • G65P7001A12.0B-.02C15.0D40.0E1.0 (L)

  • G65P7001A12.0B-.02C15.0D40.E01.0 (L)

  • G65P7001A15.0B-.02C15.0D40.0E0.0 (O)

  • N20M98P8998 M30

  • %

NOTE: You can keep from having to retype all of the commands in these programs by using your Internet browser's copy function. Simply highlight the program, copy it, and then open your word processor or CNC text editor. Use the paste function to bring the program into your text editor. While there will be some editing to do (you'll likely have to eliminate some funny characters and add carriage returns), this will save a lot of typing!


Understanding program O7000

Program O7000 contains instructions and calculations for the CNC control. Variables used in G65 commands:

  • A=Code number for letter (0=SPACE, 1.-A, 2.-B, 3.-C, etc., see full list below)

  • B=Z depth from program zero

  • C=Plunging feedrate for the Z axis

  • D=XY feedrate

  • E=Step over for next letter? (1.=YES,0.=NO)

  • #503 before the G65 commands is the letter height (1.0 inch in the example)

  • #500, #501, #502 set the width and aspect ratio for the letters. You can leave them as shown in the example.

The command "G65P7001A8.0B-0.02C15.0D40.0E1.0" will machine the letter H (see code list for A word below). It will be machined 0.02 deep in Z, plunged at 15.0 ipm and machined (XY) at 40.0 ipm. The E1.0 specifies that the machine must move over by the letter spacing to get ready for machining the next letter. If E is set to zero (as it should be after your last letter), there will be no move over after the letter is machined.


Code numbers are as follows:

SPACE-0. A-1. B-2. C-3. D-4. E-5. F-6. G-7. H-8. I-9. J-10. K-11. L-12. M-13. N-14. O-15. P-16. Q-17. R-18. S-19. T-20. U-21. V-22. W-23. X-24. Y-25. Z-26. (Note that you must include a decimal point after each code number in the A word.)


The lettering program

Program O7001 contains all the lettering movements.

  • %

  • O7001(LETTER PROGRAMS)

  • IF[#1EQ0.]GOTO100

  • IF[#1EQ1.]GOTO1

  • IF[#1EQ2.]GOTO2

  • IF[#1EQ3.]GOTO3

  • IF[#1EQ4.]GOTO4

  • IF[#1EQ5.]GOTO5

  • IF[#1EQ6.]GOTO6

  • IF[#1EQ7.]GOTO7

  • IF[#1EQ8.]GOTO8

  • IF[#1EQ9.]GOTO9

  • IF[#1EQ10.]GOTO10

  • IF[#1EQ11.]GOTO11

  • IF[#1EQ12.]GOTO12

  • IF[#1EQ13.]GOTO13

  • IF[#1EQ14.]GOTO14

  • IF[#1EQ15.]GOTO15

  • IF[#1EQ16.]GOTO16

  • IF[#1EQ17.]GOTO17

  • IF[#1EQ18.]GOTO18

  • IF[#1EQ19.]GOTO19

  • IF[#1EQ20.]GOTO20

  • IF[#1EQ21.]GOTO21

  • IF[#1EQ22.]GOTO22

  • IF[#1EQ23.]GOTO23

  • IF[#1EQ24.]GOTO24

  • IF[#1EQ25.]GOTO25

  • IF[#1EQ26.]GOTO26

  • (A LETTER PROGRAM)

  • N1G91G0X[#500*.2203]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X[#500*.7796]Y[#500*1.782]F#7

  • X[#500*.7796]Y-[#500*1.782]

  • G90G0Z#502

  • G91G0X-[#500*.4018]Y[#500*.9186]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*.7554]F#7

  • G90G0Z#502

  • G91G0X-[#500*.6222]Y-[#500*1.0366]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (B LETTER PROGRAM)

  • N2G91G0X[#500*.1923]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y[#500*1.782]F#7

  • X[#500*1.041]

  • G2R[#500*.4179]J-[#500*.4179]Y-[#500*.8358]

  • G1X-[#500*1.041]

  • G90G0Z#502

  • G91G0Y-[#500*.9462]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X[#500*1.1422]F#7

  • G3R[#500*.4731]J[#500*.4731]Y[#500*.9462]

  • G90G0Z#502

  • G91G0X-[#500*1.3345]Y-[#500*1.0642]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (C LETTER PROGRAM)

  • N3G91G0X[#500*1.3288]Y[#500*.1719]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91 G02X-[#500*1.2198] Y[#500 * .828] R[#500*.891]

  • G2R[#500*.891]I[#500*.891]X[#500*1.2198]Y[#500*.828]

  • G90G0Z#502

  • G91G0X-[#500*1.3288]Y-[#500*1.828]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (D LETTER PROGRAM)

  • N4G91G0X[#500*.1129]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y[#500*1.782]F#7

  • X[#500*.633]

  • G2R[#500*.891]J-[#500*.891]Y-[#500*1.782]

  • G1X-[#500*.633]

  • G90G0Z#502

  • G91G0X-[#500*.1129]Y-[#500*.118]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (E LETTER PROGRAM)

  • N5G91G0X[#500*1.5895]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*1.1791]F#7

  • Y[#500*1.782]

  • X[#500*1.1791]

  • G90G0Z#502

  • G91G0X-[#500*.4535]Y-[#500*.8319]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*.7256]F#7

  • G90G0Z#502

  • G91G0X-[#500*.4104]Y-[#500*1.068]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (F LETTER PROGRAM)

  • N6G91G0X[#500*.2474]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y[#500*1.782]F#7

  • X[#500*1.5051]

  • G90G0Z#502

  • G91G0X-[#500*.7306]Y-[#500*.891]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*.7744]F#7

  • G90G0Z#502

  • G91G0X-[#500*.2474]Y-[#500*1.009]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (G LETTER PROGRAM)

  • N7G91G0X[#500*1.4273]Y[#500*1.009]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X[#500*.4636]F#7

  • G2R[#500*.891]X-[#500*1.782]I-[#500*.891]

  • G2R[#500*.891]I[#500*.891]X[#500*1.2891]Y[#500*.797]

  • G90G0Z#502

  • G91G0X-[#500*1.3981]Y-[#500*1.806]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (H LETTER PROGRAM)

  • N8G91G0X[#500*.2587]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y[#500*1.782]F#7

  • G90G0Z#502

  • G91G0X[#500*1.4825]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y-[#500*1.782]F#7

  • G90G0Z#502

  • G91G0Y[#500*.891]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*1.4825]F#7

  • G90G0Z#502

  • G91G0X-[#500*.2587]Y-[#500*1.009]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (I LETTER PROGRAM)

  • N9G91G0X[#500*.4908]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X[#500*1.0182]F#7

  • G90G0Z#502

  • G91G0X-[#500*.5091]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y[#500*1.782]F#7

  • G90G0Z#502

  • G91G0X-[#500*.5091]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X[#500*1.0182]F#7

  • G90G0Z#502

  • G91G0X-[#500*1.5091]Y-[#500*1.8999]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (J LETTER PROGRAM)

  • N10G91G0X[#500*.9405]Y[#500*1.9]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X[#500*.7128]F#7

  • G90G0Z#502

  • G91G0X-[#500*.3564]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y-[#500*1.3067]F#7

  • G2R[#500*.4752]I-[#500*.4752]X-[#500*.9504]

  • G90G0Z#502

  • G91G0X-[#500*.3465]Y-[#500*.5932]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (K LETTER PROGRAM)

  • N11G91G0X[#500*.4174]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y[#500*1.782]F#7

  • G90G0Z#502

  • G91G0Y-[#500*.891]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X[#500*1.0145]Y[#500*.891]F#7

  • G90G0Z#502

  • G91G0X-[#500*.7972]Y-[#500*.7001]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X[#500*.9478]Y-[#500*1.0818]F#7

  • G90G0Z#502

  • G91G0X-[#500*1.5825]Y-[#500*.118]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (L LETTER PROGRAM)

  • N12G91G0X[#500*1.4625]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*.9251]F#7

  • Y[#500*1.782]

  • G90G0Z#502

  • G91G0X-[#500*.5374]Y-[#500*1.9]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (M LETTER PROGRAM)

  • N13G91G0X[#500*.3317]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y[#500*1.782]F#7

  • X[#500*.6682]Y-[#500*1.782]

  • X[#500*.6682]Y[#500*1.782]

  • Y-[#500*1.782]

  • G90G0Z#502

  • G91G0X-[#500*1.6682]Y-[#500*.118]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (N LETTER PROGRAM)

  • N14G91G0X[#500*.2705]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y[#500*1.782]F#7

  • X[#500*1.4589]Y-[#500*1.782]

  • Y[#500*1.782]

  • G90G0Z#502

  • G91G0X-[#500*1.7294]Y-[#500*1.9]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (O LETTER PROGRAM)

  • N15G91G0X[#500*1.6364]Y[#500*.7544]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y[#500*.5091]F#7

  • G3R[#500*.6364]I-[#500*.6364]X-[#500*1.2728]

  • G1Y-[#500*.5091]

  • G3R[#500*.6364]I[#500*.6364]X[#500*1.2728]

  • G90G0Z#502

  • G91G0X-[#500*1.6364]Y-[#500*.7544]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (P LETTER PROGRAM)

  • N16G91G0X[#500*.4918]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y[#500*1.782]F#7

  • X[#500*.5722]

  • G2R[#500*.4440]J-[#500*.4440]Y-[#500*.8880]

  • G1X-[#500*.5722]

  • G90G0Z#502

  • G91G0X-[#500*.4918]Y-[#500*1.0119]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (Q LETTER PROGRAM)

  • N17G91G0X[#500*1.714]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*.4700]Y[#500*.4700]F#7

  • G90G0Z#502

  • G91G0X[#500*.3923]Y[#500*.1664]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y[#500*.5091]F#7

  • G3R[#500*.6364]I-[#500*.6364]X-[#500*1.2728]

  • G1Y-[#500*.5091]

  • G3R[#500*.6364]I[#500*.6364]X[#500*1.2728]

  • G90G0Z#502

  • G91G0X-[#500*1.6364]Y-[#500*.7544]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • ( R LETTER PROGRAM)

  • N18G91G0X[#500*.4129]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y[#500*1.782]F#7

  • X[#500*.7934]

  • G2R[#500*.3807]J-[#500*.3807]Y-[#500*.7614]

  • G1X-[#500*.7934]

  • G90G0Z#502

  • G91G0X[#500*.6739]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X[#500*.5001]Y-[#500*1.0205]F#7

  • G90G0Z#502

  • G91G0X-[#500*1.5870]Y-[#500*.118]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (S LETTER PROGRAM)

  • N19G91G0X[#500*1.6543]Y[#500*1.6772]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91

  • G3R[#500*.891]I-[#500*.5929]J-[#500*.6650]X-[#500*.6682]Y[#500*.2227]F#7

  • G3R[#500*.4455]J-[#500*.4455]Y-[#500*.891]

  • G1X[#500*.2572]

  • G2R[#500*.4469]I-[#500*.0359]J-[#500*.4455]X[#500*.4109]Y-[#500*.4455]

  • G2R[#500*.4469]I-[#500*.4469]X-[#500*.4109]Y-[#500*.4455] G1X-[#500*.3100]

  • G2R[#500*.891]I[#500*.0263]J[#500*.8906]X-[#500*.5877]Y[#500*.2450]

  • G90G0Z#502

  • G91G0X-[#500*.3456]Y-[#500*.3630]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (T LETTER PROGRAM)

  • N20G91G0X[#500*1.]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y[#500*1.782]F#7

  • G90G0Z#502

  • G91G0X-[#500*.891]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X[#500*1.782]F#7

  • G90G0Z#502

  • G91G0X-[#500*1.891]Y-[#500*1.9]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (U LETTER PROGRAM)

  • N21G91G0X[#500*1.7637]Y[#500*1.9]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1Y-[#500*1.0182]F#7

  • G2R[#500*.7637]I-[#500*.7637]X-[#500*1.5274]

  • G1Y[#500*1.0182]

  • G90G0Z#502

  • G91G0X-[#500*.2362]Y-[#500*1.9]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (V LETTER PROGRAM)

  • N22G91G0X[#500*1.6682]Y[#500*1.9]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*.6682]Y-[#500*1.782]F#7

  • X-[#500*.6682]Y[#500*1.782]

  • G90G0Z#502

  • G91G0X-[#500*.3317]Y-[#500*1.9]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (W LETTER PROGRAM)

  • N23G91G0X[#500*1.8591]Y[#500*1.9]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*.3500]Y-[#500*1.782]F#7

  • X-[#500*.5091]Y[#500*1.782]

  • X-[#500*.5091]Y-[#500*1.782]

  • X-[#500*.3500]Y[#500*1.782]

  • G90G0Z#502

  • G91G0X-[#500*.1408]Y-[#500*1.9]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (X LETTER PROGRAM)

  • N24G91G0X[#500*1.8909]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*1.782]Y[#500*1.782]F#7

  • G90G0Z#502

  • G91G0X[#500*1.782]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*1.782]Y-[#500*1.782]F#7

  • G90G0Z#502

  • G91G0X-[#500*.109]Y-[#500*.118]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (Y LETTER PROGRAM)

  • N25G91G0X[#500*1.6615]Y[#500*1.9]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*.6615]Y-[#500*.882]F#7

  • Y-[#500*.8909]

  • G90G0Z#502

  • G91G0Y[#500*.8909]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*.6615]Y[#500*.882]F#7

  • G90G0Z#502

  • G91G0X-[#500*.3385]Y-[#500*1.9]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (Z LETTER PROGRAM)

  • N26G91G0X[#500*1.891]Y[#500*.118]

  • G90G0Z#501

  • G90G1Z#2F#3

  • G91G1X-[#500*1.782]F#7

  • X[#500*1.782]Y[#500*1.782]

  • X-[#500*1.782]

  • G90G0Z#502

  • G91G0X-[#500*.109]Y-[#500*1.9]

  • IF[#8EQ1.]GOTO100

  • IF[#8EQ0.]GOTO200

  • (STEP OVER PROGRAM)

  • N100G90G0Z#502

  • G91G0X[#500*2.0000]

  • N200M99

  • %


16,541 views0 comments

Recent Posts

See All

Tapping on a turning center (without canned cycles)

Unless your Fanuc controlled turning center came with live tooling, it’s likely that you don’t have canned cycles (G80-G89) like those you find on machining centers. You might have G74 and G75, the mu

Can you speed up your tool change time?

Machining centers, of course, have automatic tool changing devices to automate the tool changing process. Current models boast very fast tool changing times and you may be quite satisfied with tool ch

bottom of page