How do I do a manual tool change?

26 Oct 2016 16:54 #82101 by robksawyer
robksawyer replied the topic: Re:How do I do a manual tool change?
Thanks! I haven't cracked open the file yet, but if you're able to elaborate on what you changed in the file to cancel out or allow manual mode, I'd appreciate it. Id really like to understand some of the content of these scripts. What manual would I refer to if I wanted to make my own script like this?
15 Mar 2017 20:39 #89685 by Andyf97
Andyf97 replied the topic: How do I do a manual tool change?
( an old thread yes, but I was wanting to do the same today )
( SO I boched up this bit of G-code )

( Position the head over each hole in turn and use tool change )
( commands to pause the g-code while we manually tap that hole. )

( Manually adjust Z to be higher than anything, then test it.)
( After testing, place Z close to your work )

( M05 Ensure the spindle is not running, or dissable it with a key, in Tormach PCNC exists a lockout Key )


(Drill 1 position )
G00 X20.7897 Y15.1542

(Drill 2 position )
G00 X20.8303 Y45.1541

(Drill 3 position )
G00 X60.8065 Y42.6206

(Drill 4 position )
G00 X60.7727 Y17.6206

(Drill 5 position )
G00 X91.9000 Y20.8285

(Drill 6 position )
G00 X91.9250 Y39.3285

(Drill 7 position )
G00 X116.7250 Y39.2950

(Drill 8 position )
G00 X116.6999 Y20.7950

( Return to the beginning )
G00 X0.0000 Y0.0000

( End the program )
21 Nov 2017 21:49 #102156 by cptX
cptX replied the topic: How do I do a manual tool change?
Hi guys I need to manually re-home Z axis in every tool change, so I need this functionality in any case and asap!
I tested with LinuxCNC 2.11 the scripts presented here and the script from
but none of them works correctly.
What is happening is when the code meets Tx M6 (x is the number of the tool) the dialog box appears and the execution of the gcode is stopped. So far so good.
If you press continue in the dialog box the program is doing nothing, doesn't continue or anything.
I checked the code and should theoretically continue from the next line, but nothing is happening...
If I press the Play button again the code continues from the beginning...

Any clues?
21 Nov 2017 23:27 #102161 by cptX
cptX replied the topic: How do I do a manual tool change?

I dug into the code and actually found out that both linuxcnc.stat().motion_line and linuxcnc.stat().current_line give wrong results.
I solved the problem by changing the line 52 from curLine = linuxcncStat.motion_line to curLine = linuxcncStat.read_line

According to
read_line: (returns integer) - line the RS274NGC interpreter is currently reading.

For me at version 2.7.11 works!!!
The question is how it was working for others or for previous versions with the other commands given that they are now unreliable and if it is now guaranteed to work with read_line
22 Nov 2017 00:19 - 22 Nov 2017 00:20 #102164 by andypugh
andypugh replied the topic: How do I do a manual tool change?
If that is the "jog while in toolchange" patched version of hal_manualtoolchange then I suspect that not many people are using it.

There is a better way, if you can fit a tool-length sensor to the bed then you can have LinuxCNC automatically measure the tool for you after each change. This is actually easier, because it doesn't involve leaving Auto mode and then re-starting.

[Edit] Easier for LinuxCNC, that is. It is a bit more trouble to set up.
Last Edit: 22 Nov 2017 00:20 by andypugh.
22 Nov 2017 08:36 #102177 by agris
agris replied the topic: How do I do a manual tool change?
andypugh, some people do. we do :)
It's really good and convenient to set new z-height for next tool, especially when you need to set tool up in different places of a part being machined. Also that's cool when you need to machine only one part (no series).

cptX, we also experience some troubles with modified code of manaultoolchange hal
Sometimes it works, sometimes doesn't - you may press "continue" but program just stops.
This, if fact, depends on Gremlin window. You may notice, that sometimes lines of code run down, sometimes G-code stucks on some line of code and doesn't move, but program runs!
To avoid "stucking" just click with mouse anywhere inside Gremlin's graphical area - and you\ll get your lines running again.
Then, when ToolChange window appears - you need to go back to LinuxCNC to jog or whatsoever.
Trick is - click on G-code window on the current line - it''ll become gray and "selected".
If "continue" button in ToolChange window fails - you're still on the line, where you should be.
Right-click, Start From Here - and you're done.

Hope this helps.
22 Nov 2017 11:00 #102180 by eslavko
eslavko replied the topic: How do I do a manual tool change?
On old version (running Ubuntu) that's works without problem. I use it near all the time. Probably way more people use that than Andy think. For users with simple machines with collet spindle the inserted tool has different length every time.
Time to create page: 0.084 seconds
Powered by Kunena Forum