Answers and Information

The following answers and information provide some helpful ways to increase your productivity. From sample programs and specific codes to best practices and videos, these ideas will help you get the most from your machine.

Please note, you should not perform machine repairs or service procedures unless you are qualified and knowledgeable about the processes. Many service and repair procedures should be done only by authorized personnel. Hartwig’s Service Technicians have the training, experience, and are certified to do these tasks safely and correctly.

Contact Hartwig if you have a content suggestion to be considered for the Answers and Information page.


Common Variable for Lathe - Example Program

N10 G14
N40 PS LC,[-30,0],[30,23]
N70 (V1=OD)
N80 (V2=Length of fin part)
N90 (V3=ID)
N100 (V4=Counterbore I.D.)
N110 (V5=Counterbore depth)
N120 (V6=Counterbore? 1=yes 0=no)
N130 (V8=Length of chamfer)
N140 (V12=Face SFM)
N150 (V13=Face Feedrate)
N160 (V14=Rough Turn, Drill, and Bore RPM)
N170 (V15=Rough Turn Feedrate)
N180 (V16=Drill Feedrate)
N190 (V18=Bore Feedrate)
N200 (V19=Cutoff SFM)
N210 (V20=Cutoff Feedrate)
N220 G50 S2000
N230 G0 X20 Z20
N240 M42 S=[3.8/V1]*V12 M3 P10
N250 (Face and Turn OD)
N260 T010101 X=V1+.2 Z0 M8
N270 G96 S=V12 G111 P15
N280 G1 X-.032 F=V13
N290 Z.05
N300 G97 S=V14 P20
N310 G0 X=V1+.03 P30
N320 G1 X=V1-.04 Z0 G42 F.02
N330 X=V1 G76 L-.005 F=V15
N340 Z-V2-.150
N350 X=V1+.08
N360 G0 X=V1+.2 Z=V2 G40
N370 G0 X20 Z20
N380 (Cutoff)
N390 T0202 X=V1+.05 Z=-V2-.125
N400 G97 S=[3.8/V1]*V19 P35
N410 G96 S=V19 G111 P37
N420 G1 X=V3-.025 F=V20
N430 G0 X=V1+.1 P40
N440 M5 M9 P50
N450 X20 Z20
N470 T0404 G0 X0 Z.1
N480 G1 Z-1. F15 G94
N490 M84
N500 G1 Z.020 F15
N510 M83
N520 G1 Z1.00 F60
N530 G0 X20 Z20
N540 G13
N550 G50 S2000
N560 G0 X20 Z20
N570 M42 S=[3.8/V1]*V12 M3 P10
N580 (Drill )
N590 T0101 X5 Z.1 M8
N600 G96 S=V12 G111 P15
N610 G97 S=V14 P20
N620 X0 P30
N630 G1 Z-V2-.11 F=V16
N640 G0 Z.1
N650 G0 X20 Z20
NBORE (Bore)
N670 T020202 X=V3+[V8*2]+.08 Z.1
N680 G1 X=V3+[V8*2]+.01 Z0 F.015 G41
N690 X=V3+[V8*2] F=V18
N700 X=V3 Z=-V8
N710 Z=-V2-.05
N720 G40
N730 X=V3-.01
N740 G0 Z.1
NCBOR T020202 X=V4+.08 Z.1
N760 G1 X=V4+.01 Z0 F.015 G41
N770 X=V4 F=V18
N780 Z=-V5
N790 X=V3
N800 Z=-V2-.05
N810 G40
N820 X=V3-.01
N830 G0 Z.1
NSKIP G97 S=[3.8/V1]*V19 P35
N840 G96 S=V19 G111 P37
N850 X20 Z20
N860 (Parts Catcher)
N870 T0303 X0 Z.1
N880 G1 Z=-V2 F20 G94
N890 G0 Z.1 P40
N900 M5 M9 P50
N910 X12 Z8
N930 G94 F15 Z10 G1
N940 G0 X20 Z20
N950 M2

