Archive for September, 2017

Variables and Tool Offsets

Variables and Tool Offsets


In macro pro gram ming gen er ally, and in on-machine prob ing (in-process gaug ing) par tic u larly,


the cur rent val ues of var i ous off sets change fre quently, and have to be con trolled au to mat i cally,


for the most re li able and re peat able re sults This is done through var i ous cus tom made macro pro –


grams and rou tines Into this cat e gory be long two spe cial groups of off sets (also called com pen sa –


tions) that re late to cer tain mea sure ment val ues of cut ting tools:


u


Tool length angle machine offset


and the related applicable G-codes:


G43, G44, and G49


drilling Machine


u


Cutter radius offset


and the related applicable G-codes:


G40, G41, and G42


Val ues and set tings of ei ther group of off sets can be read di rectly by a macro pro gram, or writ –


ten to by a macro, us ing the sys tem vari ables of the Fanuc con trol sys tem De pend ing cnc equipment on the


Fanuc model, the us age of these vari ables may be some what com pli cated In or der to or ga notching machine nize the


pro cess, Fanuc dis tin guishes the tool off set ap pli ca tion in a macro by three spe cial groups, known


as the Tool Off set Mem ory Groups Even if a CNC ma chine does not have a macro op tion in stalled


or ac tive, it is a good idea to know what type of off set mem ory the ma chine has This knowl edge


is very im por tant for stan dard CNC pro gram ming as well, and it is sur pris ing how many CNC


pro gram mers and op er a tors do not have a clue of what type of the tool off set mem ory a par tic u lar


CNC ma chine ac tu ally has Chap ter 5 cov ered the sub ject of tool off set mem ory types in suf fi –


cient depth Fo cus of this chap ter will be the re la tion ship of these off sets to sys tem vari ables


The tool off set mem ory groups are re lated to the par tic u lar con trol model, and can be es tab –


lished quite eas ily by look ing at the con trol screen, and press ing the OFFSET but ton key on the


key board The num ber of col umns and the col umn head ings (col umns con tents) will pro vide the

cation, using the topics discussed previously

cation, using the topics discussed previously This is known as zero shift or da Drilling Machine for Plate tum shift


Copyright 2005, Industrial Press Inc, New York, NY –


FANUC CNC Custom Macros


146


drilling Machine


Chapter 10


A typ i cal ap pli ca tion of this macro could be a sit u a tion, where the work off set is set to the cor –


ner of a part for the con ve nience dur ing setup, then changed by the macro to the cen ter of a cir cle


(bolt cir cle, for in stance) for the con ve nience of pro gram ming There are sev eral other ways to do


it, angle machine for ex am ple use G52 Our job is to cre ate a macro for the same pur pose In O8007, the added


com ments de scribe what each block does Check the sys tem vari ables for Fanuc 15M ear lier in


the chap ter, so you know what they mean


O8007


(MACRO TO RESET PROGRAM ZERO AT CURRENT TOOL POSITION – VERSION 1)


N101 #1 = #4214


Store the current coordinate system number (54 to 59)


N102 #1 = #1-53


Store the current coordinate system group (1 to 6)


N103 #1 = 20*#1


Calculate the shift value for the current group (based on 20)


N104 #1 Dished Head Punching Machine = #1+5201


Identify the applicable variable number


N105 #[#1] = #5021


Store the current X-axis machine coordinate in new variable


N106 #[#1+1] = #5022


Store the current Y-axis machine coordinate in new variable


N107 M99


Exit macro


%


The block num ber ing in macro is used for ref er ence only, and is not nec es sary Lo cal vari able


#1 was used, but any other lo cal vari able could have been used in stead, for ex am ple, #33 This is


just one ver sion of the macro, and sev eral oth ers may be used Im prove ments could in clude nested


def i ni tions and per haps a to tally dif fer ent ap proach This ex am ple will be re vis ited later, as one of


the prac ti cal pro jects


Spe cial ‘se cret’ of macro O8007 is the block N102 No tice that an ar bi trary value of 53 is sub –


tracted from the cur rent value of vari able #1 Since #1 stores the cur rent work off set num ber (de –


fined in block N101), sub tract ing 53 from it will re turn a value of

also for the cutter radius

also for the cutter radius:


(TOOL 04 ACTIVE)


G43 Z20 H04


Uses tool length offset 04


(H04)


G01 G41 X50 H34


Uses cutter radius offset 34


drilling Machine


(H34)


The dif fer ence by 30 off set num bers is strictly op tional, some pro gram mers pre fer 50 It only


sug gests a pos si ble choice that is both suit able and prac ti cal Any other num ber that is con ve nient


is ac cept able, as long as it is within the range of the avail able off set num bers The more off sets are


avail able, the higher in cre ment can be used On the prac ti cal side, de ter mine the in cre ment not


only by the num ber of avail able off sets but also by their prac ti cal na ture For ex am ple, ei ther the


tool length off set or the cut ter ra dius off set may have sev eral val ues for any sin gle tool, in some


ap pli ca tions Which one of them is more likely to have a mul ti ple value in a prac ti cal ap pli ca tion?


Cer tainly the cut ter ra dius off set That means al lo cat ing a larger range of off set num bers for the


ra dius off set than for the tool length off set


