I found video in which guy is talking about offsets
https://youtu.be/Xyjg6k-NWaQ?t=11m8s
So there is difference between cnc lathe and cnc mill wise g code commands
Manage to re edit my macro for tool changer, now when I enter T0909 is has same effect as G49 (I activate coordinate system of master tool or in other words coordinate system with no offsets), problem was to make that turret does not rotate on T0909 and that for upcoming tool command I can get same tool in reality as in mach3. So in mach3 turn tool table tool 9 have zero as value for x and z offset , same as my tool 1 which is master tool.
Also found new errors in post processor and after few days of analyzing existing post processors for other controllers (Siemens ...) I mange to found on which place I need to make changes to post processor outputs g code according to options chosen in CAM interface.
So , about macro for my tool changer, after lot of experimenting I conclude that only possibility is to save permanently information that I get about tool number, is to save them in file, off course that was idea but I did not know how to do that, so luckily I mange to find site on which I found example with using file , how to create it and how to read from it Mach3_VB
Now how macro for tool changer is written I need first to initialize it with executing this part of g code (I assigned it to button in mach as initialize ATC):
CurrentFeedrate = GetOemDRO(818)
Code"G90 G94"
Code "G91G01 Y1.251 F200"
While IsMoving()
sleep(50)
Wend
Code "G91G01 Y-0.201 F20"
While IsMoving()
sleep(50)
Wend
Code " G90 "
Code "F" & CurrentFeedrate
And after that I need to select tool number 1 , probably it looks complicated but I can live with that for know
And this is m6start macro:
Sub main ()
Dim OldTool,NewTool,a,b As Integer
CurrentFeedrate = GetOemDRO(818)
Code"G90 G94"
Message "OldTool NewTool " &GetCurrentTool () &GetSelectedTool ()
OldTool=GetCurrentTool()
NewTool=GetSelectedTool()
SetCurrentTool(NewTool)
If NewTool=9 Then
a=0
Open "C:\Mach3\myFile.txt" For Output As #1
b=OldTool
Print #1, b
Close #1
End If
If NewTool <9 And OldTool =0 Then
a=0
End If
If NewTool <9 And OldTool <9 And OldTool >0 Then
a=NewTool - OldTool
End If
If NewTool <9 And OldTool =9 Then
Open "C:\Mach3\myFile.txt" For Input As #2
Line Input #2, b
a=NewTool-b
End If
If (a = 1) Or (a = -7) Then
Code "G91G01 Y1.251 F200"
While IsMoving()
sleep(50)
Wend
Code "G91G01 Y-0.201 F20"
While IsMoving()
sleep(50)
Wend
End If
If (a = 2) Or (a = -6) Then
Code "G91G01 Y2.301 F200"
While IsMoving()
sleep(50)
Wend
Code "G91G01 Y -0.201 F20"
While IsMoving()
sleep(50)
Wend
End If
If (a =3) Or (a = -5) Then
Code "G91G01 Y3.351 F200"
While IsMoving()
sleep(50)
Wend
Code "G91G01 Y -0.201 F20"
While IsMoving()
sleep(50)
Wend
End If
If (a =4) Or (a = -4) Then
Code "G91G01 Y4.401 F200"
While IsMoving()
sleep(50)
Wend
Code "G91G01 Y -0.201 F20"
While IsMoving()
sleep(50)
Wend
End If
If (a =5) Or (a = -3) Then
Code "G91G01 Y5.451 F200"
While IsMoving()
sleep(50)
Wend
Code "G91G01 Y -0.201 F20"
While IsMoving()
sleep(50)
Wend
End If
If (a =6) Or (a = -2) Then
Code "G91G01 Y6.501 F200"
While IsMoving()
sleep(50)
Wend
Code "G91G01 Y -0.201 F20"
While IsMoving()
sleep(50)
Wend
End If
If (a =7) Or (a = -1) Then
Code "G91G01 Y7.551 F200"
While IsMoving()
sleep(50)
Wend
Code "G91G01 Y -0.201 F20"
While IsMoving()
sleep(50)
Wend
End If
Code " G90 "
Code "F" & CurrentFeedrate
End Sub