G88 Threading Cycle for Lathe - Example Program

G71 X2.25 Z.5 B60 U.001 M32 M73 D.03 H.1 F.1 I-.1
G88 NLAP1 D.03 H.1 B60 U.001 M32 M73
G34 X2 Z3.2 F.010
G34 Z.5 X1.8 F.10
G0 X3. F.05

ID Oil Groove on Okuma Lathe - Example Program

PS LC,[-60,0],[65,50]
PS LC,[-60,0],[65,10],0
G0 Z-.5
G34 Z-3 X1.010 F.25 J1
Z-.5 X1.020
Z-3 X1.030
Z-.5 X1.040
Z-3 X1.050
Z-.5 X1.060
Z-3 X1.070
Z-.5 X1.080
Z-3 X1.090
Z-.5 X1.100
Z-3 X1.110
Z-3 X1.120
Z-.5 X1.130
Z-3 X1.140
Z-.5 X1.150
Z-3 X1.160
Z-.5 X1.170
Z-3 X1.180
Z-.5 X1.190
Z-3 X1.200
Z-.5 X.995
G0 X.9
G0 Z1

G0 Z-.5
G34 Z-3 X1.010 F.25 J1 C180
Z-.5 X1.020
Z-3 X1.030
Z-.5 X1.040
Z-3 X1.050
Z-.5 X1.060
Z-3 X1.070
Z-.5 X1.080
Z-3 X1.090
Z-.5 X1.100
Z-3 X1.110
Z-3 X1.120
Z-.5 X1.130
Z-3 X1.140
Z-.5 X1.150
Z-3 X1.160
Z-.5 X1.170
Z-3 X1.180
Z-.5 X1.190
Z-3 X1.200
Z-.5 X.995
G0 X.9
G0 Z1


Tool Life Management / Part Transfer (G22) / Sub-Spindle LB15IIMW - Example Program

