Hello Guest it is April 29, 2024, 10:54:49 AM

Show Posts

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.


Messages - h_key

Pages: 1
1
VB and the development of wizards / toolchange macro 6 axis
« on: November 08, 2017, 10:03:51 PM »
 'run up on this a while back, file name M6Start.m1s , if you use 6 axis or not
 'ToolChange Macro For Bed type tool changer 11/05 Brian
Sub Main()
OldTool = GetOEMDRO (1200)           'Tool In spindle DRO, You must add this to each of your screen sets
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )
tool = GetSelectedTool()
NewTool = tool
'Tool Changer Macro (Bed Type)
MaxToolNum = 17                       'Max number of tools it will change, it will take upto 254 or so(not sure)
ToolDown   = -3.0                          'Z Pos to Get or drop a tool
ToolUp     = -10.0                    'Z Hieght to Rapid from tool to tool, you change this location
If NewTool = OldTool Then
   Exit Sub
End If
While NewTool > MaxToolNum
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)  'this won't ask if tool number is in your tooltable
Wend
Code "G00 G53 Z" & ToolUp
While IsMoving()
Wend
Call MovePos(OldTool)
While IsMoving()
Wend
Code "G53 Z" & ToolDown
Code "G4 P.75"
While IsMoving()
Wend
ActivateSignal(Output1)                           'Turn On Draw bar to release the tool
Code "G4 P1.0"                                    'Wait for the tool to release
'SystemWaitFor (7)                                'Wait for the tool Release Limit switch
Code "G53 Z-2.5" & ToolUp
Call MovePos(NewTool)
While IsMoving()
Wend
Code "G53 Z" & ToolDown
Code "G4 P.75"
While IsMoving()
Wend
DeActivateSignal(Output1)                             'Turn Off Draw bar to Clamp the tool
Code "G4 P1.0"                                        'Wait for the tool to Clamp
While IsMoving()
Wend
Code "G53 Z" & ToolUp
Call SetUserDRO (1200,NewTool)
SetCurrentTool( NewTool )
Code "G00 X" & x & " Y" & y                           'Move back to where the tool change was prompted
End Sub

Sub MovePos(ByVal ToolNumber As Integer)

Select Case ToolNumber
       Case Is = 0
       ActivateSignal(Output1)                           'Turn On Draw bar to release the tool
        ZPos = .50
       Case Is = 1
         Xpos = -15.00                      'this is where tool 1  is, change to fit your stuff
         YPos = .50
       Case Is = 2
         Xpos = -13.00
         YPos = .50                         'this is where tool 2  is, change to fit your stuff
       Case Is = 3
         Xpos = -11.00
         YPos = .50                            'you see how it works, add to this list
       Case Is = 4
         Xpos = -9.00
         YPos = .50
       Case Is = 5
         Xpos = -7.00
         YPos = .50
       Case Is = 6
         Xpos = -5.00
         YPos = .50
       Case Is = 7
         Xpos = -3.00
         YPos = .50
       Case Is = 8
         Xpos = -1.00
         YPos = .50
       Case Is = 9
         Xpos = 1.00
         YPos = .50
       Case Is = 10
         Xpos = 3.00
         YPos = .50
       Case Is = 11
         Xpos = 5.00
         YPos = .50
       Case Is = 12
         Xpos = 7.00
         YPos = .50
       Case Is = 13
         Xpos = 9.00
         YPos = .50
       Case Is = 14
         Xpos = 11.00
         YPos = .50
       Case Is = 15
         Xpos = 13.00
         YPos = .50
       Case Is = 16
         Xpos = 15.00
         YPos = .50
End Select

Code "G53 X" & XPos & " Y" & YPos
End Sub
Main   


Pages: 1