Getting a tool length compensation issue when making toolpaths

Not sure what I’m doing to cause this, but every time I save toolpaths, there’s a line of code put in right before starting the spindle that reads: G00 G43Z0.6H2. G43 is “a tool length compensation in the positive direction”. It seems to be coming from setting the safe Z distance in machine setup. If I try to run the code on my machine it stops at that line, and if I delete the line, the code runs fine.
What I see happening is when you set the Z gap above material distance, in the the Home/Start position under the Material setup; that’s what effects the G43 code. it changes the G43 number; Z0.6 or Z0.2, whatever it put there and then stops the code from running, which makes no sense to me.
Steve

Are you using Mach 4? I don’t think Mach 4 supports G43 within a G0 command. The “G43 Z#.# H#” command is common at the beginning of a program or after a tool change because some people use tool length offsets, and if you don’t use the tool length offsets, then this

G43 Z#.# H2

is just equivalent to

G0 Z#.#

So my guess is that the issue isn’t the G43 part, it’s the “G00 G43” being used together.

What are you using to create the G-code?

If you try these in the MDI pane one at a time, you’ll get an immediate idea of what’s allowed.

G43 Z# H1
G0 G43 Z# H1

Hey Stephen,
I like your name, mein deutscher Mann!
Thanks for the response, your assumption is correct, I recently purchased my machine so I’m using Mach 4, along with Vcarve Pro. I don’t know much about this CNC’in stuff yet, but I’m learning. What you say makes very good sense to me, my son said something similar the other day. I have zero experience with the MDI window, have no idea what it is for, yet. Why would Vcarve add this to the code if it doesn’t work?
I’m pretty sure this line was involved with my Z crash last week while doing a simple touch plate and the machine tried to drive Z thru to China! Somehow the Z axis got an offset that was astronomical in size and by God it was going to go there!

Stephen (more commonly know as Steve)

That comes from the line “G00 G43 [ZH] H[T]” in your Vectric post processor. I don’t know much about this command, but it doesn’t cause my Gcode files to hang when running. However, I think the H value is the tool number from your tool database, and mine are always set to 1, not 2. From a quick read of the G43 command, it seems there is supposed to be a value assigned for each H number somewhere in Mach4. Probably some table thats loaded, but I couldn’t find it on short notice.

My guess is maybe that there is not value for H2 so it hangs up. I would try a 1 and see if that works.

I can certainly try to substitute a 1 for the 2 and see what happens. But if this is being put in by Vcarve I’ll have to figure out why or I’ll have to delete the line in every Gcode I write or change the 2 to 1 every time. Hmmm, seems weird to me. I’m sure there is a final answer, I just haven’t found it yet.
Steve

These are tool length compensations. They are really only relevant if you have repeatable tool lengths in the machine. E.g you have an ATC, or you use little shaft collars on your tools. If you have a regular ER spindle, I would just remove any g43 and g49 lines entirely from the post processor.

To elaborate more when you call g43h2z.6, you are telling Mach to look at tool 2 (to which height 2 is associated) and apply that length offset. And then move to z.6.

This is dangerous if you have not touched off z0 with that height number already active.

If you have tool 1 active and height 1 active during touch off and then your gcode calls h2, you will end up with a situation where your z surface might be above where the machine thinks it is and then you crash.

In Mach, make sure you have all the tool lengths set the same, and then in vectric, I’d just disable the post processor lines with g43 or g49 and just have a normal g0z.6.

Ignore all this if you are using numbered cutters with fixed offsets. In that case, you need to learn to use the offsets and set an m6 tool change routine that works for you.

@Eyedoc1701 My bet is that you created a tool in VCarve that is set to a tool number other than 1. Can you post the VCarve file you used so that we can take a look?