VTLIN[1]=3 VTLFN[1]=1 VTLL[1]=1.625 VTLA2[1]=5 VTLA1[1]=80
VTLIN[1]=1 VTLFN[1]=1 VTLL[1]=1.625 VTLA2[1]=5 VTLA1[1]=80
VGRIN[2]=9 VGRFN[2]=1 VGRL[2]=1.625 VGRA2[2]=5 VGRA1[2]=55
VGRIN[2]=7 VGRFN[2]=1 VGRL[2]=1.625 VGRA2[2]=5 VGRA1[2]=55
VTLIN[3]=28 VTLFN[3]=1 VTLD[3]=0.25 VTLL[3]=1 VTLA1[3]=118
VTLIN[1]=3 VTLFN[1]=1 VTLL[1]=1.5 VTLA2[1]=5 VTLA1[1]=80
VTLIN[1]=1 VTLFN[1]=1 VTLL[1]=1.5 VTLA2[1]=5 VTLA1[1]=80
VTLIN[2]=9 VTLFN[2]=1 VTLL[2]=1.5 VTLA2[2]=5 VTLA1[2]=55
VTLIN[2]=7 VTLFN[2]=1 VTLL[2]=1.5 VTLA2[2]=5 VTLA1[2]=55
VWKR=393.7007 VCHKL=0.5 VCHKD=0.5 VCHKX=2 VCHKZ=-2
VWKR=393.7007 VCHKL=0.5 VCHKD=0.5 VCHKX=1.75 VCHKZ=-2
PT LF,LC,[-20,0],[20,20],[20,0]
PF 0,[0,0],20,D
PT LF,LC,[-10,0],[20,20],[10,0]
PT LF,LC,[-17,0],[18,18],[7,0]
PT SS,LC,[-20,0],[13,18],[3,3]
N0001 G140
N0002 M216
N0003 G00 X20 Z20
N0004 G50 S3800
N0005 G141
N0006 G50 S4500
N0100 G140
N0101 G00 X20 Z20
N0102 VLMON[1]=1
N0103 G97 S727 M41 M03 M08
N0104 X2.416 Z0.12 T010101
N0105 Z0.18
N0106 G96 S460
N0107 G85 N0108 D0.12 F0.014 U0.016 W0.008 M85
N0108 G83
N0109 G01 X2 Z0
N0110 Z0.02
N0111 X0
N0112 Z0
N0113 G82
N0114 G00 X2.096 Z0 G41
N0115 G01 X-0.016 E0.014
N0116 G40
N0117 G80
N0118 G00 Z0.12
N0119 VLMON[1]=0
N0120 G97 S727 M09
N0121 M01
N0200 VLMON[2]=2
N0201 G97 S757 M08
N0202 G00 X2.1 T010101
N0203 Z0.208
N0204 X2.32
N0205 G96 S460
N0206 G85 N0207 D0.32 F0.014 U0.016 W0.008 M85
N0207 G83
N0208 G01 X1.25 Z0
N0209 X2
N0210 Z-1.048
N0211 G81
N0212 G00 X1.154 Z0 G42
N0213 G01 X1.25 E0.021
N0214 G03 X1.75 Z-0.25 K-0.25 E0.014
N0215 G01 Z-1.048
N0216 X2.096 E0.021
N0217 G40
N0218 G80
N0219 G00 X2.1
N0220 VLMON[2]=0
N0221 G97 S757 M09
N0222 X20 Z20
N0223 M01
N0300 G97 S1601 M42 M08
N0301 G00 X1.41 Z0.12 TG=02 OG=1
N0302 Z0.079
N0303 G96 S591
N0304 G87 N0305
N0305 G82
N0306 G00 Z0
N0307 G01 X1.282 G41 F0.008
N0308 X0
N0309 G40
N0310 G80
N0311 G01 X0.088 Z0.004
N0312 G00 Z0.12
N0313 G97 S3800 M09
N0314 M01
N0400 G97 S1783 M08
N0401 G00 X2.1 TG=02 OG=1
N0402 Z0.079
N0403 X1.266
N0404 G96 S591
N0405 G87 N0406
N0406 G81
N0407 G00 X1.106
N0408 G01 Z0.04 G42 F0.008
N0409 Z0
N0410 X1.25
N0411 G03 X1.75 Z-0.25 K-0.25
N0412 G01 Z-1.048
N0413 X1.814
N0414 G40
N0415 G80
N0416 G01 X1.822 Z-1.004
N0417 G00 X2.1
N0418 G97 S1075 M05 M09
N0419 X20 Z20
N0420 M01
N0500 M110
N0501 G94 M146 M15 M08
N0502 G00 X1 Z0.52 T0303 SB=1070
N0503 Z0.14
N0504 G183 X1 Z-0.5 C0 K0.02 F4.28 E0.112 D0.12 L0.5
N0505 C90
N0506 C180
N0507 C270
N0508 G180
N0509 G00 Z0.52
N0510 G95 M12 M09
N0511 M109
N0512 G00 X20 Z20
N0513 M01
N0600 G00 Z5 W20
N0601 M247
N0602 M249
N0603 M151
N0604 G00 W1.2
N0605 G29 PW=65
N0606 G94 G22 W0 D0.05 L0.08 F20 PW=55
N0607 G29 PW=5
N0608 M248
N0609 G28
N0700 M246
N0701 M185
N0702 M84
N0703 G95 G00 W20
N0704 M150
N0705 M184
N0706 M01
N0800 G141
N0801 G00 X20 Z20
N0802 VLMON[3]=1
N0803 G97 S727 M03 M08
N0804 X2.416 Z0.12 T210121
N0805 Z0.18
N0806 G96 S460
N0807 G85 N0808 D0.078 F0.0112 U0.016 W0.008 M85
N0808 G83
N0809 G01 X2 Z0.02
N0810 X0
N0811 G82
N0812 G00 X2.096 Z0.02 G41
N0813 G01 X-0.016 E0.0112
N0814 G40
N0815 G80
N0816 G00 Z0.12
N0817 VLMON[3]=0
N0818 G97 S727 M09
N0819 M01
N0900 VLMON[4]=2
N0901 G97 S757 M08
N0902 G00 X2.1 T210121
N0903 Z0.228
N0904 X2.32
N0905 G96 S460
N0906 G85 N0907 D0.208 F0.0112 U0.016 W0.008 M85
N0907 G83
N0908 G01 X1.25 Z0.02
N0909 X2
N0910 Z-0.98
N0911 X1.75
N0912 G81
N0913 G00 X1.154 Z0.02 G42
N0914 G01 X1.25 E0.0168
N0915 G03 X1.75 Z-0.23 K-0.25 E0.0112
N0916 G01 Z-1.028
N0917 G40
N0918 G80
N0919 G00 X2.1
N0920 VLMON[4]=0
N0921 G97 S757 M09
N0922 X20 Z20
N0923 M01
N1000 G97 S1601 M08
N1001 G00 X1.41 Z0.12 T220222
N1002 Z0.099
N1003 G96 S591
N1004 G87 N1005
N1005 G82
N1006 G00 Z0.02
N1007 G01 X1.282 G41 F0.008
N1008 X0
N1009 G40
N1010 G80
N1011 G01 X0.088 Z0.024
N1012 G00 Z0.12
N1013 G97 S4500 M09
N1014 M01
N1100 G97 S1783 M08
N1101 G00 X2.1 T220222
N1102 Z0.099
N1103 X1.266
N1104 G96 S591
N1105 G87 N1106
N1106 G81
N1107 G00 X1.106
N1108 G01 Z0.06 G42 F0.008
N1109 Z0.02
N1110 X1.25
N1111 G03 X1.75 Z-0.23 K-0.25
N1112 G01 Z-1.012
N1113 G40
N1114 G80
N1115 G01 X1.758 Z-0.968
N1116 G00 X2.1
N1117 G97 S1075 M05 M09
N1118 X20 Z20
N1119 M01
N1120 G140
N1121 M215
N1122 TLID
N1123 M02

