Hello Guest it is October 25, 2021, 03:06:18 AM

Author Topic: ATC won't move to safe position  (Read 885 times)

0 Members and 1 Guest are viewing this topic.

ATC won't move to safe position
« on: June 14, 2017, 05:00:37 AM »
I am using a macro from this site to work my ATC and I seem to be able to reliably change the tools using the T commands. The problem is that although the macro seems to show code to move the X&Y axis to a safe position nothing seems to happen. Could someone offer up any reasons to why this isn't happening?

I have cut and pasted the macro in it's entirety below.


'This macro drives an 8 position stepper driven ATC.
'It drives forward past a ratchet, then backwards a little to stall the motor
'The Y axis is setup for 20 steps per mm, my ATC requires 900 steps per index
'of 45 degrees.
'Because of the stall, steps are lost. So, we switch to INC mode for the ATC,
'then back to ABS mode before we exit.

'OEMDRO(1200) is utilized to store the last used tool (OldTool) and is updated
'upon final execution of the macro. This is resorted to as the Txxyy will overwrite
'the "CurrentTool" DRO.
'The Y axis is zeroed if tool is Number1, to prevent an overflow of the DRO after
'multiple changes.

Message ("macro running")

OldTool = GetOEMDRO (1200)
Tool = GetSelectedTool()
MaxToolNum = 8 'Max number of tools for the changer

If OldTool = Tool Then
Message ("Selected Tool already loaded")
Exit Sub
End If

While Tool > MaxToolNum
Tool = Question ("Enter New Tool Number up to " & MaxToolNum)

xval= getoemdro(800)   'get x
zval= getoemdro(802)   'get z
Call Dooembutton(138)
While IsMoving()

moveto = Tool- OldTool

If moveto<1 Then moveto=8+moveto

code "G91"   'inc mode

code "G00 Y"+Str((moveto*45)+5)
While IsMoving()

code "G00 Y-5"
While IsMoving()

code "G01 Y-2 F100"
While IsMoving()

code "G90"   'abs mode

If NewTool=1 Then
Call DoOemButton (1009)      'zero Y
End If

Call SetUserDRO (1200, NewTool)
code "G0 Z"+Str(zval)      'return to initial position
code "G0 X"+Str(xval)      'before tool change
While IsMoving()
« Last Edit: June 14, 2017, 05:03:26 AM by jetrebel »