Hello Guest it is March 28, 2024, 08:33:55 AM

Author Topic: Would like to add in a certain path for toolchange to run. Need Help  (Read 7853 times)

0 Members and 1 Guest are viewing this topic.

Re: Would like to add in a certain path for toolchange to run. Need Help
« Reply #10 on: March 17, 2012, 11:12:27 AM »
Got it to work thank you so much Gerry.

Here it is for anyone else to use.
'ToolChange Macro For Bed type tool changer 11/05 Brian
Sub Main()
OldTool = GetOEMDRO (1200) 'Tool In spindle DRO You must add this to your settings screen
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 = 8      'Max number off tools for the changer
ToolDown   = -3.125 'Z Pos to Get or drop a tool
ToolUp     = 0.0    'Z Hieght to Rapid from tool to tool
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
While IsMoving()
Wend
Code "G00 G53 X0"
While IsMoving()
Wend
Code "G00 G53 Y4"
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" & ToolUp
While IsMoving()
Wend
Code "G53 Y4"
While IsMoving
Wend
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
While IsMoving()
Wend
Code "G53 Y4"
While IsMoving()
Wend
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
         Xpos = 12.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend
       Case Is = 2
         Xpos = 14.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend
       Case Is = 3
         Xpos = 16.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend
       Case Is = 4
         Xpos = 18.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend
       Case Is = 5
         Xpos = 12.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend
       Case Is = 6
         Xpos = 14.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend
       Case Is = 7
         Xpos = 16.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend
       Case Is = 8
         Xpos = 18.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend

End Select

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

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Would like to add in a certain path for toolchange to run. Need Help
« Reply #11 on: March 17, 2012, 11:19:23 AM »
You can delete all the red lines if you change the blue as shown"

Select Case ToolNumber
       Case Is = 1
         Xpos = 12.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend

       Case Is = 2
         Xpos = 14.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend

       Case Is = 3
         Xpos = 16.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend

       Case Is = 4
         Xpos = 18.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend

       Case Is = 5
         Xpos = 12.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend

       Case Is = 6
         Xpos = 14.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend

       Case Is = 7
         Xpos = 16.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend

       Case Is = 8
         Xpos = 18.00
         YPos = 2.00
         Code" G53 X" & XPos
         While IsMoving()
         Wend
         Code" G53 Y" & Ypos
         While IsMoving()
         Wend


End Select

Code "G53 X" & XPos
While IsMoving()
Wend

Code "G53 Y" & YPos
While IsMoving()
Wend

End Sub
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Would like to add in a certain path for toolchange to run. Need Help
« Reply #12 on: March 17, 2012, 11:58:36 AM »
excellent
Re: Would like to add in a certain path for toolchange to run. Need Help
« Reply #13 on: March 19, 2012, 08:39:05 AM »
On the first codes

Code "G53 X0"

and

Code "G53 Y9"

What do I need to put in front of them in order for it to be in machine coordinates and not work coordinates.

Thanks

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Would like to add in a certain path for toolchange to run. Need Help
« Reply #14 on: March 19, 2012, 09:31:10 AM »
G53 is machine coords.
Hood
Re: Would like to add in a certain path for toolchange to run. Need Help
« Reply #15 on: March 19, 2012, 10:07:48 AM »
Thanks Hood.

I left it out and had it on the other ones. :D