Visualizza messaggio singolo
Vecchio 22 marzo 16, 09:06   #5 (permalink)  Top
carcan
User
 
L'avatar di carcan
 
Data registr.: 06-10-2008
Residenza: Brianza
Messaggi: 815
Io lo uso con un blocchetto alto 20mm quindi la riga "SetOEMDRO(ZaxisDRO, 20)" è da modificare con il valore di altezza del proprio blocchetto/interuttore


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 MachMsg dialog types
MachMsgTypeOK = 0
MachMsgTypeOKCancel = 1
MachMsgTypeAbortRetryIgnore = 2
MachMsgTypeYesNoCancel = 3
MachMsgTypeYesNo = 4
MachMsgTypeRetryCancel = 5
MachMsgTypeCancelTryAgainContinue = 6

' Define some constants for MachMsg return codes
MachMsgReturnOK = 1
MachMsgReturnCancel = 2
MachMsgReturnAbort = 3
MachMsgReturnRetry = 4
MachMsgReturnIgnore = 5
MachMsgReturnYes = 6
MachMsgReturnNo = 7
MachMsgReturnTryAgain = 10
MachMsgReturnContinue = 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 = MachMsg("Confirm Touch plate leads are connected and ready.","",4)
'ConfirmReady = MachMsgReturnYes Then GoTo 1 Else GoTo 5

1:
DoXY = MachMsg("Zero X and Y also?","",4)
If DoXY = MachMsgReturnYes 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)
Sleep 100
If IsSuchSignal (DIGITIZE) Then
code "G31 X-10 F10"
While IsMoving()
Sleep 100
Wend
'SetDRO(XaxisDRO, ToolDia/2)
SetOEMDRO(XaxisDRO, ToolDia/2)
Sleep 100
'code "G1 X.5"
code "G1 X" & ToolDia / 2 + 5 & " F500"
While IsMoving()
Sleep 100
Wend
End If

Message( "Auto Zeroing Y..." )
'SetDRO(YaxisDRO, 0.0000)
SetOEMDRO(YaxisDRO, 0.0000)
Sleep 100
If IsSuchSignal (DIGITIZE) Then
code "G31 Y-10 F10"
While IsMoving()
Sleep 100
Wend
'SetDRO(YaxisDRO, ToolDia/2)
SetOEMDRO(YaxisDRO, ToolDia/2)
Sleep 100
'code "G1 Y.5"
code "G1 Y" & ToolDia / 2 + 5 & " F500"
While IsMoving()
Sleep 100
Wend
End If

code "G1 X20 Y20 F500"

3:
DoZ = MachMsg("Position the touch plate to zero Z. y to continue or n to skip.","",4)
If DoZ = MachMsgReturnYes 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-30 F10"
While IsMoving()
Sleep 100
Wend
'SetDRO(ZaxisDRO, .180)
'SetOEMDRO(ZaxisDRO, .180)
SetOEMDRO(ZaxisDRO, 20)
Sleep 100
code "G1 Z25 F500"
While IsMoving()
Sleep 100
Wend
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
__________________
CNC Ideas
carcan non è collegato   Rispondi citando