View Full Version : How do I go about be able to enter e.g X40.00 and it will change.......


Darc
10-24-2004, 05:07 PM
the X coordinate to X40.00.
For example be able to touch the job and set to whatever the size of the job is.

squarewave
10-24-2004, 05:51 PM
If you are referring to setting the coordinate system to your part, it is done with a G92. For example, if your program assumes the edge of your part is at X40.00, you would touch the X edge of your part with an edgefinder in the spindle, then do an MDI command G92 X40.00 (actually you would correct to the center of the spindle, otherwise you will be off by the radius of the edgefinder). You do the same again for Y and Z and then you have "picked up" your part. These have now established the "work" coordinate system, and it won't change unless you issue another G92.

HuFlungDung
10-24-2004, 05:51 PM
Darc,

In standard gcode, you need to use a G54 work offset. There are more than that one available, but let's keep it simple.

If you look through the default Camsoft gcode.fil, you should see some commands written into the G53 to G58 area of the file. These are simply calls to use the values that you need to enter into the offset tables. You access these tables in the GUI, by opening the tool parameters window.

Now, let's backtrack a little bit. When you power up and home your machine, the displays show you the current position, without any work offsets applied. In standard practice, the machine is working in the G53 machine coordinate system at this time. This is what G53 does in Camsoft, when it calls for Offset 0: it puts you back in the original coordinate system the machine uses to home in.

So now, let's say you have homed the machine. For simplicity, we can say that a tool mounted in the spindle is at G53 X0 Y0 Z0.

Now, your workpiece is clamped down some distance away from where the tool is located. This is where we begin to work in imaginary coordinate systems. If the part is a simple square, then we would usually pick one corner of the part as X0Y0Z0, in the G54 coordinate system.

Obviously, there is some distance between the current display position of the tool, and the part. So we carefully jog around and bring the tool over til it is right above the corner of the part. We note the display positions and enter these values into the first work offset table in the tool parameters screen (Don't confuse this with the tool length offsets in the same window!)

In your Gcode program, you will, somewhere before the first axis movement, place a call to G54, then move to G00 X0Y0Z1. The tool will move to the corner of your part, 1" above. I simplistically left out the call to the tool length offset here.

Anyways, this would be the rough outline of what you would be advised to practice. What you actually asked in your question implies that you want to only work in the machine coordinate system itself. This is not advisable practice for cnc machine operation. Its simply too confusing to try to make part positioning in a CAD system to try to correspond with how the part happened to be located on the machine table. That's why its done this way.

There is another method which is kind of obsolete, using G92.
Camsoft uses:
MACHZERO x;y;z

This is frowned upon generally, because the machine coordinate system is being tampered with, in essence, it could be lost.

I prefer to use this logic, because the machine coordinate system is maintained in the background.
SLEEP .2
ISTHERE Z;\404;\405
IF\404>0THENHOME1 z
ISTHERE X;\406;\407
IF\406>0THENHOME2 x
ISTHERE Y;\407;\408
IF\408>0THENHOME2 y
-----G92

The method in this case still kind of overlaps the G54 work offset method. You still need to make the measurement of the difference between the tool at machine home and some reference point on the work. You then execute a command like
G92 X40. in mdi mode. This resets the display. The bad quality of using a G92 inside of a part program, is the accidental resetting of the position when the machine is not at home position. This is the "gotcha" that they talk about with G92.

So use G54 and the offset tables instead.

Darc
10-24-2004, 06:40 PM
I'm not really explaining myself very well am I, on our cnc lathe you can take a cut and set X** to whatever size the component measures, this is what I'd like to achieve if possible?

Hey HuFlung
Damn good explanation though, I give you credit you know what you're talking about.

HuFlungDung
10-24-2004, 09:22 PM
Go ahead and use the G92 command. Here is my sample logic customized for lathe (where X is usually a diameter, at your option, of course)

SLEEP .2
ISTHERE Z;\404;\405
IF\404>0THENHOME1 z
ISTHERE X;\406;\407
IF\406>0THENHOME2 {x/2}

In MDI, simply type in G92 X40. and the display should reset.

I'd also recommend that you study this logic I use with the G53 in Camsoft. This will permit you to make movements back in the machine coordinate system again, even after you've screwed up the displays with a G92 :D Hopefully, you do set your MACHZERO at some point in your homing routine at startup.
\149=f 'save current feedrate
SOFTLIMITS OFF
MACHHOME1 \60
MACHHOME2 \61
ISTHERE Z;\402;\403
IF\402>0THEN\60=\403
ISTHERE X;\400;\401
IF\400>0THEN\61={\401/2}
\173=\273 :IF\173>1THEN\173=1
FEEDRATE {\173*50}
DECELSTOP
MACHGO \60;\61;0
WAITUNTIL STOP
SOFTLIMITS ON
f=\149 'restore current feedrate
-----G53

I think that conventional G28 logic is just a special case of the G53 I use. G28 always returns you to machine zero. It would be equivalent to MACHGO 0;0;0

That is likely fine and dandy on a mill, or a chucker that never uses a tailstock. However, I use the tailstock quite a bit on work of greatly varying lengths. Hence, I would usually experience some kind of carriage interference if I always returned to machine zero. So, when setting up for a new part, I place a G53 command near the beginning of my program with X and Z coordinates that are suitable for an intermediate home position for the current part. This helps to ensure that my machine always restarts the program from the correct position, regardless of what I might have done to my displays with G92 commands. So in a sort of mathematical sense, G53 X0Z0 = G28