From: Stephen Wille Padnos <spadnos@so...>  20050525 19:52:32

Tom Hubin wrote: >Hello, > >Here is an MDI test of G92 and M02 that leads to unpredictable results. >I did this with the original Sherline inch version of EMC without the >later patches. > >I start with X, Y, Z, and the corresponding offsets all at zero. Then >enter each of the Gcode blocks below and observe the resulting values >for X, Y, Z, and their corresponding offsets. > > X Y Z Xoff Yoff Zoff > >(starting values) 0.0 0.0 0.0 0.0 0.0 0.0 > >G92 X1 Y2 Z3 1.0 2.0 3.0 1.0 2.0 3.0 > >M02 0.0 0.0 0.0 0.0 0.0 0.0 > >G92 X1 Y2 Z3 2.0 4.0 6.0 2.0 4.0 6.0 > >M02 0.0 0.0 0.0 0.0 0.0 0.0 > >G92 X1 Y2 Z3 3.0 6.0 9.0 3.0 6.0 9.0 > >M02 0.0 0.0 0.0 0.0 0.0 0.0 > >So if you happen to have all zeros for X, Y, Z and their respective >offsets and try to use G92 X1 Y2 Z3 to set (X,Y,Z) to (1,2,3) then you >cannot predict the results for any of the six numbers. > >Tom Hubin >thubin@... > > Tom  try this sequence instead: G92 X1 Y2 Z3 M02 <=== stops using offsets, but doesn't clear the variables G92.3 <=== restores saved offsets, may make (x,y,z) = (1,2,3) (I'm not sure) G92 X1 Y2 Z3 <=== (x,y,z) should be (1,2,3) now M02 G92.3 G92 X1 Y2 Z3 M02 I haven't tried it, but looking over the interpreter code and the RS274 docs, this should work. The problem seems to be that the code that sets the new offsets doesn't check to see if offsets are in effect before adding in the old offsets. The RS274 definition says (as Paul pointed out) that M2 is supposed to do a G92.2, which stops using offsets but doesn't clear them. The specification for G92 doesn't explicitly define the case when there are offsets, but they aren't in use. I'd say this is a bug in the interpreter (my preference would be to treat offsets as zero if a G92 occurs when G92 is not already in effect, but that's just me).  Steve 