Code:
psub_call_trans #Translate level calls from toolchange, user
if mi1$ <= one, result = mprint(shomeserror)
sav_absinc = absinc$
#Mirror or Rotate Coord's
if sub_trnstyp$ = zero | (sub_trnstyp$ = one & mr_rt_actv),
[
#The original pattern is not mirrored or rotated
if sub_sec_no$,
[
absinc$ = zero
if sub_trnstyp$, psub_rotate
else, psub_mirror
]
mr_rt_actv = three
]
else, #Translate
[
if sub_mny_t$,
[
if mi1$ > one, absinc$ = zero
pbld, n$, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, pfzout, e$
pe_inc_calc
ps_inc_calc
]
]
absinc$ = sav_absinc
result = nwadrs(strp, main_prg_no$)
main_prg_no$ = main_prg_no$ + progno$
if progno$ = main_prg_no$, result = mprint(sprgnerror)
pbld, n$, "M98", *main_prg_no$, e$
prv_feed = c9k #Force feed in sub
psub_mirror #Mirror start code, user
#Mirror Y axis
if sub_trnmthd$, pbld, n$, *sgabsinc, strns_mir_on, *sub_trnsx$, e$
#Mirror X axis
else, pbld, n$, *sgabsinc, strns_mir_on, *sub_trnsy$, e$
psub_rotate #Rotate start code, user
pbld, n$, *sgcode, *sgabsinc, strns_rot_on, *sub_trnsx$, *sub_trnsy$,
[absinc$ = one], *sgabsinc, e$
psub_st_m$ #Header in main level
result = nwadrs(stro, main_prg_no$)
"()", e$
*main_prg_no$, "(SUB USED IN", *progno$, ")", e$
#G51/G68 requires absolute position on first move
if mr_rt_actv & absinc$ = one,
[
sav_absinc = absinc$
absinc$ = zero
prv_absinc$ = m_one
prv_xabs = m_one
prv_yabs = m_one
]
else, pbld, n$, sgabsinc, e$