CNC Offset Calculator - How It Works & Examples

   Basics

   Each tool path is defined in a coordinate system (frame) called User Frame. Each CNC part program has its X0,Y0,Z0 point from which all toolpaths are defined. This datum point has no reference to the machine coordinate system until the part is set on the machine and the operator finds this point and sets its coordinates (offsets) in the machine frame. On horizontal machines, each time the table is rotated a new coordinate system (offset) must be established. This process can be time consuming and labour intensive. And each time the workpiece changes its position we would have to repeat the whole process again.   

   CNC Offset Calculator makes this setup easy - you make most of your setup work on the PC while the machine is running (and makes money). First decide which offset is the easiest to measure on the machine (or which is the most important). This offset will be Primary Offset and it will be measured by the operator on the machine. All other offsets are Secondary offsets and they will be calculated from the code generated by CNCOffsetCalc when the machine runs.

The pic above shows the scenario how the CNC Offset Calculator works:
The Primary offset is measured on the machine and its coordinates are typed into CNC machine offset table or into the CNC code generated by CNCOffsetCalculator (see Use Offset example).
The secondary offsets are taken relative to the Primary offset and they are constant values regardless of the workpiece position. (The secondary offset values entered into the CNCOffsetCalc are not the actual offset coordinates - they are dimensions of secondary offsets from primary offset.)

 Example how to enter data into CNC Offset Calculator - see this picture .

The picture bellow shows a part with four offsets - one Primary offset and three Secondary offsets. The Secondary offset positions are measured from Primary offset as looking from the spindle. The data entered into the CNC Offset Calculator are identical to the offset positions as they are recorded in the picture.

Offset No 2:
X = 200
Y = 30
Z = -50
B = 90
Offset No 3:
X = -90
Y = 100
Z = -120
B = 225
OffseT No 4:
X = -150
Y = 100
Z = -60
B = 270


   Primary Offset

   Primary Offset is the offset which is set by the operator on the machine and from which all other (Secondary Offsets) are calculated. Only one offset can be set as Primary Offset. By default offset No 1 is Primary Offset. However, any Secondary Offset can be set later as Primary Offset simply by clicking "Set as Primary Offset" button. 

   X, Y, Z and B positions of Primary Offset are measured from Machine Frame [MF] Origin (X0, Y0, Z0, B0).  
  
   The picture shows machine table and its position in Machine Frame coordinate system [MF]. The left hand corner of the workpiece has been set as Primary Offset and its position is marked as X primary ofset and Z primary offset. (Y primary offset is not shown in this 2D drawing).The Primary offset data are actual offset coordinates in the machine frame coordinate system.
All secondary offset data are positions relative to the Primary Offset - see the next picture.

 


   Secondary Offset

   The picture shows Secondary Offset in the right hand corner on the workpiece, B90 deg relative to the Primary Offset. Its position is marked X position and Z position.

   X,Y,Z and B positions of Secondary offsets are measured from Primary offset.       If we move the workpiece on the table, the Primary Offset values will change, but Secondary Offset values will remain the same.    We have to determine carefully directions of the X,Y,Z,B values. In the example, X is (East) positive, Z is (North) negative (Y is not shown in the picture - up is positive, down is negative).
B position is positive 90 deg. It is determined by the angle we have to rotate the machine table to get into the machining position. CW (clockwise) is positive, CCW (counter clockwise) is negative.
The secondary offset values entered in the CNCOffsetCalc are the X,Y,Z and B dimensions shown in the picture - including the positive or negative values (see the picture - X (East) is positive, Z (North) is negative, Y up is positive).


   Example how to use generated code in the CNC part program and how to set Primary offset

In the following example a code from CNC Offset Calculator is copied on top of the CNC machining program (or inserted automatically) and Primary Offset is offset No 1:
(FILE: OKM_600.OFS)
(MACHINE NAME: OKUMA 600)
(INSERT CODE FOR PROBE SENSOR HERE:)
(*PRIMARY WKS 1, B = 0.000 DEG*)
VZOFX[1] = +21.300
VZOFY[1] = +1.900
VZOFZ[1] = -22.990
VZOFB[1] = +0.000

Remove brackets from X,Y,Z,B coordinates and type in the coordinate values recorded from your measurements.

