Tool Change Pre and Post Hooks

Love more information on setting the tool change pre and post hooks. Love to re-setup the semiautomatic tool changes that I had working on cncjs.

The way we’ve set it up is that it looks out for the M6 command and once encountered it will execute whatever code is specified in the pre-hook, then put up a prompting window to change your tool, then execute whatever g-code is written as the post-hook once the tool change has been confirmed.

We’ll be putting an example of how this works in the documentation soon. As a quick example here, you’d likely want a G91 command in the Z to move your bit up and away from the material, followed by perhaps an X or Y movement away from the cutting area. If you’re using a spindle or an IOT relay, you might also want to include code to turn those off. After tool changing is complete, you’ll want to follow those same steps in reverse, perhaps throwing in a z-probe to confirm the new tool offset.

New here…is there a way to call a macro from these “hooks”, or, better, prompt for user selection of a macro on an M6? I maintain some tool change (and other) macros for CNCjs. There are things you can do in a macro that cannot be done with pure gcode.

That’s a good point @NeilFerreri, I’d suppose the options would be to either allow macros to be called or enable macro functionality within the tool change and pre/post g-code blocks

Either way I’ll see what we can do

1 Like

@chrismakesstuff Any chance to look into this yet?

Thanks for following up :+1: it’s on the list of remaining features to implement before version 1.0

I’m hoping we’ll have the next release out by Sept 10 and it’ll be in that new build. I know it seems a bit far off but I’m trying to pace the team so that we don’t get burnt out preemptively

1 Like

Good news! Variables are now supported in the latest release for both tool changing and start/stop g-code! Try it out @NeilFerreri and @cratergoods and let me know what you think :smiley:

1 Like