589,422 active members*
5,561 visitors online*

1. Registered
Join Date
Jan 2008
Posts
65

## number engraving macro

Here is a part number engraving macro, Fanuc Macro B. It does up to a six digit number. I have used it at work a lot so it has been tested extensively on a Mori-Seiki SV-50. I edited the tool change to make it more generic, the Mori has tool look-ahead.

I have added scaling and the ability to do decimals in a different macro, but not tested the thing a lot. I separated the decimal out at first, then looped back and multiplied it by 100,000, wrote a decimal point and started over.

I then ran into problems with floating point math to where even this logic did not work. I got it to work by playing with the amount of decimal places checked to, but it was trial and error and I had no way to quantify it. Thus my pre-occupation with floating point math.

I'm now having a "duh" moment and realizing that if I just round the darn thing before feeding it back through the loop it may work fine. Someday I'll do that.

Anywayz, this one works quite well, here...

Usage

G65 P20 A H X Y Z

A - Number To Be Engraved (Required, Up To 6 Digits)
H - Offset Used (Required)
X - Amount To Offset Number In X (If Not Used It Will Engrave At X Zero)
Y - Amount To Offset Number In Y (If Not Used It Will Engrave At Y Zero)
Z - Amount To Offset Number In Z (If Not Used It Will Engrave At Z Zero)

The Macro Uses G59. It Takes The Numbers In The X, Y, And Z Variables,
Adds Them To The Offset Specified And Puts That In G59.

It Uses G52, If It Is Stopped In The Middle Go To MDI And Enter "G52 X0".

************************************************** ***

If anyone wants this commented better or whatever, let me know.

2. Registered
Join Date
Jan 2008
Posts
65

## ok

I've added the scaling and decimals to this.

I've used it for a while but not done any official documentation yet. I'll start that here...

There is a variable at the beginning of the macro itself (#110) to scale the numbers. A one in this variable will give numbers about .312" tall, A two,
.625" tall, etc..

I use a carbide 90 degree deburr/chamfer tool to engrave the numbers, goes .01" deep.

Macro uses the G59 offsets and changes them in order to offset the number's zero point from the chosen offset's zero point. This was so you could call the macro from a part program and engrave a part number anywhere on the part.

Macro will engrave up to a six digit number, followed by up to a six digit decimal. (Most controls won't accept a number with 12 digits.)

Macro uses G52 to shift X. If you cancel the macro while running go to MDI and enter "G52 X0".

USAGE

G65 P20 A H X Y Z

A - Number To Engrave (Required)
H - Offset To Use (Required)
X - Amount To Offset X
Y - Amount To Offset Y
Z - Amount To Offset Z

If X, Y, or Z is not used the number will engrave at the chosen offset's zero.

EXAMPLE

G65 P20 A45.876 H55. X1. Y2. Z3.

Will engrave 45.876 at G55 X - 1." Y - 2." Z - 3.".

Any question or comments appreciated. I was thinking of limiting it to 3 place decimals and calling the scale factor from the macro call. Another easy addition would be to throw in a multiplier and make the scaling more 1 to 1".

3. Registered
Join Date
Jul 2008
Posts
4

## making this macro into a serial number macro

hello,

I wrote this as a main program to call your macro:

%
O1234( SERIAL NUMBER )
#500=#500+1
G65P20A#500H58X-Y-Z-
M30
%

I just set start location in G58 and we have a serial numbering macro

4. Member
Join Date
Feb 2022
Posts
2

## Re: number engraving macro

What is the text size as I want .125 height for macro adjustment?