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:
Code:
Upon Every [DComp]
'( OPERATION ' j[block] ' )'
'( TOOL CHANGE CODE HERE? )'
End
with:
Code:
j >4 "" # Operation #
Sequence#s N 0 1 1 # block Char-Freq-Incr-Start
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)
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...):
Code:
%
O0001 (05_FAM_TOP_ENCLOSURE_152TEST)
POPEN(11.57.52 PM 6/28/2011)
DPRNT[//START*05_FAM_TOP_ENCLOSURE_6152984A-01/05_FAM_TOP_ENCLOSURE_152/TEST]
PCLOS
( OPERATION 1 )
M6T3
M1(TOOL3 0. CHAMFER MILL)
G54X-0.2149Y-1.8404M3S12000
G43Z1.H3
/M8
T11
G0Z0.333
G1Z0.1192F60.0
G1Y1.8154
G0Z1.
( OPERATION 2 )
X0.1Y0.1S5500
G81G98X0.1Y0.1Z-0.13R0.1F10.0
G80
( OPERATION 3 )
N11M6T11
M1(TOOL11 0.0995 DRILL)
G54X0.1Y0.1M3S6250
G43Z1.1H11
/M8
T3
G83G98X0.1Y0.1Z-0.25R0.1Q0.0625F15.0
G80
M6T3 R0
M30
%
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...
- joel
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:
Code:
Upon Every [DComp]
'( OPERATION ' h[block] ' )'
if [SpeedType] = [val4] AND [Speed] = [val5]
''
else
Call Custom1 # Speed(Type) Change
endif
if [FeedType] <> [val6]
Call Custom3 # FeedType Change
endif
End