manual tool change with tool length probe
- pgf
- Offline
- Premium Member
-
Less
More
- Posts: 127
- Thank you received: 25
25 Apr 2025 21:11 #327057
by pgf
manual tool change with tool length probe was created by pgf
Is there a write-up anywhere on how to configure LinuxCNC to do a tool length probe when doing a manual tool change? Having to split my g-code into two parts, for the sake of different tools, is (at least sometimes) a nuisance.
I confess I've been mill-shopping, and although I'm not looking at the shapeoko products, I did end up on a video demonstrating their "BitSetter" accessory, which seems very nice. I'd love to have something like this.
I confess I've been mill-shopping, and although I'm not looking at the shapeoko products, I did end up on a video demonstrating their "BitSetter" accessory, which seems very nice. I'd love to have something like this.
Please Log in or Create an account to join the conversation.
- JohnnyCNC
-
- Offline
- Platinum Member
-
Less
More
- Posts: 572
- Thank you received: 115
25 Apr 2025 22:02 #327058
by JohnnyCNC
Replied by JohnnyCNC on topic manual tool change with tool length probe
I did a M6 remap that does that. I originally did it as a .NGC remap but then did the remap in Python. Either way the idea is the same. See the attached document for my write-up and support files. If you want the Python files that I modified, I can post them.
Attachments:
The following user(s) said Thank You: pgf
Please Log in or Create an account to join the conversation.
- pgf
- Offline
- Premium Member
-
Less
More
- Posts: 127
- Thank you received: 25
25 Apr 2025 23:24 #327063
by pgf
Replied by pgf on topic manual tool change with tool length probe
Is there a write-up in addition to the ngc files?
Please Log in or Create an account to join the conversation.
- JohnnyCNC
-
- Offline
- Platinum Member
-
Less
More
- Posts: 572
- Thank you received: 115
26 Apr 2025 01:01 #327067
by JohnnyCNC
Replied by JohnnyCNC on topic manual tool change with tool length probe
I had to save it as a PDF to be able to upload it.
Attachments:
The following user(s) said Thank You: GeckoWorks
Please Log in or Create an account to join the conversation.
- pgf
- Offline
- Premium Member
-
Less
More
- Posts: 127
- Thank you received: 25
26 Apr 2025 02:48 #327073
by pgf
Replied by pgf on topic manual tool change with tool length probe
Thanks! There's a fair amount there to absorb, but I think it will be worth it.
Please Log in or Create an account to join the conversation.
- Buzzcut
- Offline
- New Member
-
Less
More
- Posts: 5
- Thank you received: 5
15 Jun 2026 12:49 #347088
by Buzzcut
Replied by Buzzcut on topic manual tool change with tool length probe
I have been looking to implement something like this on my machines. I downloaded the ngc files that you have posted and read your write up on it. Would it be possible for you to post the python files. I believe this would be a great option to be added to the main repo for makers like me. There are a lot of machines out there that have this feature in the controls already. Examples are Onfinity, Sienci Labs and others. It fills a huge void in semi automatic tool change area. I switch my machines to Linuxcnc do to replacement cost after controller failure and the options available with linuxcnc that other controllers don't have. Thanks for all your great work!
The following user(s) said Thank You: GeckoWorks
Please Log in or Create an account to join the conversation.
- Buzzcut
- Offline
- New Member
-
Less
More
- Posts: 5
- Thank you received: 5
18 Jun 2026 00:03 #347143
by Buzzcut
Replied by Buzzcut on topic manual tool change with tool length probe
I would like to implement or some version of you tool change on 2.9.8. Would it be possible to post your python file you mentioned in this post. Any help would be greatly appropriated. Thanks in advance.
Please Log in or Create an account to join the conversation.
- JohnnyCNC
-
- Offline
- Platinum Member
-
Less
More
- Posts: 572
- Thank you received: 115
10 Jul 2026 18:30 #347665
by JohnnyCNC
Replied by JohnnyCNC on topic manual tool change with tool length probe
Sorry, been away for a while. I will get them posted soon.
Please Log in or Create an account to join the conversation.
- JohnnyCNC
-
- Offline
- Platinum Member
-
Less
More
- Posts: 572
- Thank you received: 115
13 Jul 2026 02:17 #347726
by JohnnyCNC
Replied by JohnnyCNC on topic manual tool change with tool length probe
Attached are the Python files that I modified for my M6 remap with auto-tool measurement. My changes are tagged with "JHK".
Enjoy
John
Enjoy
John
The following user(s) said Thank You: Aciera, GeckoWorks, Buzzcut
Please Log in or Create an account to join the conversation.
- tuxcnc
- Offline
- Elite Member
-
Less
More
- Posts: 169
- Thank you received: 24
13 Jul 2026 17:05 - 13 Jul 2026 17:08 #347744
by tuxcnc
Replied by tuxcnc on topic manual tool change with tool length probe
When you remap M6 to ngc, you can use standard M6 in it (I don't know why, but it works).
Bellow is code I use (no python or so, pure g-code), but I give no warranty, check carrefully.
Bellow is code I use (no python or so, pure g-code), but I give no warranty, check carrefully.
O<tool-change> SUB
(file tool-change.ngc)
(--- header ---)
(tuxcnc 2021)
(manual tool change with automatic measurement)
(replaces M6 g-code)
(we assume that, toolsensor is permanently mounted)
(and Z parameters of TOOL_CHANGE_POSITION and TOOLSENSOR ZPOS)
(are maximum upper, otherwise you may get collision)
(you must have the following in your INI file)
(without semicolons and you can change parameters)
;[RS274NGC]
;FEATURES = 4
;REMAP=M6 modalgroup=6 ngc=tool-change
;[EMCIO]
;TOOL_CHANGE_QUILL_UP = 1
;TOOL_CHANGE_POSITION = 230 0 0
;[TOOLSENSOR]
;XPOS = 192
;YPOS = 0
;ZPOS = 0
;APOS = 0
;BPOS = 0
;CPOS = 0
;UPOS = 0
;VPOS = 0
;WPOS = 0
;FEED1 = 500
;FEED2 = 100
;TRAVEL =100
;DISTANCE = 71
(--- end of header ---)
#<tool> = #<_selected_tool>
#<previous_tool> = #<_current_tool>
O100 if [#<_task> EQ 0] ( only run the subroutine in milltask interpreter )
(debug, Task ist Null)
O100 return [999]
O100 endif
o200 IF [ #<tool> EQ 0 ] ( check if tool zero selected and end routine )
(MSG, No Tool Selected )
O200 return [999]
o200 ENDIF
(--- store existing parameters ---)
#<g30x> = #5181
#<g30y> = #5182
#<g30z> = #5183
#<g30a> = #5184
#<g30b> = #5185
#<g30c> = #5186
#<g30u> = #5187
#<g30v> = #5188
#<g30w> = #5189
#<absolute> = #<_absolute> (remember in local variable if G90 was set)
#<mist> = #<_mist> (remember in local variable if M7 was set)
#<feed> = #<_feed> (remember feed value)
#<flood> = #<_flood> (remember in local variable if M8 was set)
#<tool_offset> = #<_tool_offset>
G49 ( cancel tool length compensation )
M9 ( coolant off )
M6 ( run normal M6 operation )
G91 ( incremental distance mode )
(--- prepare g30 ----)
#5181 = #<_ini[TOOLSENSOR]XPOS>
#5182 = #<_ini[TOOLSENSOR]YPOS>
#5183 = #<_ini[TOOLSENSOR]ZPOS>
#5184 = #<_ini[TOOLSENSOR]APOS>
#5185 = #<_ini[TOOLSENSOR]BPOS>
#5186 = #<_ini[TOOLSENSOR]CPOS>
#5187 = #<_ini[TOOLSENSOR]UPOS>
#5188 = #<_ini[TOOLSENSOR]VPOS>
#5189 = #<_ini[TOOLSENSOR]WPOS>
(--------------------------)
G30 ( go to toolsensor )
#<PlaneOffset> = [#5183 - #5422] ( get the current plane Z offset )
G38.2 Z-[#<_ini[TOOLSENSOR]TRAVEL>] F[#<_ini[TOOLSENSOR]FEED1>] ( fast touch )
G38.4 Z1 F[#<_ini[TOOLSENSOR]FEED2>]
G10 L1 P#<tool> Z-[-#<PlaneOffset> - #5063 - #<_ini[TOOLSENSOR]DISTANCE>] ( store offset in tooltable )
G30 ( go to safe position )
#<previous_tool> = #<tool>
(--- restore parameters ---)
#5181 = #<g30x>
#5182 = #<g30y>
#5183 = #<g30z>
#5184 = #<g30a>
#5185 = #<g30b>
#5186 = #<g30c>
#5187 = #<g30u>
#5188 = #<g30v>
#5189 = #<g30w>
O<restore_abs> if [#<absolute>]
G90 (restore only if it was set on entry:)
O<restore_abs> endif
O<restore_mist> if [#<mist>]
M7 (restore only if it was set on entry:)
O<restore_mist> endif
O<restore_flood> if [#<flood>]
M8 (restore only if it was set on entry:)
O<restore_flood> endif
O<restore_tool_offset> if [#<tool_offset>]
G43 (restore only if it was set on entry:)
O<restore_tool_offset> endif
F #<feed> (restore previous feed value)
(--------------------------)
O<tool-change> ENDSUB
M2
Last edit: 13 Jul 2026 17:08 by tuxcnc. Reason: mistake
The following user(s) said Thank You: Buzzcut
Please Log in or Create an account to join the conversation.
Time to create page: 0.114 seconds