Local Variables and G101 for Lathe - Example Program

G94 M08
SFM=80 (Surface Feet Per Minute)
IPT=.0005 (Inches per Tooth)
DIA=1.265 (Diameter of Cutter)
TETH=13 (Number of Teeth on Cutter)
G00 X2.3269 Z0 T0101 SB=[3.82/DIA]*SFM
C-29.4594 G42 M13
G01 Z-0.19 F15
G101 X2.3269 C29.4594 F=IPT*TETH*[[3.82/DIA]*SFM]
G0 X3
G95 M12
G00 X20 Z20

G-Code List - Okuma Lathes

M-Code List - Okuma Lathes

System Variable List - Okuma Lathes

Okuma P300L Control - How to Set Z-Axis Work Zero

Do You Have Variables In Your Manufacturing Operation

Do You Have Variables In Your Manufacturing Operation

Written by Mike Wolf, Hartwig Applications Engineer

Okuma control, the variables and related functions are part of User Task II. On the Fanuc control, it is part of Macro B. Most of the variable functions are now standard on the newer Okuma controls. Macro B is usually an option on many Fanuc controls. There are basically three types of variables – local variables, common variables, and system variables. Some controls also have a function called IO variables (input /output variables).

Common Variables:

A common variable on the Okuma lathe is called out using V, on a machining center it is VC. Common variables can be used to represent coordinate positions, spindle speeds, or a counter.

Most Okuma machines will have common variables ranging from 1 up to 32. New machines will usually have 200. One of the basic uses of common variables is a parts counter. The operator or programmer would put a line of code in the program, each time the program reads that particular line one is added to the parts count. At  the end of the shift the operator can check the number of parts by looking in the common variable page in parameter mode.

