ThreadTracer for GibbsCAM
header_logo
ThreadTracer
Home Features Documentation Media Updates Download Purchase
Additional

MillTracer
MillBlunt

Resellers
Contact

GIbbsCAM Macros

Understood
This website is using cookies for analyzing webtraffic with Google Analytics. More details

Fanuc macros for moving tailstock and steadyrest with M code


Having worked on several Doosan Puma's with a manual tailstock / steadyrest, I wanted a way to program and move these in GibbsCAM.
Below are Fanuc macros I wrote that will move tailstock and streadyrest with an M code.

These macros will move tailstock and steadyrest relative to the current G54 workoffset for Z
Issuing command for moving tailstock to Z50, will use turret to move tailstock to Z50 (using G54 workoffset)
These custom macros converts operator typed Z values into machine coordinates, making it easier to program tailstock moves in GibbsCAM.


I have installed these macros on :
DOOSAN Puma 700 machines with manual tailstock and steadyrest (uses turret to move around).
MAZAK QUICK TURN NEXUS 450-II MY LBB with controlled tailstock and steadyrest. (adapted to mazak controller)

If you need help installing these macros, write an email to catohagen@fastmail.fm and i'll try to help.

These are written as "Fanuc Macro B" macros and are the most common Macro Programming Dialect.






Custom macros like this needs to be installed into the controller as an M code.
I've used M500 for moving the tailstock and M501 for moving the steadyrest.

Parameter 6085 - M code that calls the custom macro of program number 9025
Parameter 6086 - M code that calls the custom macro of program number 9026

To set these commands, set parameter 6085 to 500 and 6086 to 501

Getting arguments from an Mcode on Fanuc controllers

Fanuc arguments are done with internal variables and are handled by the controller.
For example : A=#1 B=#2 C=#3 etc...X=#24 Y=#25 Z=#26
As we want to move the tailstock and steadyrest along the Z axis, the variable used are #26 (letter Z).

So issuing a command like : "M500 Z100" will set variable #26 to 100 and run the macro.


Explanation of the stored variables #500 and up (5xx variable numbers are stored in nvram and remembered in controller after poweroff)
#500 = current machine position of the tailstock
#501 = current machine position of the steadyrest
#502 = allowed distance between tailstock and steadyrest

#512 = distance to compensate for pin movement in tailstock pickup
#513 = distance to compensate for pin movement in steadyrest pickup
This distances are stored to prevent pin rubbing against pickup slot when moving pin up for pickup

#514 = offset distance to add to tailstock Z value to match face to Z0
#515 = offset distance to subtract to steadyrest Z value to match arm to Z0

fanuc variables

Running the tailstock macro does the following:
   Type "M500 Z50" in MDI
1. Clears tooloffset with T0000 and moves turret up (home X/Y axes)
2. calculate new Z tailstock position in machine coordinate value
3. calculate closest allowed tailstock position compared to stored steadyrest position
4. check if new tailstock position will collide with current stored steadyrest position
-if new tailstock position is safe, then allow move
-if new tailstock position is not safe, move to calculated position from step 3
5. move turret to current tailstock position to pick up tailstock
6. run the M code command to move the pin up and attach tailstock to the turret
7. move turret and tailstock to the new position (Z50)
8. run the M code command to retract the pin and release the tailstock from turret
9. store the new tailstock position into variable #500


Fanuc Macro for moving tailstock (save as O9025 in fanuc controller)
    
%
O9025(M500 TAILSTOCK POSITIONING V1.1) 
(Written by catohagen@fastmail.fm)
 
#3003=1
(NO ALARM) 

