bumping an old thread here, but i think i have an easy solution to the original question...
quick aside; sanderal, great post! i've not seen any documentation for the "file" functionality you are utilizing, which has many other potential uses as well (an offsetting program at the bottom of the posted program to offset used tools... etc
back to the OP's question, use this:
Upon Every [DComp]
'( OPERATION ' j[block] ' )'
'( TOOL CHANGE CODE HERE? )'
note: i don't use 'block' otherwise... if you do you need a better way to track which operation it is... but with this you'll see where it inserts the code (after rapid plane, before xy move, but modal so you'll want to code that in)
j >4 "" # Operation #
Sequence#s N 0 1 1 # block Char-Freq-Incr-Start
hope this helps... if not for OP at least for someone who searches and finds this... and if anyone is interested i can post the whole post, but my MO is handle the differing code at the machine in the macros (mainly the M6 macro) so the post will seem simplistic, ie (example code, do not run (my M6 macro sets everything... absolute, rapid, no offsets, AI off then back on, home z, maybe move xy, coolant off, etc...):
Operation 2 is where the OP's question would come into play... so you'd want to put the tool change info (and tool header code) into this Upon Every... and probably just a comment in the ToolChange sequence...
POPEN(11.57.52 PM 6/28/2011)
( OPERATION 1 )
M1(TOOL3 0. CHAMFER MILL)
( OPERATION 2 )
( OPERATION 3 )
M1(TOOL11 0.0995 DRILL)
ps: the "mod 1000" trick also mentioned works great (i use 1000 not 100 in the hopes of someday having a machine with over 100 tools but its main flaw: you have to change tool numbers when you move operations around, insert toolpaths, etc... it becomes cumbersome... but i still use it for a "production" posted program that maybe have one specific operation (like finishing pass after a long cycle of roughing with the same tool... those cases where the "DComp" post above is too slow (ie too many z-retractions at the toolchange... which i guess could be eliminated in the macros but mine home z at every toolchange right now)
pps: and what i actually use this DComp trick for is the lathes, switching between CSS and RPM, and IPM and IPR:
Upon Every [DComp]
'( OPERATION ' h[block] ' )'
if [SpeedType] = [val4] AND [Speed] = [val5]
Call Custom1 # Speed(Type) Change
if [FeedType] <> [val6]
Call Custom3 # FeedType Change