A Custom Macro for Bar Pulling

This alternative to bar feeding can provide many of the same capabilities, but at a fraction of the cost.


Facebook Share Icon LinkedIn Share Icon Twitter Share Icon Share by EMail icon Print Icon

One popular application for turning centers is bar work, during which multiple workpieces are machined from one long bar. While bar feeders may be the most efficient platform for sending a bar through the machine’s spindle, bar pullers provide many of the same capabilities at a fraction of the cost.

On a turning center, one turret station is required to hold the bar-pulling device. Designs for bar pullers vary, but the basic idea is that during the CNC cycle and after a workpiece is cut off from the bar: 1) the spindle will stop and the bar puller will engage the workpiece; 2) the clamping system (collet or chuck) will release the workpiece; 3) the Z axis will advance the bar; 4) the clamping system will be clamped again; and 5) the bar puller will retract from the workpiece and machining operations on the next workpiece will be performed.

Many programmers use subprogramming techniques for the repeated workpiece machining and bar advance. If 20 workpieces can be machined from a bar, for example, they will use a command something like this one (program O1000 in this example is a program that machines one workpiece):

N040 M98 P1000 L20

This works well as long as the cycle is not interrupted while a bar is being machined. If the cycle is cancelled for any reason, the machine will lose track of how many workpieces have been machined, complicating the task of restarting. 

Additionally, using this technique can lead to wasted raw material. If the machine is in the middle of a bar when the programmed part count is reached, nothing will (automatically) stop the machine until the whole bar is machined.

These issues can be overcome with a relatively simple-to-use custom macro:

(Input data)
#100=275 (Lot size)
#101=1.0 (Workpiece length) 
#106=1020 (Program number for the machining program)
#104=36.0 (Bar length in inches) 
#102=0.03 (Facing stock)
#105=3.0 (Remnant length in inches) 
#103=0.125 (Cutoff tool width)
IF [#501GT0] GOTO5 (Test if any workpieces have been machined)
(Calculations for a new production run)
#500=0 (Counter for bar)
#503=#101+#102+#103 (Bar advance amount)
#502=FIX[[#104-#105]/#503] (Number of parts per bar)
(Loop for the production run)
N5IF [#501GE#100] GOTO99 (Test for lot completion)
(Loop for each bar)
IF [#500GE#502] GOTO98 (Test for bar completion)
M98P#106 (Execute the program that runs a part and advances the bar)
#500=#500+1 (Step bar counter)
#501=#501+1 (Step production run counter) 
GOTO5 (Go back to bar completion and lot completion tests)
(Actions when bar or lot is completed) 
N98#500=0 (Reset bar counter) 
#3000=100 (Load a new bar)
N99#500=0 (Reset bar counter) 
#501=0 (Reset production run counter) 
#3000=100 (Production run is completed)

To use this program (it will be the main program), first create, load and test the workpiece-machining and bar-advance subprograms. Then, modify the input data in the program above. It is likely that much of this data will remain the same from job to job (like bar and remnant length), so we have listed the data in the order most likely to be changed. If you use a consistent process for your bar-pulling application, it is likely that only the first three input data values must be changed from job to job.

Since the bar-advance amount (#503) is a permanent common variable and is retained from program to program, you can use it in the machining program during bar advance to save some work:

G98 G01 W#503 F30.0 (Pull the bar)

Once the program has completed a bar, it will put the machine in alarm state with the message to load a new bar. At this time, load the new bar, reset the program (so that it runs from the beginning) and restart the cycle. When the program completes the production run (probably in the middle of a bar), it will place the machine in alarm state with the message that the production run is completed. 

It is important to note that the value of #501, the production counter, must be set to zero before this program is used for the first time. It is set back to zero at the completion of each production run, but if you stop running the job before completing the production run for any reason (possibly to pull off of the job to work on a more urgent one), you must reset #501 to zero yourself.