Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 503 -
------------------------------------------------------------------------------
1.72 Read tool life management data (tool group index). <Main,Alarm>
------------------------------------------------------------------------------
[Name]
cnc_rdgrpid
[Syntax]
#include <data.h>
#include <fwindow.h>
int cnc_rdgrpid( int number, struct odbtool *buf ) ;
struct odbtool {
int datano ; /* Not used. */
int type ; /* Tool number. */
long data ; /* Tool group number. */
} ;
[Arguments]
number Tool number.
buf Buffer in which the tool management data are stored.
[Return]
0 Successful.
4 Incorrect tool number "buf.type".
5 The specified tool number is not registered.
6 The required option (Tool life management or Tool number
expansion for tool life management (512 sets in total, only
M Series)) is not added.
[Description]
Reads the tool group number in which the specified tool is registered.
Specify the tool number in "number" with binary format.
The tool group number in which the specified tool number is registered
is stored in "buf.data" with binary format. The currently used tool
group number is stored by specifying "0" in "number". However, in case
that any tool group number has never be specified since power-on, "0"
is stored.
[Example]
The following program reads the tool group number in which the
specified tool is registered, and displays it.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
/* toolno is TOOL index number to be read. */
int example( int toolno )
{
struct odbtool buf ;
int ret ;
ret = cnc_rdgrpid( toolno, &buf ) ;
if ( !ret )
printf( "TOOL #%d is registered in GROUP #%ld.\n",
toolno, buf.data ) ;
else
printf( "ERROR!(%d)\n", ret ) ;
return ( ret ) ;