I'm glad that you caught the other changes that were being made. Who would have thought that variable would change so many things?
Phew, that is one complicated post! (at least for an amateur like me)
OK, I've looked at it much harder, and I'm thinking changing a line in the following section...
if (properties.sequenceNumberOperation) {
showSequenceNumberNext = true;
}
if (insertToolCall) {
if (!retracted) {
goHomeZ();
retracted = true;
}
if (tool.number > 99) {... so that it matches the following...
if (properties.sequenceNumberOperation) {
showSequenceNumberNext = true;
}
// if (insertToolCall) {
if (1==1) { // 2018/02/17 - above line commented out and replaced so this section is always executed
if (!retracted) {
goHomeZ();
retracted = true;
}
if (tool.number > 99) {... is probably a better way to force the tool change every time. If it were me, I'd remove the first change and try this new one.
It looks, to me, like this is the section that writes the tool change. Before this stuff is ran it checks if "insertToolCall" is "true" first. This change removes that check and replaces it with "does 1 equal 1", so that section should always be run. (Unless something higher up is stopping it or something...) Unfortunately, I don't currently have a way to test a turning post so I can't check it myself.
Though, I suppose having an M0 before and an M5 after every op, when it also thinks the tool is being changed for every op, makes sense. If this change doesn't work (or effects more than we bargained for) maybe the next step would be to make the post check the tool offset at the start of each operation and make a tool call if it finds that it has changed. That would probably work even better. I've been staring at my own post for too long today already, but I'm thinking this would be entirely possible. If this change here doesn't do what you want, lemme know and I'll take one more stab at it. 🙂
In the attached image the proposed change is highlighted in pink. Also, in blue is one of the only instances of "M0" output that I could find. Commenting that line out might stop the there are too many M0s problem, but it might also make a new there aren't enough M0s problem!