PDA

View Full Version : Rotary tool changer and Mach3



jkcab95
03-16-2017, 07:01 PM
Hello,

I am working on a D&M retrofit. I designed a 6 tool tool changer and am having trouble with the VB script macro. I am not sure if the problem is Mach3, the Pokeys57cnc board I am using or the fact that I am using Vista 32 bit. Below is my Macro:

'ToolChange Macro For Rotary type tool changer mounted to end of X axis
Sub Main()
OldTool = GetOEMDRO (1200) 'Tool In spindle DRO
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 = 6 'Max number off tools for the changer
ToolDown = -1.5 'Z Pos to Get or drop a tool
ToolUp = 0.0 'Z Hieght to Rapid from tool to tool
Yprep = 2.81 'Y pos for turret alignment
Xout = 2.0 'X pos to clear spindle for turret rotation
Xin = .095 'X pos for tool to clip for pickup
If NewTool = OldTool Then
Exit Sub
End If
While NewTool > MaxToolNum
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend
Code "G00 G53 Z" & ToolUp 'Moves spindle up to 0 for safe pos
While IsMoving()
Wend
Code "G53 Y" & Yprep 'Moves center of tool turret to centerline of spindle
Code "G4 P.5"
While IsMoving()
Wend
Code "G53 X" & Xout 'Moves X away from spinle sor turret rotation clearence
Code "G4 P.5"
While IsMoving()
Wend
Call MovePos(OldTool) 'Rotates turret to tool position from table below
While IsMoving()
Wend
Code "G53 Z" & ToolDown 'Brings spindle down
Code "G4 P.75"
While IsMoving()
Wend
Code "G53 X" & Xin 'Moves X tword spinle to clip tool
While IsMoving()
Wend
ActivateSignal(Output2) 'Turn On Draw bar to release the tool
Code "G4 P1.0" 'Wait for the tool to release
Code "G53 Z" & ToolUp 'Lift spindle to clear tool turret
Code "G4 P.5"
While IsMoving()
Wend
Call MovePos(NewTool) 'Rotate turret to new tool from table below
While IsMoving()
Wend
Code "G53 Z" & ToolDown 'Lowers spindle to pick up new tool
Code "G4 P.75"
While IsMoving()
Wend
DeActivateSignal(Output2) 'Turn Off Draw bar to Clamp the tool
Code "G4 P1.0" 'Wait for the tool to Clamp
While IsMoving()
Wend
Code "G53 X" & Xout 'Moves X away from spindle to un clip tool
While IsMoving()
Wend
Code "G53 Z" & ToolUp 'Moves spindle to 0 safe pos for move
While IsMoving()
Wend
Code "G53 A 0.0" 'Rotates turret to 0 park pos
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 = 1
APos = 86.25
Case Is = 2
APos = 122.25
Case Is = 3
APos = 158.25
Case Is = 4
APos = 194.25
Case Is = 5
Apos = 230.25
Case Is = 6
Apos = 266.25

End Select

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


The tool changer is a 6 tool rotary that is mounted on the end of the x axis. It has a nema 17 motor to rotate the tools and is configured as an angular axis with a 360 degree roll over. The sequence above is for the tool changer to move to the Y position after the z has gone to 0 in machine coordinates. Move x to 2 inches to clear the the spindle while the turret turns. Rotate the turret to the appropriate position. lower the spindle and then move the x position in to clip the tormach type tooling. Activate output 2 to release the air actuated draw bar and then move z back to 0 in machine coordinates. Move x back to 2 inches and Rotate tool changer to new tool and then lower z to pick up new tool. move x back in to clip tool. Deactivate output 2 to grip tool and then move x out to clear spindle. Raise z to 0 and move back to x and y position before the tool change.

This is the basic operation and the intention is to add auto z zero later and or possibly tool offset comp. The problem is the Macro shows no bugs and when I do a m6 tX call in MDI it moves to position but the rotary axis dose not turn. the other issue is upon completion of the tool change the y axis re-zeros at it's tool change location but not the x?

This project has been an overwhelming nightmare trying to integrate Mach3 with Pokeys57cnc. This is one of the many issues I have been having and am hoping someone can give me a clue what I am doing wrong while I continue with support on the other issues. I may post in another section of the form in regard to the other issues? I would like to include a photo of the tool changer here but am having difficulty figuring out how to attach it.

