941
General Mach Discussion / Re: Setup and Control issue
« on: May 06, 2020, 03:22:07 PM »
pls post your Profile XML. to have a look.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Sub Main()
If GetOEMLED(804) Then ' is run
If IsActive(INPUT1)And (GetLed(116) = true) Then
DoOemButton(1004) ' 1004 DoOemButton stop
End If
End If
End Sub
Dim Num_Tools As Integer
Dim Ang_Move As Integer
Dim Req_Tool As Integer
Dim Current_Tool As Integer
Dim Lock_Move As Integer
Dim CW_Feed As Integer
Dim CCW_Feed As Integer
Dim Moves As Integer
Num_Tools = 12 'number of tools on turret
Ang_Move = 360/Num_Tools 'angular rotation per tool
Req_Tool = GetSelectedTool()
Current_Tool = GetCurrentTool()
Lock_Move = 15 'distance to move back onto paw to lock
CW_Feed = 100
CCW_Feed = 50
'Start tool change
If Req_Tool < 1 Then
Message"Tool number too low"
Code "M30"
End If
If Req_Tool = Current_Tool Then
'do nothing
Else
'do tool change
If Req_Tool > Current_Tool Then
Moves = (Req_Tool - Current_Tool) * Ang_Move
End If
If Req_Tool < Current_Tool Then
Moves = (Num_Tools - Current_Tool + Req_Tool) * Ang_Move
End If
End If
'move to safe position
Code "G0 G53 X-.25 Z-.25"
Code "G04 P0.5"
'index turret
Code "G91 G94"
Code "G01 A" & Moves + 10 & "F" & CW_Feed
Code "G01 A-" & Lock_Move & "F" & CCW_Feed
While IsMoving()
Sleep(10)
Wend
SetCurrentTool Req_Tool
SetUserDRO 1500 , Req_tool
Code "G90"
Code "F" & Current_Feed
GageH = 15.0 'OEMDRO(1001)=Gage Block Height