.....I do think that it would be a fairly simple fix at the initial Ladder logic level.....
Yes. It only takes a single rung to place the tool number into R72 (internal register for Meldas controls where macro system variable #1132 is set) All one has to do is figure out what internal register the machine builder chose to store that number in and transfer it using the logic MOV command. This is an example of the rung added to my Mori that performs the task.
R1900 is the internal PLC register where Mori stores the current spindle tool.
M3108 is the pulsed state of a logic action that indicates the toolchange is completed.
So when M3108 pulses on, the MOV command copies the contents of R1900 to R72.
NOTE:the use of M3108 and R1900 are determined by the machine builder. One can not assume that this will be the same for a machine from a different builder or even a different model from the same builder!
Depending on the rest of the logic in the PLC will determine how one would use a macro to determine if the toolchange should be skipped or performed.
On a Meldas 50 and 500 series parameter 1197 and 7312 would set to 1 and the tool call macro program number set in parameter 7313 (9005 for this example). The tool call macro could look something like...
O9005
IF [#20EQ#1132] GOTO10 (checks to see if the tool called by the program is the same as the tool in the spindle. If it is, it skips to line N10 bypassing the tool call T#20)
T#20
N10
M99
Then you set parameter 1195 to 1 and set 6 in parameter 7001, set 1 in parameter 7002 and the toolchange macro in 7003 (9006 in this example). The tool change macro could look something like...
O9006
IF [#20EQ#1132] GOTO10 (checks to see if the tool called by the program is the same as the tool in the spindle. If it is, it skips to line N10 bypassing the tool change M6)
M6
N10
M99
The above macros are bare bones with no error checking. One might want to add some error trapping to check for a tool call out of range for example so the program would stop with an error message indicating an invalid too number was called. Depending on how the PLC logic was written by the machine builder would determine if one needed to do that or not. Sounds like OKK has already got some amount of logic to check for a tool number not found in the magazine so probably not needed.