Description
Writes the tool offset value specified by "datano_s","datano_e","type". The offset value must be stored in "IODBTO" with signed binary format.
The unit of offset value is the same as "Write tool offset value(cnc_wrtofs)". See the description of cnc_wrtofs function.
Universal Fanuc Driver
Fanuc Focas Library CD
Declaration
Arguments
Specify the library handle. See "Library handle" for details.
Specify the data block length.
Pointer to the IODBTO structure including the tool offset value. The IODBTO structure is as follows.
typedef struct iodbto {
short datano_s; /* start offset number */
short type; /* offset type */
short datano_e; /* end offset number */
union {
long m_ofs[N]; /* M series individual */
long m_ofs_a[N]; /* M series Memory A all */
long m_ofs_b[2*N]; /* M series Memory B all */
long m_ofs_c[4*N]; /* M series Memory C all */
struct {
short tip ;
long data[1] ;
} m_ofs_at[N] ; /* M series Memory A all with direction of imaginary tool nose */
struct {
short tip ;
long data[2] ;
} m_ofs_bt[N] ; /* M series Memory B all with direction of imaginary tool nose */
struct {
short tip ;
long data[4] ;
} m_ofs_ct[N] ; /* M series Memory C all with direction of imaginary tool nose */
short t_tip[N]; /* T series individual,direction of imaginary tool nose */
long t_ofs[N]; /* T series individual */
struct {
short tip;
long data[4];
} t_ofs_a[N]; /* T series Memory A all */
struct {
short tip;
long data[8];
} t_ofs_b[N]; /* T series Memory B all */
long t_ofs_2g[3*N]; /* T series Second geometry all */
struct {
long data[2];
} t_ofs_ex[N]; /* T series 4th/5th Axis Offset Function all */
} u ;
} IODBTO ; /* N is number of the offset value. */
- datano_s
- Specify the start tool offset number.
The available number of tool offset can be got by cnc_rdtofsinfo function.
- datano_e
- Specify the end tool offset number.
- type
- Specify the tool offset type.
The combinations of the value specified in "type", the data block length "length", the kind of offset value to be written and the member in which the offset value must be stored are the same as "Read tool offset value(area specified)(cnc_rdtofsr)". See the description of cnc_rdtofsr function.
Return
EW_OK is returned on successful completion, otherwise any value except EW_OK is returned.
The major error codes are as follows.
Return code | Meaning/Error handling |
---|---|
(2) |
Size of ODBTOFS structure(length) is wrong. |
(3) |
Offset number(datano_s,datano_e) is wrong. |
(4) |
Offset type(type) is wrong. |
(15) |
Offset data is out of range of the wrong operation prevention functions. |
(5) |
Offset data(data,etc.) is out of range. |
As for the other return codes or the details, see "Return status of Data window function"
CNC option
And this function is related to the following CNC option.
- Series 15
- Series 15i
- Series 16/18/21, 16i/18i/21i
- Series 0i-A/B/C
- Series 0i-D/F
- Series 30i
- Power Motion i
* ( ) : Basic
M
Tool offset extension
(32)/99/200/499/999 sets
Tool offset memory
(A)/B/C
Extended tool offset value (number of offset is half of the above sets.)
T
Tool offset extension
(32)/64/160 sets
Tool offset memory
(A)/B
Cutter radius compensation
Extended tool offset value (number of offset is half of the above sets.)
TT
Tool offset extension
(16)/32/80 sets
Tool offset memory
(A)/B
Cutter radius compensation
M
Tool offset extension
(32)/99/200/499/999 sets
Tool offset memory
(A)/B/C
M
Tool offset extension
(32)/64/99/200/400/499/999 sets
Tool offset memory
(A)/B/C
T
Tool offset extension
(16)/32/64/99 sets
Geometry/wear offset
Cutter radius compensation
Y axis offset
M
Tool offset extension
32/(400) sets
Tool offset memory
A/(C)
T
Tool offset extension
32/(64) sets
Geometry/wear offset
Cutter radius compensation
Y axis offset
M
Tool offset extension
32/(400) sets
Tool offset memory
A/(C)
T
Tool offset extension
32/(99) sets
Geometry/wear offset
Cutter radius compensation
Y axis offset
M
Tool offset extension
(32)/64/99/200/400/499/999/2000 sets
Tool offset memory
(A)/B/C
Cutter radius/Nose R offset
Tool offset for Milling and Turning function
T
Tool offset extension
(32)/64/99/200/400/499/999/2000 sets
Geometry/wear offset
Cutter radius/Nose R offset
Y axis offset
Second geometry offset
4th/5th Axis Offset Function
The changing active offset
Tool offset for Milling and Turning function
Tool offset extension
(32)/99/200 sets
For HSSB connection,
For Ethernet connection,
The Ethernet function and the extended driver/library function are necessary. However, in case of Series 16i/18i/21i-B, 0i-B/C/D/F, Series 30i and PMi-A, the required CNC option is as follows. When Embedded Ethernet is used,above two optional functions are not required.
When Ethernet board is used,
- only Ethernet function is required.
CNC parameter
This function is related to the following CNC parameter.
See the manual of CNC parameter for details.
5009#5(M Series)
5024
5009#5(M Series)
5024
8132#1=1 (must be set)
5009#5(M Series)
5024
1004#1(In case of Power Mate i-D)
CNC mode
This function can be used in any CNC mode.
Available CNC
0i-A | 0i-B/C(Note) | 0i-D | 0i-F | 15 | 15i | 16 | 18 | 21 | 16i-A | 18i-A | 21i-A | 16i-B | 18i-B | 21i-B | 30i-A | 30i-B | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
M (Machining) | |||||||||||||||||
T (Turning) | - | ||||||||||||||||
LC (Loader) | - | - | - | - | - | - | - | - |
0i-D | 0i-F | 16i | 18i | 30i-A | 30i-B | |
---|---|---|---|---|---|---|
P (Punch press) | - | |||||
L (Laser) | - | - | - | - | ||
W (Wire) | - | - |
Power Mate i-D | |
Power Mate i-H | |
Power Motion i-A | O |
"O" | : | Both Ethernet and HSSB | |
"E" | : | Ethernet | |
"H" | : | HSSB | |
"X" | : | Cannot be used | |
"-" | : | None |
Note) 0i-C does not support the HSSB function.
See Also
cnc_rdtofs cnc_wrtofs cnc_rdtofsr cnc_rdtofsinfo
Example(C Language)
The following program writes all tool offset values of Machining-Series
(Memory A/64 sets).
#include "fwlib32.h"
#define MAXTOOL 64
/* offset is array of new offset value. */
short example( long *offset )
{
IODBTO *tofsr ;
short ret ;
tofsr = (IODBTO *)malloc( 8+4*MAXTOOL ) ;
tofsr->datano_s = 1 ;
tofsr->datano_e = MAXTOOL ;
tofsr->type = -1 ;
memcpy( &(tofsr->u.m_ofs_a[0]), offset, 4*MAXTOOL ) ;
ret = cnc_wrtofsr( h, 8+4*MAXTOOL, tofsr ) ;
free( tofsr ) ;
return ( ret ) ;
}
Example(C#)
The following program writes all tool offset values of Machining-Series
(Memory A/64 sets).
class example
{
public const short MAXTOOL = 64;
/* offset is array of new offset value. */
public short sample(int[] offset)
{
Focas1.IODBTO_1_1 fsrHead = new Focas1.IODBTO_1_1();
short ret;
byte[] bytes = new byte[8 + 4 * MAXTOOL];
IntPtr ptrHead = Marshal.AllocCoTaskMem(Marshal.SizeOf(fsrHead));
fsrHead.datano_s = 1;
fsrHead.datano_e = MAXTOOL;
fsrHead.type = -1;
Marshal.StructureToPtr(fsrHead, ptrHead, false);
Marshal.Copy(ptrHead, bytes, 0, 8);
Buffer.BlockCopy(offset, 0, bytes, 8, 4 * MAXTOOL);
ret = Focas1.cnc_wrtofsr(h, 8 + 4 * MAXTOOL, bytes);
Marshal.FreeCoTaskMem(ptrHead);
return (ret);
}
}