A parts counter on the lathe might look something like this, V10=V10+1, with this statement in the program the machine would add 1 to common variable 10 each cycle. For a machining center it would read VC10=VC10+1.

On a Fanuc control is would look like this #105 = #105+1.

System Variables:

System variables have a specific meaning to the machine’s operating system. One system variable that is used quite often on an Okuma lathe or mill is VZOFZ. This is used to represent the Z zero offset from the zero set mode. When the machine reads the line containing VZOFZ, the Z zero offset would be set or updated. There are many systems variables ranging from zero offsets to pitch error comp to current machine position. Used in the program, the variable would read like this, VZOFZ=652.9658. The number following the equal sign is the value obtained from the Z zero offset in zero set mode. On a Fanuc control, the Z axis work shift is variable #2601 and the name is [#_WKSFTZ].

Local Variables:

Local variable names are chosen by the programmer. The name is usually up to four characters long, with the first two characters being letters from the alphabet. Local variables are cleared upon the completion of the program or when rest is pressed. Up to 127 local variables are available on most controls with this type of function. With this type of variable we create a unique name that has some meaning to us. An example of this might be XDIM1 or ZDIM1. With these names we assign an X program position and Z program position. In the program it would like this:

XDIM1=1.0 (this defines the value for XDIM1)

ZDIM1=1.0 (this defines the value for ZDIM1)

G0 X=XDIM1 (X is positioned to 1-inch at a rapid speed)

G1 Z=-ZDIM1 F.010 (Z is positioned to 1-inch at a feed rate of .010 per rev)

I/O Variables:

A fourth, but often overlooked, type of variable is what we call an I/O variable. These types of variables are used to check the status of an input or output on the machine. For example, we can check to see if single block is on or if the spindle override is set to 100%. If the proper conditions do not exist, we can generate an alarm to alert the operator to the condition so it can be corrected before running the machine cycle. Here in this example to check if single block is on:

IF [VORD[00023]EQ 1] NAL06  (check to see if single block is on; if it is on jump to line NAL06)

NCUT (start of cutting program)

NDONE (end of cutting program)

GOTO NEND (jump to line NEND to read M30 end of program code)

NAL06  VAUCM[1]=’SINGLE BLK ON’ (comment that will appear with alarm if single block is on)



When programmers use check statements like this, they will usually check multiple items on the machine and will put these checks in a sub program.

Most machines with the variable functions will also have the ability to do math within the program. This can range from simple addition and subtraction, trig functions using sine and cosine, or rounding up or down. With this example, we set the speed command S by using local variable and a simple math formula:

SFM=770 (surface speed of 770)

S=3.82/4*SFM (speed is equal to 3.82/4 flutes *SFM of 770)


Daily Preventive Maintenance Activities

  • Check hydraulic pressure and fluids, chuck pressure, lube levels; and, if you have a cooling system, check the cooling unit level.
  • Clean out chips, grease parts as needed, clean off windows and doors, and wipe down and lubricate way covers for smooth movement.

Every Three Months or 500 Hours

  • Check and grease the chain on chip conveyor.
  • Check and clean the filters on the coolant tank.

Every Six Months or 1,000 Hours

Have the following preventive maintenance performed by a certified technician:

  • Clean the coolant tank of sludge, chips and oil.
  • Clean the chuck and jaws.
  • Drain the hydraulic tank and replace the hydraulic oil, and change the line filter and suction filter.
  • Clean the radiator and make sure the radiator fins are straight.
  • Drain and clean the lubrication unit and add fresh way lube.
  • Drain and refill the cooling unit.
  • Check the leveling of your machine and adjust if necessary.
  • Clean and inspect way wipers and replace any wipers that are damaged.

Once a Year or Every 2,000 Hours

