Hi,
When I run g31 with the current position minus one inch, it works fine, it stops (but does not retract any which the specification says it should),
Thats not my understanding.
The machine will move toward the specified end point, at the same time it is looking for the probe input to be activated. When the probe input is activated the current position is recorded to # variables according to the table below and motion is stopped. The recorded position can then be used to calculate tool offsets, work offsets, measure parts, etc.
It does not say anything about retracting. When you have a probing routine it takes two Gcode instructions, a G31 which
does the probe move per the description above followed by a G0 which retracts the Z axis.
Craig
I think you are missing the point: First off, I mentioned it only as a side note, but the documentation that came with Mach3, I believe quoted from the NIST standard but also notated by Artsoft, states:
"In response to this command, the machine moves the controlled point (which should be at the
end of the probe tip) in a straight line at the current feed rate toward the programmed point.
If the probe trips, then the probe is retracted slightly from the trip point at the end of command
execution."
My understanding from reading that was that it tries to compensate for overtravel, but again that is a side note. I of course also do a move afterwards to reposition the probe out of the way when done probing.
The point that you seem to have missed is this, again from the documentation on G31:
"After successful probing, parameters 2000 to 2005 will be set to the coordinates of the location
of the controlled point at the time the probe tripped..."
And in fact several examples of other people's code for probing I have found online use something like:
Code "G90 F4 G31 Z-1.0"
somevar = GetVar(2002)
All the code I saw used the value in 2002, either as #2002 or GetVar(2002) to calculate the trip position, either to set the height of the work piece, or as in my case, to measure the tool length. But all I get is the current Z work offset set by G54, G55 etc.
That is where I am confused. I ended up writing a manual routine after the G31 to backoff the Z axis until it is de-asserted, then go in at a very slow feed until it is re-asserted. For some reason, after backing off the probe, I could not get G31 to work at a very slow feed, (F0.5 or F1.0) so I did it myself in several loops of code.
So I have working code, but I would like to know why 2002 is not the value I think it should be.