971
FAQs / Re: Probing from the same place
« on: April 04, 2020, 03:07:35 AM »
if have cleared up the code a Little bit and made some safety checks
it is not tested, just written down.
but i think in your case it will not do what you want to do, but you can test it and see.
this code will set the z-axis Zero allways to the top of your measuring knob, but i guess you want
to set it to your actual workpiece surface.
Code: [Select]
Sub Main()
Dim Zprobe, Zretract, ZfeedRate
Dim PlateX, PlateY
'Note: TouchPlateHeight represents the actual height of the
' Auto Z Touch Plate from the work surface.
' Minor adjustments can be made for calibration purposes (use caution)
'set all parameters in metric
TouchPlateHeight = 30
Zprobe = -50
Zretract = 20
ZfeedRate = 10
PlateX = 10
PlateY = 10
Message( "Auto Tool Zeroing..." )
'check probe allready active
If GetOEMLed(825) Then
MSGBox "Probe allready activ",vbOK + vbCritical ,"Fault !"
DoButton(21)
End
End If
' go to probe position
Code "G53 G0 X" & PlateX & " Y" & PlateY
'clear z-pos
Call SetDRO( 2, 0.00 )
'do the probing
code "G31 Z" & Zprobe & " F" & ZfeedRate
While IsMoving()
Wend
'test for max trave
If GetVar(2002) <= Zprobe + 0.5 Then
MsgBox "no probe hit!",vbOK + vbCritical ,"Fault !"
End
Else
'move to contact point due overrun
Code "G90 G0 Z" &GetVar(2002)
While IsMoving()
Wend
'set z axis height
Call SetDRO( 2, TouchPlateHeight )
'go to retract position
code "G1 Z" & Zretract & "F20"
End If
'clear status line
Message " "
End Sub
it is not tested, just written down.
but i think in your case it will not do what you want to do, but you can test it and see.
this code will set the z-axis Zero allways to the top of your measuring knob, but i guess you want
to set it to your actual workpiece surface.