I have been told that Mach3 has too many glitches and I should upgrade to Mach4. I have two other machines that run flawlessly on Mach3 and have never experienced these issues before? However they are running on old XP machines with a parallel port. I tried to come into the 21st century and think I am now regretting it! The learning curve is steep and every step I take someone wants me to go deeper before I can get past the step I am on?

Please help as I am sure I am not the first to tread this path!

Thanks,

Jeff K.355306355308

ger21
03-16-2017, 07:53 PM
Call MovePos(NewTool) 'Rotate turret to new tool from table below
While IsMoving()
Wend

There's no command in your MovePos sub to rotate the A axis.

jkcab95
03-17-2017, 12:02 PM
Gerry,

Thanks so much for the reply. I had a "G53 G00 A" & APos in the sub at the bottom but it seemed it was not working so I deleted it. Turns out it was working but for some reason It was going at a default feed that was so slow it did not have enough torque to turn. I put it back with a G00 in front of the A and it worked great. I also added a G90 before the G53 in the first move and that fixed the incremental Y problem. I find that one confusing?

The interesting and frustrating thing is that it all works in a G code program but not from the MDI? If I type a m6 tX into the MDI it dose nothing and I loose keyboard and MPG jog? I can still move with G code commands in the MDI but no tool change. I have to shut down and restart Mach to get jog back.

Thanks again for the help,

Jeff

ger21
03-17-2017, 01:21 PM
Try T# M6 and see if it makes a difference?

jkcab95
04-08-2017, 04:40 PM
Well Pokeys is turning into a nightmare. I had lost communication and it has taken me this long to get it back! I am still having trouble with the index pulse but am continuing to work on that. As for the tool changer it was a no go trying the tool number first and then the M6 command. Do you possibly have any other suggestions? I am working on the front control panel and was going to add a tool change button with a six position selector. I had decided against it and figured I would just use the MDI. I am now re thinking the decision as I can not figure out why the MDI will not do the tool change?

CNC4XR7
05-20-2017, 04:13 PM
Well Pokeys is turning into a nightmare. I had lost communication and it has taken me this long to get it back! I am still having trouble with the index pulse but am continuing to work on that. As for the tool changer it was a no go trying the tool number first and then the M6 command. Do you possibly have any other suggestions? I am working on the front control panel and was going to add a tool change button with a six position selector. I had decided against it and figured I would just use the MDI. I am now re thinking the decision as I can not figure out why the MDI will not do the tool change?

Just ran across your thread did you ever get this working?
I recently built a Mach 3 Screen set for a guy with a half circle changer his was a 10 tool setup but could be easily changed.

www.CNC4XR7.com

stefan007
11-04-2018, 05:07 AM
Hello, if anyone can please help me?
I build myself a six station routery stepper tarret with a solinode for my lathe. I used the following VB Script, but gives me a syntext error. I did load it on Mach 3 as m1s file and VB Script, but still cannot operate. What am I doing wrong?

If GetSelectedTool() = GetCurrentTool() Then
End
End If


If GetSelectedTool = 1 Then
ActivateSignal(OutPut14)
Sleep 500
Code "G53 G0 A0"
While IsMoving()
Wend
DeActivateSignal(OutPut14)
End If


If GetSelectedTool = 2 Then
ActivateSignal(OutPut14)
Sleep 500
Code "G53 G0 A60"
While IsMoving()
Wend
DeActivateSignal(OutPut14)
End If



If GetSelectedTool = 3 Then
ActivateSignal(OutPut14)
Sleep 500
Code "G53 G0 A120"
While IsMoving()
Wend
DeActivateSignal(OutPut14)
End If


If GetSelectedTool = 4 Then
ActivateSignal(OutPut14)
Sleep 500
Code "G53 G0 A180"
While IsMoving()
Wend
DeActivateSignal(OutPut14)
End If


If GetSelectedTool = 5 Then
ActivateSignal(OutPut14)
Sleep 500
Code "G53 G0 A240"
While IsMoving()
Wend
DeActivateSignal(OutPut14)
End If



If GetSelectedTool = 6 Then
ActivateSignal(OutPut14)
Sleep 500
Code "G53 G0 A300"
While IsMoving()
Wend
DeActivateSignal(OutPut14)
End If