Hello Guest it is April 16, 2021, 09:50:53 PM

Author Topic: G31 Probe  (Read 2637 times)

0 Members and 1 Guest are viewing this topic.

G31 Probe
« on: February 12, 2012, 04:10:26 PM »
Whilst I appreciate that there are plenty of threads relating to this subject, I find that most of them go into too much detail.

I need a simple macro to use with my Touch Plate which is connected to pin 15 and functioning correctly.  Below is the usual code that I have tried with my system.  It works OK but I need to take it further

Code "G0 X31.5 Y30.2.         // Position above touch plate
Code "G31 Z-50 F10".           // Slow until touch plate is found
While IsMoving()
code "G92 Z0"                       // Zero Z axis
code "G0 Z10"                       // Not sure if the rest is correct ??
While IsMoving()
code "G92 Z0"

Basically, I need the system to measure the length of Tool selected.  The bit I'm stuck with is what happens after the touch plate is found...I assume it needs to move back to the Home position and the length of tool will be known.  

I do have an ATC with six tools, but if anyone can help in adapting the above code so that it works on its own for now, that would be great.

« Last Edit: February 12, 2012, 04:13:43 PM by krsykes23 »
Re: G31 Probe
« Reply #1 on: February 12, 2012, 04:35:09 PM »
This is what I use.  Original version was in Digital Machinist Magazine - forgot the author's name.

' Version #1
PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO
If PlateThickness <=0 Then ' is plate thickness set?
Code "(Plate Thickness Not Set)"
Exit Sub
End If 
If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P1" ' this delay gives me time to get from computer to hold probe in place
Code "G31 Z-1 F10" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
ZProbePos = GetVar(2002) 'get the axact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Call SetDro (2, PlateThickness) 'set the Z axis DRO to whatever is set as plate thickness
Code "G4 P0.25" 'Pause for Dro to update.
Code "G0 Z0" 'put the Z retract height you want here
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
Exit Sub

End If

Hope this helps.
John Champlain