I don't know how to delete this post.
I don't know how to delete this post.
My guess with out looking at the whole post is that "pretract" is being called more than once.
Try call it in independently say "ptoolcheck" put your if statement in that and use it where you need it.
For a new opp without tool change you might want to use a switch so it can be set to check tool but only print code before the next tool change..
Sent from my SM-G955F using Tapatalk