"Automatic" Tool Length Offset

Here’s a link to the updated macro… Went away from using the G43.
User defined variables are at the top and I try to add comments to help explain (and help me remember what I was thinking).
Other macros on the GitHub repo as well.

1 Like

Would love to have some additional CNCjs testers on this one before I share it on GitHub.
Precision_ToolChange_Macro.zip (1.1 KB)
Make sure to set the user-defined variables.
%SAFE_HEIGHT = -10 ; clear everything height(negative number, distance below Z limit)
;Following set probe location
%TOOL_PROBE_X = -500;machine coordinates
%TOOL_PROBE_Y = -230 ;machine coordinates
%TOOL_PROBE_Z = -20 ;machine coordinates

You can run this macro anytime you want to change tools and keep the same workpiece.
On running you will:
Be prompted to continue, at which point the machine will move to a safe position above your probe and pause for you to attach wires and get probe ready.
On continue it will rapidly drop to the TOOL_PROBE_Z location, then do a fast-ish probe. Then a series of mini probes will occur to “dial it in” (takes about 1.5s).
It will raise to safe height and wait for you to change tools AND get ready to probe again.
On your continue, it will probe the new tool and raise to safe height to remove wires.
On continue, it’ll go to XY zero, and remain at safe height.

I’d love to hear feedback/suggestions before I post it.


Hey @neilferreri. This is the same one I already tried, right?

Pretty much the same except it goes back to work Zero instead of wherever it was. Some people use it right after homing, and it gets old having the machine go back to home after it was just there.
Otherwise the same.
I have an idea for a workflow more like the nomad, so we could eliminate probing with two tools each time.

1 Like

I’d love that. Please keep me posted.

OK…here we go.
Initial&NewToolMacros.zip (1.9 KB)

After setting your Z zero, run the “Initial Tool” macro (be sure to edit probe location)
That will establish the tool offset for your probe.
When it’s time for a tool change, run the “New_Tool” macro.

Each macro is just one probe sequence with one tool. I don’t have a Nomad, but I think this it how it’s done. Will be great for multiple tool jobs.
Just remember to add probing wires when it gets to the probing location.


As always, would appreciate feedback.


Thanks Neil!

I’ll try to give it a go in the next day or two.

I’m stoked to try this with the carbide 3d probe!

dumb question, but where do you put your probe for the tool change, and how do you keep it in a consistent place with known coordinates? did you just pick an out of the way spot up front and mark it with a pencil on the washboard or something?

Anywhere that will still be there when you start carving. You define the location machine position by editing the Initial_Tool macro. That location will persist until you power cycle. When I test the macros, I just line the probe up under the end mill. I have a pocket cut in the front right corner for my probe, but it’s easy enough to just line it up. You could even use a spot on top of your stock of it won’t be cut.

By the way, make sure you use the most recent version of CNCjs. The macros rely on a feature added recently.

I generated gcode with two tool changes that I used for test purposes that takes about 30 seconds to run (not including tool changes) if anyone’s interested for testing or practice. It’s just three overlapping circles 20mm diameter and 1.5mm deep with the origin at center.

Here is the test file I’ve been using. I didn’t really pay attention to Feedrate as it’s cutting 1.5mm deep (two passes) in scrap MDF.
Home Machine
Load 0.25" end mill.
Zero all axes (XY in center, Z on top of stock)
Edit Initial Tool macro for your probing location
Run Initial Tool Macro
Start job (It will see the M6 for the first tool which is already loaded…just resume)
It will run first operation.
On next tool change call, run New Tool macro (changing to 0.125" endmill)
When done it will run second op
On last tool change call, run New Tool macro (changing back to 0.25" endmill)
Resume to run final operation.

Check bottom surface for perfection.

Fusion file:
and gcode if you’re comfortable:
toolChangeTest_twoChanges.nc (17.6 KB)


Just to update:
I’ve added a couple more CNCjs tool change macros to the github repository.


I am confused.

I use the C3D tool probe block and I want to use your tool change macro. I am using the Precision_ToolChange_Macro.txt and each time my second tool is 3 mm too deep. I though it might have something to do with my block but if I am probing it the first time with the block then change the tool and probe again should it not work?

But now I see you have these Initial and New tool macros separate. Which ones should I be using with my CNCjs?

Hey @DanSexton,
Either macro should work. I use the initial and new macros frequently, but I used to use the other one.
When your job encounters an M6 for a tool change, you run the macro and:

  1. It will go to probing position
  2. Wait for you to add your probing wires of needed
  3. Probe with first tool
  4. Retract to tool change height
  5. Wait for you to change tool land add probing wires.
  6. Probe with new tool and adjust work position.
  7. Retract to safe height and wait for you to remove wires
  8. Resume job.

Is that what you’re doing?

Yep and it worked just like that. The problem is that the second tool was 3mm deeper than it should have been. It did this twice today. I use the C3D probe block to set my initial zero and then the Precision_ToolChange_Macro after the first tool is done. I use the block in exactly the same place for both probe checks in the macro.

I will try the two other macros tomorrow but I really like having it all in one macro. Is there an advantage to the two macro approach?

And as one last question… Is there any way to change the order of the macros in the widget in CNCjs?

You just run one probe with the initial tool and then one probe for each new tool instead of double probing on each change.

That is concerning. Can you run a test? Set Z zero at a measurable distance (>3mm)above your wasteboard. Run the macro and change the tool to an obviously different length. Go to Z zero. Still 3mm off?

What do you have your %Safe_Height set to?

1 Like

Ok. After going over all of this I found the issue. Turns out the second tool was 3mm deeper than it should have been but so was the first one, I just didn’t realize it due to the way the path was made. I didn’t have the settings in the CNCjs probe section correct.

Your macros work great and I thank you for your work in creating them.

Now, about changing the order of the macros in CNCjs…

Great! Good thing your machine was handling the 3mm difference without causing a bigger issue.

Never really thought about this before, but it would definitely be useful. I don’t think there is a way to do it through the UI.

I had to edit this manually in a .cncrc file located under C:\Users"Your User"

Thanks for your fantastic contribution on this whole CNCjs / macro subject! I have learned alot from your posts!


Awesome. Thanks! Makes it much easier…

1 Like

I designed a little 3D printed switch to mount on the front rail for the tool length macros. Allows you to set the X,Y global coordinates and not have to change them again unless you move the switch.