"Automatic" Tool Length Offset

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.


@tjcolejr What kind of switch? That looks a BitFamiliar.


I considered doing this too with an inductive prox switch in it, what kind of switch did you use and have you tested the repeatability on the setup?

Love it!

1 Like

First, let me say I am very thankful to @neilferreri for the macros. They work great for me.

I’m using a basic limit switch wired normally open with the roller and metal spring ripped off. This is the same switch setup that is on my Prusa 3D printer.

The button is simply to make the strike area greater. It is 15mm in diameter. I appear to get repeatable triggers around +/-.025mm. Call it +/- .001".

I had already designed the box and button and was going to attach it to the machine bed. Then I saw the bitsetter and liked the idea of mounting it to the rail.


Thank you very much Neil! You talked me into switching to CNCjs and I used both your macros for bit probing for Z height. I just removed the M0 functions since I am using a fixed button for probing. I ran a test and I would say the correction is within a couple hundredths of a millimeter. I think the discrepancy is due to some previous damage to the bottom (UGS glitch). I am going to glue an aluminum disc to the switch to give it a more consistent surface. Thanks again!

Now I have to figure out how to make the stream deck work with CNCjs.

Hey @BenSappington, welcome! Since you have the fixed button and don’t need to attach alligator clips, your workflow is the same as the BitSetter. You can use these macros.