Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: keithmech on December 17, 2008, 03:52:49 PM
-
I have been trying to implement a rotary tool changer,it is rotated with a stepper motor
and I have it set as the "a"axis.I can enter a goa# on the mdi line and the turret works.
I found that a value of 1.64375 X tool # and it will rotate to that tool.Now I want to do it
with a brain or with a vb macro as below I must have something wrong
with this as I cannot get it to work!.I would rather use a brain as I would like to add
funcionality to my machines as I go.My turret is simple
-a pneumatic cylinder holds a lock closed, release with a signal
-read input from limit switch, to indicate lock is released,
- rotate turret and reclamp
-read lose of input from limit switch to indicate all is good.If IsLoading() Then
' do now't, program loading
Else
' dim some vars
Dim next_tool As Integer
Dim current_tool As Integer
Dim steps_per_tool As Integer
Dim max_tools As Integer
Dim holdingDRO As Integer
Dim rotateCW As Integer
Dim moves As Integer
Dim axis As String
Dim zero As Integer
' set up some vars
zero = 0
axis = a ' change to what ever axis you use for tool changer
rotateCW = 0 ' set to 1 for CCW and 0 for CW rotation
max_tools = 8 ' number of tools on turret
steps_per_tool= 1.64375 ' set to what ever it needs to be
holdingDRO=1050 ' or what ever you have set screen dro to
next_tool = GetSelectedTool()
current_tool = GetUserDRO(holdingDRO)
' do some tool changing
If next_tool > max_tools Then
Message "Tool number too high, program stopped."
Code "M30"
End
End If
If next_tool<1 Then
Message "Tool number too low, program stopped."
Code "M30"
End
End If
If next_tool=current_tool Then
' do nowt, we got it already
Else
' lets do some changing
If next_tool>current_tool Then moves=next_tool-current_tool
If next_tool<current_tool Then moves=max_tools-current_tool+next_tool
If rotateCW =1 Then
rapid_move = zero - rapid_move
End If
Code "G92 " & axis & "0"
Code "G91 G94 G61"
Code "G01 " & axis & rapid_move & "F" & fast_feed
While IsMoving()
Wend
Code "G01 " & axis "F" While IsMoving()
Wend
SetCurrentTool next_tool
SetUserDRO holdingDRO, next_tool
Code "G90" ' back to absolute movement
End If
End If
' end of tool change
-
Here is a repost of the M6 for a turret lathe with Paul-pin I posted up a while back:
Sub Main()
NumSlots=8
OldTurretPos=(GetOEMDRO(805))
OldToolSlot=Abs(GetOEMDRO(805)/45)
NextTool = GetSelectedTool()
NextToolSlot = (NextTool-1)*360/NumSlots
If OldToolSlot = NextToolSlot Then
SetCurrentTool(NextTool)
Exit Sub
End If
If NextTool>8 Or NextTool<1 Then
Message("Next Tool out of range")
Exit Sub
End If
MoveDis = (NextToolSlot-OldTurretPos)
If Abs(MoveDis) >180 Then
If MoveDis < 0 Then
MoveDis = 360 + MoveDis
Else
MoveDis = MoveDis - 360
End If
End If
ActivateSignal(OUTPUT3) 'Release Turret holding pin
Code "G4 P0.5"
While IsMoving ()
Wend
Code "G00 G91 C" & MoveDis
While IsMoving ()
Wend
DeActivateSignal(OUTPUT3) 'Engage Turret holding pin
SetCurrentTool(NextTool)
Code "G90"
End Sub
'scott
-
thanks poppa.I had to tweek it a bit but the tool change is working away nicely :)
Now on to my more involved tool changer.This one I think will have to
run thru the plc .It is on my mazak miil, 24 pockets, 5 proximity sensors to give an absolute position
lots of io for the tool swap arm and spindle orientate.
-
Keith, got any pics of the toolchanger on the Mazak? I will be making one for my Beaver mill at some point and I am looking for ideas on the best type to use, a carousel would be the easiest but would like to be able to load the next tool in the arm ready for action :)
Hood
-
Hood here are some pictues of the tool changer
-
Thanks Keith, much appreciated.
Hood