M6 execution if valid tool is loaded in spindle

More
20 Jan 2022 20:24 #232550 by MichalHK
Hi,

I would ask how to check that tool must be changed? I have M6 remapped and random tool changer.
My M6 code work grat If I call M6 tool is changed. But problem si that Gcode program have only one tool for using.

For example
G54
T1
M6
some milling
M30

If I run program first all is OK. But second run of this couses me change tool for another that I have in pocket so I start milling with different tool.
So I need some condition that tall me, yes change tool, or no correct tool is in spindle, dont change tool.

Thanks for ideas

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

More
20 Jan 2022 23:05 #232569 by cmorley
we need more information. Linuxcnc usual does as you want by default.
We need to see your remap.

I don't understand if you run the program again you get a different tool.

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

More
21 Jan 2022 08:42 #232608 by MichalHK
Ok here is my ini hal and toolchange file. Yes if I run program again tool is changed becouse M6 change it.
Attachments:

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

More
21 Jan 2022 09:47 #232620 by cmorley
Ok it would be helpful to explain the remap code - it looks quite complicated.

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

More
21 Jan 2022 10:26 #232625 by MichalHK
I do some photos of machine for better explanation and rewrite toolchange into english language. There is no magic.
At the start I reset iocontrol.0.tool-changed (M65 P8)
Then simple setting hydraulic valve for tool arm moving by M64 and M65 commands and checking induction sensors by M66 command.
If tool change is succesful I set M64 P8 whitch is iocontrol.0.tool-changed

I think there is no mistake. Tool change macro works great. But I dont understand why linuxcnc call M6 if Im set correct tool in spindle.

 
Attachments:

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

More
21 Jan 2022 11:58 #232630 by MaHa
You can try this at the beginning of o<toolchange>
But program will start immediately, otherwise you need to insert a message and M0 also.
o100 IF [#<selected_tool> EQ #<tool_in_spindle>]
o<toolchange> RETURN [1]
o100 ENDIF

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

Time to create page: 0.083 seconds
Powered by Kunena Forum