M61 Remap not setting Tool number

More
20 Jul 2023 11:42 - 20 Jul 2023 11:45 #275890 by Leo75Wolf
Hi,
This is my first post here so i hope i posted this in the right place.
I am currently remapping M61 for a custom macro for Putting Tools into the machine (M6 will be ATC exclusive as i dont have good access to the carousel)

I get this error once my script is done and the tool number is not set:Traceback (most recent call last): File "/home/leo/.local/lib/python2.7/site-packages/qtpyvcp/plugins/tool_table.py", line 243, in setCurrentToolNumber self.current_tool.setValue(self.TOOL_TABLE[tool_num]) KeyError: -1Running Linuxcnc 2.8.4 with probe Basic
in the my_cnc.ini:
REMAP:M61 prolog=settool_prolog ngc=toolchange_man epilog=settool_epilog

my Change code:
O<toolchange_man> sub
(LOGOPEN,toolchanger_man-log.txt)
#<x_change_pos> = 200
#<y_change_pos> = 2
0#<z_change_pos> = 190
#<next_t> = #<tool> 
O1 if [#<_task> EQ 0] 
(debug, Task is null) 
o<toolchange_man> return [999]
O1 endif (this code eliminates tool missing error on load for multiple use tools) 
M5              (LOG, turn off spindle)
M9              (LOG, coolant off)
G40             (LOG, turn cutter comp off)
G49             (LOG, turn tool length offset off)
G10 L2 P1 X0 Y0 Z0 R0
G54
G21             (LOG, metric)
G17             (LOG, select XY plane)
G90             (LOG, absolute distance mode)
G94             (LOG, mm/min mode)
G0 Z190         (LOG, move Z up)
G0 X#<x_change_pos> Y#<y_change_pos>    (LOG, move to change pos)  
G0 Z#<z_change_pos>
G43 H0          (LOG, Override TLO in case of error) 
M0              (LOG, wait for operator to grab tool)
M65 P2          (LOG, release tool)
M0              (LOG, wait for operator to replace tool)
M64 P2          (LOG, clamp tool in spindle)
G4 P2           (LOG, wait for tool to be gripped)(LOGCLOSE)
O<toolchange> endsub

Any ideas what the issue could be? maybe its not reading the tool table properly?
Last edit: 20 Jul 2023 11:45 by Leo75Wolf.

Please Log in or Create an account to join the conversation.

More
20 Jul 2023 11:57 #275891 by andypugh
Maybe you need an actual M61 in your remap routine? Nothing in there is actually setting a tool number.
The following user(s) said Thank You: Leo75Wolf

Please Log in or Create an account to join the conversation.

More
20 Jul 2023 12:17 #275893 by Leo75Wolf
Do i? i thought that was not necessary. I will try that.

Please Log in or Create an account to join the conversation.

More
20 Jul 2023 12:33 #275894 by Leo75Wolf
Alright this works now! Thank you so much!

Please Log in or Create an account to join the conversation.

More
20 Jul 2023 13:23 #275896 by andypugh

Do i? i thought that was not necessary. I will try that.
 

If you want to also use the built-in behaviour, then you need it in the remap:

linuxcnc.org/docs/stable/html/remap/rema...cluding_code_m6_code

Please Log in or Create an account to join the conversation.

More
20 Jul 2023 18:29 #275909 by Leo75Wolf
That whole custom toolchange macro topic is just super confusing but im slowly getting the hang of it. Thanks!

Please Log in or Create an account to join the conversation.

Time to create page: 0.087 seconds
Powered by Kunena Forum