Desciption of hard and software used to build my CNC machine. Installing and maintaning a LinuxCNC installation with 7I96 MESA card, a 2.2Kw VFD spindle, HB04 remote and loads more
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.7 KiB

https://forum.linuxcnc.org/10-advanced-configuration/38336-skip-tool-change-if-tools-is-already-loaded#157079

I remapped M6. in the toolChange.ngc file, I have following:
======
o<toolchange> sub
(print, o<toolchange>)
; only execute this file if the requested tool is different tool in spindle
O100 IF [#<tool_in_spindle> NE #<selected_tool>]
(print, request tool different from loaded, start tc)
; debug code
G0 X5 Y5
O100 ENDIF
o<toolchange> endsub [1]
M2
=======

I noticed after this file is executed, the default M6 is still called. e.g. the machine will still move to the predefined location and pop a message to ask me to change tools. if the tool request is different from the tool loaded, it will move to x5y5 first then move to the predefined location and pop the message.

any idea why?

I have this line in ini file: REMAP=M6 modalgroup=6 prolog=change_prolog ngc=toolchange epilog=change_epilog

https://forum.linuxcnc.org/10-advanced-configuration/38336-skip-tool-change-if-tools-is-already-loaded#157179

The following, slightly modified works for my remap M6:

in INI:
[RS274NGC]
REMAP=M6  modalgroup=6 prolog=change_prolog ngc=change epilog=change_epilog
FEATURES = 12

comment
[EMCIO]
;TOOL_CHANGE_POSITION = 333 222 0

add stanza
[TOOLCHANGE]
TCH_X = 144
TCH_Y = 111
TCH_Z = 0

change.ngc
exclude specific Tool and T in spindle, G1 to change position
o<change> sub
o800 IF     [#<_task> EQ 0]
o800        RETURN [99]
o800 ENDIF
o141 IF     [[#<selected_tool> EQ 999] OR [#<selected_tool> EQ #<tool_in_spindle>]]
o141 RETURN [1]
o141 ENDIF
			#<F_TRAV> = 1200
			G0 G53 Z#<_ini[TOOLCHANGE]tch_z>
			G1 G53 X#<_ini[TOOLCHANGE]tch_x> Y#<_ini[TOOLCHANGE]tch_y> F#<F_TRAV>
o<change> endsub [1]
M2