Dave
Hope this helps
Here is what I do on one of my HighSpeed posts to insert high speed on -
off code - I think similar to what your after
Here is the FIL
CIMFIL/ON,LOADTL
DMY=POSTF(20)
GI=0
CCOM=0
IF(TLCHG.EQ.0)THEN
TLCHG=1
DMY=POSTF(21)
DMY=POSTF(13)
ELSE
INSERT/'G91G28Z0.$'
INSERT/'M110$'
DMY=POSTF(21)
DMY=POSTF(13)
ENDIF
CIMFIL/OFF
CIMFIL/ON,GOTO
DMY=POSTF(20)
IF(GI.EQ.0)THEN
GI=1
DMY=POSTF(21)
DMY=POSTF(13)
INSERT/'G5P10000$'
INSERT/'M7$'
ELSE
DMY=POSTF(21)
DMY=POSTF(13)
ENDIF
CIMFIL/OFF
CIMFIL/ON,SPINDL
DMY=POSTF(20)
SOFF=POSTF(7,4)
IF(SOFF.EQ.(ICODEF(OFF)))THEN
INSERT/'G5P0$'
INSERT/'M9$'
DMY=POSTF(21)
DMY=POSTF(13)
ELSE
SSPED=POSTF(7,5)
INSERT/'S',SSPED,'M3$'
INSERT/'G90G54'
ENDIF
CIMFIL/OFF
Here is the resulting NC code G5P1000 turns on G5P0 turns off
G40G80G49G17
G91G28Z0.
T12
M6
T10
S4500M3
G90G54G00G43Z127.H12
X-65.Y-.01
G5P10000
M7
G01Z27.5F3000.
X65.F1800.
G00Z127.
X-65.
G01Z26.8F3000.
X65.F1800.
G00Z127.
G5P0
M9
M5