(*SECONDARY WKS 2, B = 90.000 DEG*)
VC2 = VZOFZ[1]+279.700
VZOFX[2] = - VC2*SIN[+90.000]+100.000
VZOFY[2] = VZOFY[1]+0.000
VC3 = VZOFX[1]+189.220
VZOFZ[2] = VC3*SIN[+90.000]-315.000
VZOFB[2] = VZOFB[1]
(*SECONDARY WKS 3, B = 135.000 DEG*)
VC1 = VZOFX[1]+232.100
VC2 = VZOFZ[1]-130.200
VZOFX[3] = VC1*COS[+135.000] - VC2*SIN[+135.000]+100.000
VZOFY[3] = VZOFY[1]-2.100
VC3 = VZOFX[1]+232.100
VC4 = VZOFZ[1]-130.200
VZOFZ[3] = VC3*SIN[+135.000] + VC4*COS[+135.000]-315.000
VZOFB[3] = VZOFB[1]
(*SECONDARY WKS 4, B = 180.000 DEG*)
VC1 = VZOFX[1]-131.900
VZOFX[4] = VC1*COS[+180.000]+100.000
VZOFY[4] = VZOFY[1]+9.200
VC4 = VZOFZ[1]-240.500
VZOFZ[4] = VC4*COS[+180.000]-315.000
VZOFB[4] = VZOFB[1]
(*SECONDARY WKS 5, B = 220.000 DEG*)
VC1 = VZOFX[1]-245.200
VC2 = VZOFZ[1]-196.111
VZOFX[5] = VC1*COS[+220.000] - VC2*SIN[+220.000]+100.000
VZOFY[5] = VZOFY[1]+11.111
VC3 = VZOFX[1]-245.200
VC4 = VZOFZ[1]-196.111
VZOFZ[5] = VC3*SIN[+220.000] + VC4*COS[+220.000]-315.000
VZOFB[5] = VZOFB[1]
(*SECONDARY WKS 6, B = -45.778 DEG*)
VC1 = VZOFX[1]-445.678
VC2 = VZOFZ[1]+302.010
VZOFX[6] = VC1*COS[-45.778] - VC2*SIN[-45.778]+100.000
VZOFY[6] = VZOFY[1]+0.450
VC3 = VZOFX[1]-445.678
VC4 = VZOFZ[1]+302.010
VZOFZ[6] = VC3*SIN[-45.778] + VC4*COS[-45.778]-315.000
VZOFB[6] = VZOFB[1]

Do not change this code from CNC Offset Calculator -
CNC control calculates coordinates for all secondary offsets.

Your CNC machining program starts here.

T3M6
T5
...

 

   Example how to use probe sensor with CNCOffsetCalculator

In the following example a probe sensor is used to set the X0,Y0,Z0 coordinates and copies the values into Primary offset No 1:

(FILE: OKM_600.OFS)
(MACHINE NAME: OKUMA 600)
(INSERT CODE FOR PROBE SENSOR HERE:)
(PROBE FIXTURE OFFSET)
VZOFX[10] = 115
VZOFY[10] = 575
VZOFZ[10] = 90
VZOFB[10] = 0

G15 H10

