Hi this is the
script i am using
CODE: M3_ZZERO_PLT
' DESC: Mach3 Z-Plate, Z Zeroing Routine
'
' DATE: Tuesday, June 05, 2007
' AUTHOR: Todd M. Reith <todd@customluthier.com>
' VERSION: 1.5.0
' WEB:
http://www.customluthier.com'
' REQUIRES: MACH3 V2.0.075+
' K2-CNC SCREEN SET
' K2-CNC Z TOUCH PLATE w/ASSEMBLY
' K2-CNC CONTROL BOX w/Z TOUCH PLATE DIN
' PROBE ENABLED - PORT 1, PIN 15 INPUT - N.O.
'
' SUPPORT: K2 DEVICES, INC., 790 E. DEBRA LN, ANAHEIM, CA 92805
' WEB:
http://www.k2cnc.com'
' DECLARE USER DEFINED VALUES ==============================
' ==========================================================
' DO NOT CHANGE VALUES =====================================
' ==========================================================
Dim PlateThickness As Double
Dim ProbeFeed As Double
Dim ZaxisPullBack As Double
Dim MaxZaxisTravel As Double
Dim Debounce As Double
Dim CurrentFeed As Double
' USER DEFINED VALUES ======================================
PlateThickness = 0.062 'Z-plate thickness.
ProbeFeed = 10 'Probing feedrate.
ZaxisPullBack = .50 'Z axis retraction after zero
MaxZaxisTravel = 5.0 'Z axis full travel
Debounce = 2500 'Debounce (Each count is approc 40us in debounce)
' FIXED VALUES =============================================
CurrentFeed = GetOemDRO(818) 'Get the current feedrate.
' PROGRAM LOGIC=============================================
Response = MsgBox ("Ready to Z Zero?", 4 , "Auto Tool Zero")
If (Response = 6) Then 'User chose Yes
Code "M61P0000"
Code "G90 F" & ProbeFeed
Code "(CAUTION: Z axis is preparing to move.)"
Code "G4 P2" 'Pause.
If GetOemLed (825)=0 Then
Code "(Z axis is moving toward Z-plate.)"
Code "G4 P1" 'Pause
Code "G31Z-" & MaxZaxisTravel & " F" & ProbeFeed 'Straight probe Z
While IsMoving()
Wend
Code "G4 P0.25" 'Pause
ZProbePos = GetVar(2002)
Code "G0 Z" & ZProbePos
While IsMoving ()
Wend
Call SetDro (2, PlateThickness)
Sleep(200)
Code "G4 P0.5" 'Pause, DRO update
Code "G0 Z" & ZaxisPullBack 'Change the Z, Retract height
Code "(Z axis has been zeroed.)"
Code "F" & CurrentFeed 'Return to original feed rate
Else
Code "(Z-plate is grounded. Check connection and try again.)"
Response = MsgBox ("Z-plate is grounded. Check connection and try again.", 16 , "Auto Tool Zero")
Exit Sub
End If
Code "G4 P1" 'Pause
Code "M61P" & Debounce
Response = MsgBox ("Return to Work XY Zeros?", 4 , "Auto Tool Zero")
If (Response = 6) Then 'User chose Yes
Code "(Returning to Work Zeros.)"
Code "G4 P1" 'Pause
Code "G0 X0 Y0" 'Return to XY Zeros
End If
Else 'User chose No
Code "(Z axis routine terminated.)"
Code "M61P" & Debounce
End If
thanks