Originally Posted by
TH-CRAFTS
Hi. I have an issue with my ATC router.
I would be very grateful if someone can help me out.
I have been strugling with this for some time and I'm not (yet) capable of understanding the M6 script.
Background:
I use Fusion 360 for CAD/CAM and Mach3 to run my router.
I have set the G54 and every thing works fine till the tool change.
The M6 is activated and the tool is changed and then at the end of M6 the G54 is changed in Z!
It seems like something in the M6 script is taking the Z position of the machine exactly when it is leaving the tool change position and puts in that figure in to the G54 Z.
I provide the M6 script, can someone please have a look on it?
Regards Tomas
M6Start
'chengdu xhc technology ,all right reserved |
'please don't modify these code if you don't know what you doing |
'
Declare Function ChangeTool Lib ".\Plugins\NcEther-8ts" () As Integer
dim newtool
Dim XWork, YWork,ZWork
dim chanok
Sub Main
newtool=GetSelectedTool()
OldTool = GetOEMDRO (824)
If newtool = OldTool Then
Message"Tool No Change"
If Not FileName() = "No File Loaded." Then
ActivateSignal(Output6)
end if
Exit Sub
End If
DoSpinStop() 'stop spindle
SetUserDro(1384,newtool)
XWork = GetOEMDRO(800) ' Get Current X Work Coordinate
YWork = GetOEMDRO(801) ' Get Current Y Work Coordinate
ZWork = GetOEMDRO(802)
Call ChangeTool()
chanok=GetUserDro(1338)
If(chanok>2) Then
SetCurrentTool(newtool)
end if
SetUserDro(1338,1)
If Not FileName() = "No File Loaded." Then
ActivateSignal(Output6)
Sleep(100)
DoSpinCW()
'Code "G0 X" & XWork & " Y" & YWork
'Sleep(500)
'While IsMoving()
'sleep(50)
'Wend
Code"G0Z"& ZWork
Sleep(500)
While IsMoving()
sleep(50)
Wend
DoOEMButton(1000) ' Cycle Start
end if
End Sub
M6 End
REM The default script here moves the tool back to m6start if any movement has occured during the tool change..
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )
if(IsSafeZ() = 1) Then
SafeZ = GetSafeZ()
if SafeZ > z then StraightTraverse x, y,SafeZ, a, b, c
StraightFeed x, y, z , a, b, c
else
Code"G00 X" & x & "Y" & y
end if