Disclaimer: CNC Concepts, Inc. accepts no responsibility for the use
or misuse of techniques shown in this web page. We simply publish information
we feel will be of interest to CNC users. In all cases, the reader is totally
responsible for considering the implications, good and bad, of implementing one
or more of the techniques we show.
A serial number engraving custom macro
Custom macro submitted by Steve Wood, Laconia, N.H.
This custom macro engraves three-digit serial
numbers which increment by one. The character set is 1/4 high numerals from
zero through nine. To get started store the left most number in variable #524.
the second number in variable #525 and the right most number in variable #526
to start. To start with serial number 147, for example, set #524 to 1, #525 to
4, and #525 to 7. The engraving tool must first be positioned 0.1 inch over the
center of the each numeral. The pitch is .200".
Editor's note: Thanks to Steve Wood for this excellent
application. I've been asked about this kind of macro several times. A few
notes: First, this macro is to be include in your main (cutting) program. You
could easily separate it, making it a macro program by itself by passing a few
variables - like X, Y, and Z position for the numerals, and maybe the depth of
the engraving tool. Second, Steve points out that you could easily make another
character set by rewriting programs O4000 through O4009. And third, this macro
does a three-digit serial number, if you have a larger number, and if you
understand the unique logic of Steve's macro, you can easily make a four or
five digit serial number.
G0G90G54X.5Y.75S6500M3 (<----POSITION HERE FOR 1ST NUMBER
(FIND FIRST DIGIT)
IF[#524EQ0]GOTO 10
IF[#524EQ1.]GOTO 11
IF[#524EQ2.]GOTO 12
IF[#524EQ3.]GOTO 13
IF[#524EQ4.]GOTO 14
IF[#524EQ5.]GOTO 15
IF[#524EQ6.]GOTO 16
IF[#524EQ7.]GOTO 17
IF[#524EQ8.]GOTO 18
IF[#524EQ9.]GOTO 19
#3000=99(SETTING ERROR)
M00
N10M98P4000
GOTO 925
N11M98P4001
GOTO 925
N12M98P4002
GOTO 925
N13M98P4003
GOTO 925
N14M98P4004
GOTO 925
N15M98P4005
GOTO 925
N16M98P4006
GOTO 925
N17M98P4007
GOTO 925
N18M98P4008
GOTO 925
N19M98P4009
GOTO 925
(FIND 2ND DIGIT)
N925 G0G90G54X.7 Y.75 (<----POSITION HERE FOR 2ND NUMBER)
IF[#525EQ0]GOTO 20
IF[#525EQ1.]GOTO 21
IF[#525EQ2.]GOTO 22
IF[#525EQ3.]GOTO 23
IF[#525EQ4.]GOTO 24
IF[#525EQ5.]GOTO 25
IF[#525EQ6.]GOTO 26
IF[#525EQ7.]GOTO 27
IF[#525EQ8.]GOTO 28
IF[#525EQ9.]GOTO 29
#3000=99(SETTING ERROR)
M00
N20M98P4000
GOTO 950
N21M98P4001
GOTO 950
N22M98P4002
GOTO 950
N23M98P4003
GOTO 950
N24M98P4004
GOTO 950
N25M98P4005
GOTO 950
N26M98P4006
GOTO 950
N27M98P4007
GOTO 950
N28M98P4008
GOTO 950
N29M98P4009
GOTO 950
(FIND 3RD DIGIT)
N950 G0G90G54X.9 Y.75 (<----POSITION HERE FOR 3RD NUMBER)