Have your Hartwig Service Technician perform the following inspections:

  • Check the headstock for taper.
  • Check the spindle for radial and end play.
  • Check the chuck cylinder for run out.
  • Check the tailstock for taper.
  • Check turret parallelism and inclination.
  • Run a backlash program to check the backlash in X and Z axis.
  • Check the X and Z axis gibs.

Periodic Inspection of the Crossrail Brake

An electromagnetic brake is part of the crossrail elevating countershaft, which is located inside the top beam to prevent the crossrail from dropping when there is an interruption in power. The electromagnetic brake uses a friction board. If its linings are worn, the brake torque is reduced and the unclamp motion cannot perform smoothly, deteriorating the braking performance. This may cause the crossrail to drop abnormally, leading to serious accidents. Periodic inspection of the lining can prevent this situation. Although the brake linings will not wear easily, as they are not applied during crossrail movement, it is still an important maintenance item.

Follow the procedure below:

  1. Turn off power to the machine.
  2. Remove the cap screw (Item#18 shown below) and insert the feeler gauge supplied with the machine. Insert the gauge between the pole surfaces.

The clearance should be within 0.5mm (0.020 in.) of 0.15mm (0.0059 in.) to 1mm (0.04 in.) Contact Hartwig or Okuma immediately if the clearance is larger or smaller than this range.

double_column_mc - crossrail

Tools Getting Stuck in Spindle After Long Uninterrupted Cuts

After a long or heavy cutting operation, a tool may become overheated and difficult to remove from the spindle.

If the cutting operation generates significant vibration, fretting corrosion effect can cause rust to gather on the tapered bores between spindle and tool.

Apply a coating of powder lubricant, such as aerosol molybdenum (Molykote® 321 or similar), to the taper section of the tool shank and spindle to ease removal. Care should be taken while handling the tool if it is hot.

Preventing Hydraulic Oil Contamination on Your Lathe

On the back of the actuator, there is a coolant return. This can sometimes get clogged with chips or other debris. When this occurs, coolant can spill over into the hydraulic return thus contaminating the hydraulic system. By simply checking the coolant return daily and cleaning as necessary, this issue can be avoided.

How to Calibrate the Touch Setter

Service Tip: Don’t Confuse Air/Oil Lubrication with Way Oil Lubrication


Avoiding Spooling Problems

Wire tangling or cross-overs on the spool are one of the most common reasons for returned EDM wire, yet the vast majority of these incidents are caused by improper handling and storage of the spool.

Storing a spool by laying it on its flange, when combined with improper fixing of the free end, is an invitation to a spooling problem the next time you use the spool. Relaxed wire tension can propagate from the surface layer into the spool. The slightest impact while the spool is on end can cause the coils to slip past each other creating a tangle.

Wire manufacturers package their wires with the axis of the spool in the horizontal position to prevent this problem. It is a good idea to save the box for properly storing partially used spools.

Give Your Filters a Rest

Did you know that you can increase the life of your filters by giving them a rest? Many shops leave their machines running all the time with the filter pumps on. Not only does this consume substantial unnecessary filter pump and chiller energy, but it also shortens filter life. It is an established fact that depressurizing a filter cartridge will allow some of the dirt cake on the pleats to fall to the bottom of the housing, and re-open some of the pores. The next time your filters need changing, try turning off the filter pump overnight and note how much the overflow from the clean tank improves the following morning.

Sizing An EDM Chiller

It is important to properly size a chiller to the machine’s heat output into the dielectric. While it is often difficult to accurately predict the BTU/hr capacity required to absorb the heat of the machine pumps, and the erosion process based upon the pump HP and the power supply KVA, there is a simple method to assure that you buy the right size.

Starting with a cold machine, measure the dielectric temperature. Turn on the machine and begin cutting a typical thickness block for 1 hour. Then measure the water temperature again. Note the temperature rise. Report this temperature rise, along with the machine dielectric tank capacity and dielectric type (oil or water) to your prospective chiller vendor. This information will allow them to accurately calculate the heat output of your machine system, and accurately size the chiller.