Originally Posted by
broby
Why do you need to know this information?
If you have just parted off the component at a known Z value, Then surely the bar puller should be programmed to come into this point to grab the part and pull the required distance of material out of the chuck. (Keep in mind I have no idea what your Bar puller looks like nor how it operates).
Are you familiar with how to pass variables into your subroutines?
I would pass in the position of where you expect to find the end face and also the distance you need to pull out.
Cheers
Brian.
Well the variable 'VSIOZ' is the Z axis command point. By calling my bar pull from the part off point I can have the bar pull subroutine automatically know where it needs to go for its pull and by multiplying that number by -1 and adding .02 (face allowance) it knows how far to pull it out. No need to pass any variables. The only variables I pass are the bar diameter and the tool number for the puller. Heres my program it has changed a lot but this version is fully tested and kicks ass. It works extremely well. Maybe by examining the code you can see what I was after and why. The next step is to add a loop in the new bar section that sets up a loop while the chuck is open. This will prevent a stupid mistake that would throw an alarm and require a reset of the main program.
Code:
OBAR
(**********************************************************************************)
(OKUMA BAR PULL MACRO )
(*2/20/2008* )
(CALL THIS PROGRAM RIGHT AFTER PART OFF TOOL, DO NOT RAPID PART OFF TOOL AWAY FROM )
(PART OFF POINT BEFORE CALLING THS CYCLE. THE PROGRAM USES THIS POINT TO FIGURE ITS)
(PULL DISTANCE! )
(THIS PROGRAM MUST BE SAVED AS OBAR.SSB )
(PROGRAM EXAMPLE: )
(CALL OBAR DIA=2.0 TOOL=1 )
(WHERE 'DIA' IS THE STOCK DIAMETER AND 'TOOL' IS THE TOOL NUMBER OF THE PULLER )
(**********************************************************************************)
BARL=36.0(BAR LENGTH)
FFA=.02(FACE FINISH ALLOWANCE)
DROP=3.0(DESIRED DROP LENGTH LEFT IN CHUCK)
(****************************)
(*DO NOT EDIT BLOW THIS LINE*)
(****************************)
BARN=0
M5M9
N1
IF[BARN EQ 1]N2
V199=VETLN
PARL=VSIOZ*-1
PTCT=ROUND[BARL-DROP/[PARL+FFA]]
G00X20.
Z5.0
N2
NEWB=0
V200=V200+1
IF[V200 GT PTCT]N3
T[TOOL*101]
X[DIA+1.5]Z-[PARL+.5]
G01 G94 X0. F200.
M84
G91Z[PARL+FFA]
G90
M83
G95
G0X20.
Z5.0
N3 IF[V200 LE PTCT]N4
M84
M00
(INSERT NEW BAR)
(NEED TO INSERT CHUCK STATE CHECK HERE)
G00 G96 M3 S1000 T[V199*101]
X[DIA+.1]Z-[PARL]M8
G1X-.01F.004
G0X[DIA+.1]M9
M5
X20.
Z5.0
BARN=1
V200=0
GOTO N1
N4
RTS