Getting a lot of good advice here and I appreciate that guys! I have a standard Avid Pro 4848 machine with no ATC and no collets rings, just putting the tools in the ER20 collet, tightening them down and using the touch plate for position. So I don’t need any G3 code and I’m not real sure just where it’s coming from yet, but I’m going to find out.
I’m at work right now, so I can’t get a Vcarve file for you at the moment Eric, but I’ll see what I can do. Tomorrow may be the soonest I can as I have plans this evening and won’t be home till late.
Thanks for your thoughts too Abakker, I agree about the danger of this situation and I already had a crash with the z drive during touch plate once and that’s enough for me. I’d jut as soon avoid that in the future.
Steve

Hi, there is a Tool Table button on the Tool Change tab in Mach4. If there are numbers in the Length column it will add/subtract during the compensation Gcode. Since you’re doing manual tool changes all these values need to be zero and the Auto Z touch plate is used to establish Z instead of compensating from a reference length. The Gcode for tool height/length compensation can stay put as it pulls the comp value from the table, and as long as there aren’t any values there will be no compensation applied.

Holy crap Batman! That could be the answer David, thank you. I will take a look and see if I can find that and see what it says. It’s definitely pulling from somewhere, that sounds promising.
Steve

Hey David,
I got a chance to check out the tool table under the tool change tab in Mach4 and found; Tool #1 has a 2.000 in it’s box, tool #2 had a 0 but to the right was that unGodly number that tried to send me to China last week. I deleted that, but left the 2 under tool #1. Don’t know what it’s there for, but…

Eric, the file for making the spoilboard pockets actually came out of Fusion 360 and when I tried to upload it here for you, I got an error message, saying I can’t load that kind of file.

Steve

This is your problem. If you’re not using and ATC, or some kind of custom setup that has tool numbers (manual tool change for example) all of these numbers should be zero.

Seconded - you want zeros, including tool #1 if performing manual tool changes (no ATC system)

Hey guys,
When i saw that gigantic number in the second column of tool #2, i knew that was a definite problem. I’ll fix tool #1 this evening when i get a chance. I’m at educational meeting thru the weekend so my play time is limited. I certainly appreciate everyone’s help getting things figured out.
Now if i can just figure out… why/ how those numbers got there, i don’t know what i did to get them there. Perhaps my initial messing with fusion360 and having so much trouble with toolpaths. Now that I’m using Vcarve Pro, perhaps things will settle down.
Steve

Random tool lengths don’t have anything to do with what CAM program you are using. Maybe you keyed those in accidentally?

Keep an eye on them after you zero them all out. If they change again take note of what you just did and see if you can recreate the issue.

Hey Eric,
I’m not going to swear i didn’t do it but the number of characters in the number was literally astronomical. Something would have had to lay on the keyboard and rattle around on the number pad… or, I was drunk and just started punching buttons (which i have up a long time ago), or something crazy in the software went nuts.
I will keep an eye on it and see if I reproduce it somehow again. Otherwise it will remain a mystery.
Steve

You could have accidentally opened the tool height dialog and typed stuff in. It’s not entirely impossible for those tool lengths to be written by other means though. If I were you I’d just open it up before you start jobs for a while and just double check it. If you see it changing again we may need to get support involved.

I find it had to believe I actually typed in a number that was 20 or 30 digits long, that is just crazy long!
The other funny thing was once I deleted that line out of the Gcode, it appeared as though when I changed the safe Z distance in Vcarve to 0.2 or 0.6, or whatever, that number also showed up in the Gcode in that G00 G43Z#, which is where my machine would stop.
In lurking here more and more lately in another post I’ve seen that Mach4 evidently looks forward up to 20 lines of code for trouble before it gets there and can stop the machine. But I suspect that doesn’t apply to my situation since once I deleted the G43 code line everything worked. As though that was the problem.
At this point, I’m gonna quite thinking about it and move on, and see what happens. I will take a look at the toolpath/toolxxx? every time I start the program, for awhile, just to be sure.
Thanks for all your help.
Steve

One time I kicked the power cable out of my controller while Mach4 was open on the PC and when I restarted everything I got some real strange stuff. Had to erase my profile and start over - took about 10 minutes. Could be you just shutdown in the wrong order once, not knowing or not intentionally, and some screwy data got written to the tool table.