Offset No 10 is allocated for the probe. The X,Y,Z coordinates are set approximatelly within set tolerance limits (+- 15mm or 1/2") in the expected offset position.

 

N100 M01
(**RENISHAW PROBE**)
T100 M6
T47
Take Ranishaw probe and preload next tool.
G90 B0
M32
G56 H100
Rotate table to B0 deg and set tool offset for the probe.
G0 X0 Y0
Z30
M130
G1 Z-5 F1000
M131
Rapid into the probing position and feed into the cavity. The probe position has to be set approximately within +- 15mm (1/2").
CALL OO10 PMOD=7 PDI=56 Digitizing a round cavity - expected diameter 56 mm. Its center will be X0,Y0 offset No 1
CALL OO20 PHN=1 PY=0 PX=0 Copy the X0 and Y0 coordinates recorded by the probe into offset No 1
G0 Z100
X0 Y50
Z30
Retract the probe and reposition for setting Z coordinate.
CALL OO10 PMOD=3 PEI=0 Digitizing workpiece surface in Z direction.
CALL OO20 PHN=1 PZ=0 Copy the measured Z0 coordiante into offset No 1.
G0 Z600
Y600
Retract the probe into a safe position.
(*PRIMARY WKS 1, B = 0.000 DEG*)
(VZOFX[1] = +21.300)
(VZOFY[1] = +1.900)
(VZOFZ[1] = -22.990)
VZOFB[1] = +0.000
(*SECONDARY WKS 2, B = 90.000 DEG*)
VC2 = VZOFZ[1]+279.700
VZOFX[2] = - VC2*SIN[+90.000]+100.000
VZOFY[2] = VZOFY[1]+0.000
VC3 = VZOFX[1]+189.220
VZOFZ[2] = VC3*SIN[+90.000]-315.000
VZOFB[2] = VZOFB[1]
(*SECONDARY WKS 3, B = 135.000 DEG*)
VC1 = VZOFX[1]+232.100
VC2 = VZOFZ[1]-130.200
VZOFX[3] = VC1*COS[+135.000] - VC2*SIN[+135.000]+100.000
VZOFY[3] = VZOFY[1]-2.100
VC3 = VZOFX[1]+232.100
VC4 = VZOFZ[1]-130.200
VZOFZ[3] = VC3*SIN[+135.000] + VC4*COS[+135.000]-315.000
VZOFB[3] = VZOFB[1]
(*SECONDARY WKS 4, B = 180.000 DEG*)
VC1 = VZOFX[1]-131.900
VZOFX[4] = VC1*COS[+180.000]+100.000
VZOFY[4] = VZOFY[1]+9.200
VC4 = VZOFZ[1]-240.500
VZOFZ[4] = VC4*COS[+180.000]-315.000
VZOFB[4] = VZOFB[1]
(*SECONDARY WKS 5, B = 220.000 DEG*)
VC1 = VZOFX[1]-245.200
VC2 = VZOFZ[1]-196.111
VZOFX[5] = VC1*COS[+220.000] - VC2*SIN[+220.000]+100.000
VZOFY[5] = VZOFY[1]+11.111
VC3 = VZOFX[1]-245.200
VC4 = VZOFZ[1]-196.111
VZOFZ[5] = VC3*SIN[+220.000] + VC4*COS[+220.000]-315.000
VZOFB[5] = VZOFB[1]
(*SECONDARY WKS 6, B = -45.778 DEG*)
VC1 = VZOFX[1]-445.678
VC2 = VZOFZ[1]+302.010
VZOFX[6] = VC1*COS[-45.778] - VC2*SIN[-45.778]+100.000
VZOFY[6] = VZOFY[1]+0.450
VC3 = VZOFX[1]-445.678
VC4 = VZOFZ[1]+302.010
VZOFZ[6] = VC3*SIN[-45.778] + VC4*COS[-45.778]-315.000
VZOFB[6] = VZOFB[1]
Code from CNC Offset Calculator - leave the Pirmary offset X,Y,Z coordinates commented off - the X,Y,Z coordinate values have already been copied from the probe. Remove the brackets from B coordinate, unless you want to digitize it.
CNC control calculates all coordinates for secondary offsets No 2 - 6.

Your CNC machining program starts here.

M6T5
...

 


   Advanced setup - Only Professional version.    

   In some cases we might need to set (measure) more than one offset on the workpiece from which other secondary offsets are calculated. CNCOffsetCalc enables this in Advanced set up.

   Let's say we have a workpiece on which we measure X, Y, B position on Primary offset No 1 and Z axis will be referenced (measured) from Secondary offset No 4. (see Example.) We open Advanced table (Edit Offset | Advanced...) and enter "4" in the row No 1 (offset No 1) and column "Z from". In row No 4 (offset No 4) and column "Z from" we enter "P" (without double quotes) . This tells the CNCOffseytCalc that the Z axis on offfset No 4 will be measured by the operator (Primary axis) and the Z axis on offset No 1 will be calculated (Secondary axis). This example is valid in case that the offset No 4 in on B 180 deg.

   In case that the secondary offset which we want to measure is on any other B angle (see Picture) than 180 deg, we have to measure both X and Z axis to calculate Primary Z axis. In Advanced table we enter: "3" in row No 1 (offset No 1), column "Z From" and "P" in row No 3, column "X From" and column "Z From". Operator will measure X and Y position of offset No 1 and X and Z position of offset No 3 and the rest will be calculated on the fly when the machine runs.