Many disclaimers and obvious precautionary warnings! This is not a step-by-step direction… I assume you can figure this out.
This is all very specific to my machine, and requires non-trivial changes to the code to customize it to another machine, but if you are comfortable with Python, it’s not terribly complex, it just takes time to sort through and figure out.
It’s important to understand that my machine (like any semi-stock Shapeoko) is not smart by “big machine” standards. It doesn’t know where each tool is, it doesn’t know what an “M6” command is, it doesn’t know how to probe to get the TLO. I do this all manually with the following scripts. The scripts actually rip out the M6 commands and replace them with simple move commands to move where each tool is, etc. If /anything/ goes wrong, disaster strikes. There is very little margin for error and can result in extremely dangerous situations. (e.g., spinning up to 21,000 RPM with a broken tool improperly seated in the changer, and then continuing on as if nothing were wrong.)
I have over-ridden the M8 / M9 coolant commands for open/close tool changer.
I have a tool rack that has micro-switches integrated in each tool holder, wired with the logic to the changer, so if any tool is missing from the rack while the tool changer is open, it triggers the “hold” switch. If a tool gets stuck in the chuck of the changer, this prevents a really dangerous crash if I’m not actively monitoring the machine. If you want the Fusion 360 file, or STL file for the toolholder, let me know. It’s not perfect, and takes some patience to assemble, but it works. I can also provide a schematic for wiring the micro-switches and relay with the HOLD line and tool changer lines if you like. (Of course, you have to recompiled grbl to enable the HOLD line…)
So please be careful, don’t do anything to get yourself hurt. Precautions aside, here’s how I do it:
- I first edit tlogcode.py (TLO gcode) to give it the specific machine coordinate locations of each tool, then run it. This Python script generates a gcode file that picks up each tool, moves to my touch probe, probes, and then pauses. I run that gcode (I use bCNC), and write down each measurement of the TLOs, so I can give my tool change script a precise length of each tool.
- Next, I copy those measurements into addtoolchanges.py (along with the locations of my tools, of course). Then I use addtoolchanges.py to process the gcode for the job I want to run, and it adds the tool changes to the gcode.
- Then I just use the resulting gcode to run the job with tool changes!
toolchanges.zip (5.5 KB)