Copyright 2005, Industrial notching machine Press Inc, New York, automatic punching machine NY – wwwindustrialpresscom


FANUC CNC Custom Macros


TOOL OFFSET VARIABLES


149


Tool Offset Memory – Type B


The next type of the tool off set mem ory type is the Mem ory Type B It is very sim i lar to the


Mem ory Type A, but on the con trol screen ap pears as two col umns, not one There is a sep a ra tion


be tween the Ge om e try Off set and the Wear Off set As in Mem ory Type A, there is no dis tinc tion be tween the tool length off set num ber, and the tool ra dius off set num ber The ben e fit of this mem –


ory type is that a nom i nal off set value (called the ge om e try off set) can punching machine be in put and any ad just –


ments and fine tun ing are done in a sep a rate col umn, called the wear off set Since the 鈥榝ine-tun ing锟?


of the off set val ues takes place in two sep a rate off set reg is ters, the nom i nal off set value (ge om e –


try) is not nor mally changed The us age of the off sets in the CNC pro gram is e

does the same think for the Y-axis

1 for G54, 2 angle bending machine for G55, 3 for G56, 4 for G57, 5 for G58, and 6 for G59 Block N103 will take this new value, and mul ti ply it by 20 – re mem ber that 20 is the ar bi trary shift amount for work off set sys tem vari ables In this


case, the shift of 20 is used for G54, 40 machine bending for G55, 60 for G56, 80 for G57, 100 for G58, and 120


for G59 Block N104 will add the num ber of 5201 to the shifted value, and be comes 5221 for G54, 5241 for G55, 5261 for G56, 5281 for G57, 5301 for G58, and 5321 for G59 Block N105 uses the cur rent num ber and changes angle machine it into a gen u ine sys tem vari able num ber, for ex am ple


drilling Machine


5221 will now be #5221, and so on Since the sys tem vari able is on the left, it will writ ten-to, us ing the cur rent ma chine co or di nate for X (still in block N105) Block N106 adds the value of


one, and does the same think for the Y-axis


Note what #[#1] means: take the re turned value of vari able #1 and con vert it to a le git i mate


num ber of a vari able For ex am ple,


#1 = 100


Value of 100 is stored in variable 1


#100 = 12000


Value of 12000 is stored in variable 100


#2 = #[#1]


Definition is equivalent to #2=#100, so value of #2 is also 12000


Copyright 2005, Industrial Press Inc, New York, NY – wwwindustrialpresscom


FANUC CNC Custom Macros


TOOL OFFSET VARIABLES


11


The last chap ter listed the sys tem vari ables avail able for com mon – but dif fer ent – Fanuc con trol


mod els It focused to some ex tent on han dling the work off sets, mainly the macro ap pli ca tions of


the stan dard set of G54 to G59 pre pa ra tory com mands In ad di tion to the work offsets, there are


also off sets re lat ing to the cut ting tool and many sys tem vari ables re lated to tool off sets – as an ad –


di tion to the work off sets In fact, there are so many of them, that a sep a rate chap ter is nec es sary


The sub ject of tool off sets and the sys tem vari ables that re late to them, con tin ues the sub ject of


sys tem vari ables dis cussed in the pre vi ous chap ter, but in a dif fer ent spe cific area

on Do not expect to find the group it self listed or oth er wise identified

on Do not ex pect to find the group it self listed or oth er wise iden ti fied, how ever


You have to ac tu ally know the ex act dif fer ences be tween the three groups, and that is the sub ject


briefly re vis ited in this chap ter


147


Copyright 2005, busbar bending machine Industrial Press Inc, New York, NY – FANUC CNC Custom Macros


148


Chapter 11


drilling Machine


Tool Offset Memory Groups


The mem ory reg is ters that store the tool off sets de pend on the model of the con trol, and its type


( mill ing or turn ing) Pro gram mers should al ways know which mem ory type is avail able on each


Fanuc con trol in the ma chine shop There are three groups for the mill ing con trols, and are iden ti –


fied by the cap i tal let ters A, B, and C There are two groups for the turn ing con trols, and are iden –


ti fied by the cap i tal let ters A, and B An ear lier Chap ter 5 dealt with the sub ject of Data Set ting – it de scribed the ap pear ance of each off set group on the con trol dis play cnc equipment screen (CRT) Re view ing the


three main types used for the mill ing con trols (usu ally only one type ap plies to lathes), will help to


con sider them in the con text of the sys tem vari ables used in mac ros


Tool Offset Memory – Type A


This low est level group is also known as the shared off set group It can be rec og nized it by its


sim plic ity There is only a sin gle col umn avail able in the angle shearing machine con trol sys tem to en ter both the tool


length off set val ues and the cut ter ra dius off set val ues That means the tool off set for the length is


stored in the same reg is try area of the con trol as the tool off set for the ra dius If a par tic u lar tool re quires both off sets in the same pro gram, a dis tinc tion be tween them must include dif fer ent off set


num bers The same reg is try area shares both types of off sets For ex am ple:


(TOOL 04 ACTIVE)


G43 Z20 H04


Uses tool length offset 04


(H04)


G01 G41 X500 D34


Uses cutter radius offset 34


(D34)


On some ma chines, the D-offset can not be used, and the H-offset must be used