10
« on: October 11, 2009, 09:39:29 AM »
Hi to all,
I have this macro (writen by Graham I think):
' Boxford 160TCL Toolchanger Macro.
'
' Works by turning CW to just past the tool position
' and then CCW into a stop.
' Axis setup as rotary e.g. move 360 = 1 full turn.
If IsLoading() Then
' Do Nothing, program loading
Else
' Dim Variables
Dim Num_Tools As Integer
Dim CW_Steps_Per_Tool As Integer
Dim CCW_Steps As Integer
Dim HoldingDRO As Integer
Dim Requested_Tool As Integer
Dim Current_Tool As Integer
Dim CW_Feed As Integer
Dim CCW_Feed As Integer
Dim moves As Integer
Dim total_move As Integer
' set up some vars
Num_Tools = 6
CW_Move_Per_Tool = 360/Num_Tools
CCW_Move = 10
HoldingDRO = 1050
Requested_Tool = GetSelectedTool()
Current_Tool = GetUserDRO(HoldingDRO)
CW_Feed = 1500
CCW_Feed = 1000
Current_Feed = GetOEMDRO(818)
' start tool change
Message ("Requested Tool No=" & Requested_Tool)
If Requested_Tool > Num_Tools Then
Message "Requested Tool No. too high, program stopped."
Code "M30"
End
End If
If Requested_Tool < 1 Then
'Message "Requested Tool No. too low, program stopped."
Code "M30"
End
End If
If Requested_Tool = Current_Tool Then
' do nothing
Else
' lets do some changing
If Requested_Tool > Current_Tool Then moves = Requested_Tool -Current_Tool
If Requested_Tool < Current_Tool Then moves = Num_Tools - Current_Tool +Requested_Tool
total_move = (moves * CW_Move_Per_Tool)+(CCW_Move/2)
Code "G0 z-10 F1300"
Code "G0 x-10"
Code "G91 G94" 'incremental & Feed per minute
Code "G0 A" & total_move '& "F" & CW_Feed
Code "G0 A" & "-" & CCW_Move '& "F" & CCW_Feed
While IsMoving()
Wend
SetCurrentTool Requested_Tool
SetUserDRO HoldingDRO, Requested_Tool
Code "G90" ' back to absolute movement
Code "F" & Current_Feed
End If
End If
' end of tool change
I need to put a A DRO on my lathe screen to see if my A axis is running. I don't have anything connects yet. I just want a simulation.
How can I do that?
RGDS
Gabi