IF[#26EQ#0]THEN#26=200
(IF ONLY M500 is entered, tailstock will goto +Z200 as safety) 
#100=[#26+#514]
(PUT NEW POS INTO #100)
 
#102=[#100+#5222]-#501 
(#102=NEW TAILSTOCK POS - CURRENT STEADYREST POS) 
 
#110=[[#501+#502]-#5222] 
(IF[#102LT0]THEN#102=[-#102])
IF[#102GT#502]GOTO100(OK MOVE) 
IF[#102LE#502]THEN#100=#110
(If new tailstock position will crash with steadyrest)
(calculate and move to closest postion possible )

GOTO100
 
N100 
#120=#4120 
T0000
G30U0.V0.
IF[#512EQ#0]THEN#512=0 
G0Z[[#500-#5222]+#512](PICK UP TAILSTOCK)
M46(PIN UP)
#105=#5022 
(CURRENT TURRET MACHINE POS) 
#103=#5222 
(G54 WORKZERO OFFS)
 
#106=#100+#103 
(NEW TAILSTOCK MACHINE POS)
 
IF[#105LT#106]THEN#107=-1
(DIRECTION OF CLEARANCE FOR NEXT PICK UP)
IF[#105GT#106]THEN#107=1 
IF[#105EQ#106]THEN#107=0 
 
#512=#107
(SAVE DIRECTION FOR SLACK ADJUSTMENT)
 
G0Z#100
(GOTO DEST POS)
G0Z[#100+#512] 
(ADJUST FOR SLACK OF GRIP) 
#500=#100+#5222(SAVE NEW POS)
M47(PIN DOWN)
 
GOTO300
 
N200 
 
N300 
T[#120]
#3003=0
M99
%
    
  
Fanuc Macro for moving steadyrest (save as O9026 in fanuc controller)
    
%
O9026(M501 STEADYREST POSITIONING V1.1)
(Written by catohagen@fastmail.fm)
 
#3003=1
(NO ALARM) 

#101=#26-#515
(PUT NEW POS INTO #101)
 
#102=[#101+#5222]-#500
(NEW STEADYREST POS - CURRENT TAILSTOCK POS)
#110=[FUP[#500-#502]-#5222]
 
IF[#102LT0]THEN#102=[-#102]
IF[#101GT#110]THEN#101=#110
IF[#102GT#502]GOTO100(OK MOVE) 
IF[#102LE#502]THEN#101=#110
(If new steadyrest position will crash with tailstock)
(calculate and move to closest postion possible )

GOTO100
 
N100 
 
#120=#4120 
T0000
G30U0.V0.
IF[#513EQ#0]THEN#513=0 
G0Z[#501-#5222](PICK UP STEADYREST)
M224(PIN UP) 
#105=#5022 
(CURRENT TURRET MACHINE POS) 
#103=#5222 
(G54 WORKZERO OFFS)
 
#106=#101+#103 
(NEW STEADYREST MACHINE POS) 
 
IF[#105LT#106]THEN#107=-1
(DIRECTION OF CLEARANCE FOR NEXT PICK UP)
IF[#105GT#106]THEN#107=1 
IF[#105EQ#106]THEN#107=0 
 
#513=#107
(SAVE DIRECTION FOR SLACK ADJUSTMENT)
 
G0Z#101
(GOTO DEST POS)
G0Z[#101+#513] 
(ADJUST FOR SLACK OF GRIP) 
#501=#101+#5222(SAVE NEW POS)
M225(PIN DOWN) 
 
GOTO300
 
N200 
 
N300 
T[#120]
#3003=0
M99
%
    
  

Using custom Fanuc macros with Utility Ops in GibbsCAM

fanuc variables

fanuc variables

fanuc variables


In order for the post processor to know the utility operations, the post need some functions added.

GibbsCAM Post Processor edits, should be added in utilCore:
    
	{Utility operations for tailstock and steadyrest by catohagen@fastmail.fm}
	IF OpType?('UtiltailStockMoveTo')
		SeqLab ' ' EOL
		'M500 Z'OpFieldDataX#('PosZ')' (MOVE TAILSTOCK)' eol
		'M1'
	END

	IF OpType?('UtilsteadyRestMoveTo')
		SeqLab ' ' EOL
		'M501 Z'OpFieldDataX#('PosZ')' (MOVE STEADYREST)' eol
		'M1'
	END

	IF OpType?('UtiltailStockAdvance') 
		SeqLab ' ' EOL
		tailStockAdvance
	END
	IF OpType?('UtiltailStockRetract')
		SeqLab ' ' EOL
		tailStockRetract
	END


	IF OpType?('UtilsteadyRestArmsOpen')
		SeqLab ' ' EOL
		steadyRestArmsOpen
     
	END
	IF OpType?('UtilsteadyRestArmsClose')
		SeqLab ' ' EOL
		steadyRestArmsClose
	END

    
  

You can copy and paste the macros from above, or download them here :
Download Click here -> Fanuc-macros.zip     ( 34 downloads )

Download PUMA_Utility_Templates.zip for GibbsCAM Click here -> PUMA_Utility_Templates.zip     ( 27 downloads )