Aşağıdaki kodu, mach3 proğramında "operator>edit button script>autp tool zero" sırasıyla seçip açılan pencereye yapıştırıyoruz. İlk denemeyi tanziri olarak yapmanızda fayda var, benim eski bilgisayarda yaptığım denemelerde bazı adımları atlıyordu, mach3 ile driver test yaptığımda bilgisayarda driver sorunu veriyordu, bilgisayarı değiştirince driver test çok iyi sonuç verdi ve script sorunsuz çalıştı, bu nedenle once havada bir çalıştırın bence.
Sub Main()
Dim ConfirmReady As String
Dim DoXY As String
Dim DoZ As String
Dim XaxisDRO As Integer
Dim YaxisDRO As Integer
Dim ZaxisDRO As Integer
Dim ToolDia As Double
' Define some constants for AskTextQuestion dialog types
AskTextQuestionTypeOK = 0
AskTextQuestionTypeOKCancel = 1
AskTextQuestionTypeAbortRetryIgnore = 2
AskTextQuestionTypeYesNoCancel = 3
AskTextQuestionTypeYesNo = 4
AskTextQuestionTypeRetryCancel = 5
AskTextQuestionTypeCancelTryAgainContinue = 6
' Define some constants for AskTextQuestion return codes
AskTextQuestionReturnOK = 1
AskTextQuestionReturnCancel = 2
AskTextQuestionReturnAbort = 3
AskTextQuestionReturnRetry = 4
AskTextQuestionReturnIgnore = 5
skTextQuestionReturnTryAgain = 6
AskTextQuestionReturnNo = 7
AskTextQuestionReturnTryAgain = 10
AskTextQuestionReturnContinue = 11
' notice the SetDRO() command use single digit value for xyzabc
' uncomment for the correct version
XaxisDRO=0
YaxisDRO=1
ZaxisDRO=2
' notice the SetOEMDRO() command uses three digit values for xyzabc
' uncomment for the correct version
' XaxisDRO=800
' YaxisDRO=801
' ZaxisDRO=802
ConfirmReady = AskTextQuestion("Confirm Touch plate leads are connected and ready.(y/n)")
If ConfirmReady = "y" Then GoTo 1 Else GoTo 5
1:
DoXY = AskTextQuestion("Zero X and Y also?(y/n)")
If DoXY = "y" Then GoTo 2 Else GoTo 3
2:
ToolDia = Question("What is the tool diameter?")
Message( "Auto Zeroing X..." )
SetDRO(XaxisDRO, 0.0000)
'SetOEMDRO(XaxisDRO, 0.0000)
SetDRO(YaxisDRO, 0.0000)
'SetOEMDRO(YaxisDRO, 0.0000)
SetDRO(ZaxisDRO, 0.0000)
'SetOEMDRO(ZaxisDRO, 0.0000)
Sleep 200
If IsSuchSignal (DIGITIZE) Then
code "G31 X15 F200"
While IsMoving()
Sleep 100
Wend
SetDRO(XaxisDRO, 0-ToolDia/2)
'SetOEMDRO(XaxisDRO, 0-ToolDia/2)
Sleep 100
code "G1 Z10 F300"
code "G1 X25, Y-25 F1000"
code "G1 Z0 F300"
End If
Message( "Auto Zeroing Y..." )
SetDRO(YaxisDRO, 0.0000)
'SetOEMDRO(YaxisDRO, 0.0000)
Sleep 100
If IsSuchSignal (DIGITIZE) Then
code "G31 Y25 F200"
While IsMoving()
Sleep 100
Wend
SetDRO(YaxisDRO, ToolDia/2)
'SetOEMDRO(YaxisDRO, 0-ToolDia/2)
Sleep 100
code "G1 Z10 F300"
code "G1 X25, Y25 F1000"
End If
3:
DoZ = AskTextQuestion("Position the touch plate to zero Z. y to continue or n to skip.(y/n)")
If DoZ = "y" Then GoTo 4 Else GoTo 6
4:
Message( "Auto Zeroing Z..." )
SetDRO(ZaxisDRO, 0.0000)
'SetOEMDRO(ZaxisDRO, 0.0000)
Sleep 100
If IsSuchSignal (DIGITIZE) Then
code "G31 Z-15 F150"
While IsMoving()
Sleep 100
Wend
SetDRO(ZaxisDRO, 5.1) "BURADA 5.1 DEĞERİNİ KENDİ PLAKA YÜKSEKLİĞİMİZE GÖRE DEĞİŞTİRİYORUZ" (change plate thichkness with your own)
'SetOEMDRO(ZaxisDRO, 5.1)
Sleep 100
code "G1 Z10 F300"
End If
GoTo 6
5:
Message ("Tool zeroing aborted. Try again when ready.")
GoTo 7
6:
Message "Tool zeroing complete. Check the results on the DROs."
7:
End Sub