Sorry for the delay in replying. I missed your post. I have attached the files. I have a Modbus front panel with a bunch of buttons. One (connected to digital input 0) enables/disables auto tool set. Only tools 1-100 will auto toolset. My probe is T101. Another button directly calls the tool set subroutine so I can manually trigger a tool set.

The probe and tool setter are in series so either will trigger the probe input. Among other things this allows me to calibrate the probe relative to the tool setter by simply doing a probe toolset.

Les

On 13/11/2021 17:26, John Dammeyer wrote:
Hi Les,
I have to ask.  How do you have an optional subroutine on M6?  Can you share 
the code?
Thanks
John

o<toolchange> sub
#<lasttool> = #5400
g53 g0 z0
M6
; we must execute this only in the milltask interpreter
; or preview will break, so test for '#<_task>' which is 1 for 
; the milltask interpreter and 0 in the UI's

O999 if [[#<_task> LT 1] or [#<lasttool> eq #5400] or [#5400 eq 100]]
O999    return [-2]
O999 endif

M66 P0 L0
O1000 if [#5399 EQ 1]
O <toolset> call
O1000 endif
g43 h#5400

o<toolchange> endsub
m2
o<toolset> sub

O999 if [#<_task> LT 1]
O999    return [-2]
O999 endif

O998 if [#5400 eq 0]
(abort, Cannot toolset - no tool selected)
O998 endif

M64P0

m73
G21 (TLO and toolchange position is in mm as per ini)
G90 (absolute)
m5

#4 = #5420
#5 = #5421
g53 g0 z0
g53 g0 X #<_ini[TOOL_SETTER]x> Y #<_ini[TOOL_SETTER]y>
#1 = [#5422 + #<_ini[TOOL_SETTER]z>]
#2 = #5422
g38.2 z#1 f4000
g0 z[#5063 + 2]
g38.2 z#1 f200
m72
g10 l1 p#5400 z[#5422 - #1]
g43 h#5400
g53 g0 z0
g0 x#4 y#5
M65P0
o<toolset> endsub
m2
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to