Quote Originally Posted by bseibenick View Post
Well, everything went well with my first attempt - other than at the very end of the program the machine decided it was going to go to y0...of the machine coordinates instead of the work coordinates. Of course it did it going through the middle of the part I just machined.

The last couple lines of the gcode that BobCad generated are below:

N7046 X0.8888 Y1.3174 Z-0.4871
N7047 G00 Z0.2
N7048 Z1.
N7049 M09
N7050 M05
N7051 G91 G28 Z0.
N7052 G91 G28 Y0.
N7053 G90
N7054 T1 M06

From what I can tell the machine moved the Z axis up to 1", which is the clearance plane but from what I can tell line N7051 and N7052 are what brought the Z axis back down and then the Y axis through the middle of my part. I forgot to change the post from the standard BC_3x_Mill.MillPst to the Mach3-Mill-NoATC.MillPst post. I am going to re-post the code using the Mach3 post and see if the results are a bit better.

Attachment 302452

Brian

"G91 G28 Z0" is as follows:

G91 tells the machine to switch to incremental moves. This means that each value given is the distance from the current position which the machine should go. G28 tells the machine to go to the Machine Zero through the current current move. Z0 tells the machine to move Z0, which in incremental means no distance from the current position (in absolute it would mean move to the coordinate Z0 in the current work coordinates). The result is that the machine moves to the Z0 of machine coordinates from the current Z position. If, for example, the code said "G91 G28 Z1", the Z axis would first move up Z1 (one increment), then move to Z0 in machine coordinates from that position, or in other words going to Machine Zero through the move of Z1. Again, Z0 is not really a move, so to go through Z0 in incremental positioning, it doen't have to move at all before going to Machine Zero. It's a very complicated command that really should not be used IMHO. The other problem is that you clearly have set your machine zero below the part zero, which should never be done. Machine zero (Z0 in absolute, machine coordinates) should be the highest position the Z axis can go, or very near it, while your work coordinates zero should therefor be below that point. That is what prevents this kind of move from damaging your part.

In my opinion, you should first learn to home the machine to the top of the Z stroke. Then, you should use G53 instead of G91 G28. I've never understood why a person would use G28 instead of G53. G53 is a single line parameter which cancels itself on the next line automatically (non-modal) that tells the machine to make following moves in machine coordinates, and in the current mode (incremental vs. absolute). A line of "G53 G0 Z0" in absolute mode (which is obviously what you are programming in) would move the Z to Machine Zero. In your case, the result would have been the same because the homing was not done kosher (machine Z higher than work Z). However, there is less chance of getting stuck back in incremental by accident (G28 is almost always paired with incremental positioning as it is here).

I have the following at the start and end of my programs, added in the post processor:

G53 G0 Z0
G53 X0 Y0

Just my preference and I've yet to hear a reason why it would be better done with G28. G28 made more sense back when memory on the machines was limited to 25kb per program since we all programmed in incremental much more, including a lot of subroutines. With modern controllers, just about everyone now programs in absolute because there is no reason not to when you can run programs of several gigabytes in size. If you were in incremental, G28 was the way to go since it was a move to home through the current move, requiring no knowledge of the current position which is commonly hard to figure out in incremental since it's always just relative position. You also never had to switch modes to do the move, so it made more sense that way as well. In absolute, I strongly believe that G53 is the better solution.