# -------------------------------------------------------------------------- # Tool Comment / Manual Entry Section
# -------------------------------------------------------------------------- ptoolcomment #Comment for tool
tnote = t$, toffnote = tloffno$, tlngnote = tlngno$ if tool_info = 1 | tool_info = 3,
sopen_prn, pstrtool, sdelimiter, *tnote, sdelimiter, *toffnote, sdelimiter, *tlngnote, sdelimiter,
*tldia$, sclose_prn, e$
ptooltable #Tooltable output
sopen_prn, *t$, sdelimiter, pstrtool, sdelimiter, *tlngno$,
[if comp_type > 0 & comp_type < 4, sdelimiter, *tloffno$, sdelimiter, *scomp_type, sdelimiter, *tldia$],
[if xy_stock <> 0 | z_stock <> 0, sdelimiter, *xy_stock, sdelimiter, *z_stock], sclose_prn, e$
pstrtool #Comment for tool if strtool$ <> sblank, [
strtool$ = ucase(strtool$) *strtool$ ]
pcomment$ #Comment from manual entry (must call pcomment2) pcomment2 #Required if doing boolean 'if' logic testing!
pcomment2 #Output Comment from manual entry scomm$ = ucase (scomm$)
if gcode$ = 1005, sopen_prn, scomm$, sclose_prn, e$ #Manual entry - as comment if gcode$ = 1006, scomm$, e$ #Manual entry - as code
if gcode$ = 1007, sopen_prn, scomm$, sclose_prn #Manual entry - as comment with move NO e$
if gcode$ = 1026, scomm$ #Manual entry - as code with move NO e$ if gcode$ = 1008, sopen_prn, scomm$, sclose_prn, e$ #Operation comment if gcode$ = 1051, sopen_prn, scomm$, sclose_prn, e$ #Machine name if gcode$ = 1052, sopen_prn, scomm$, sclose_prn, e$ #Group comment if gcode$ = 1053, sopen_prn, scomm$, sclose_prn, e$ #Group name if gcode$ = 1054, sopen_prn, scomm$, sclose_prn, e$ #File Descriptor
# -------------------------------------------------------------------------- # Start of File and Toolchange Setup
# --------------------------------------------------------------------------
ptime #Convert 24-hour time format into 12-hour AM/PM format if time$ >= 13, time2 = (time$ - 12) else, time2 = time$
hour = int(time2), min = frac(time2) *hour, \ if time$ > 12, \ else, \
pheader$ #Call before start of file \
sav_spc = spaces$ spaces$ = 0
*progno$, sopen_prn, sprogname$, sclose_prn, e$
#sopen_prn, \
sopen_prn, \and time output Ex.
12-02-05 15:52
#sopen_prn, \- \month$, \day$, \year$, sclose_prn, e$ #Date output as month,day,year - Ex.
02-12-05
#sopen_prn, \- \*smonth, \day$, \*year2, sclose_prn, e$ #Date output as month,day,year -
Ex. Feb. 12 2005
#sopen_prn, \ #24 hour time output - Ex. 15:52 #sopen_prn, \ #12 hour time output 3:52 PM spathnc$ = ucase(spathnc$) smcname$ = ucase(smcname$) stck_matl$ = ucase(stck_matl$) snamenc$ = ucase(snamenc$)
sopen_prn, \ sopen_prn, \ sopen_prn, \ spaces$ = sav_spc
psof0$ #Start of file for tool zero psof$
psof$ #Start of file for non-zero tool number if ra_error = 1, [if mprint(sra_error, 2) = 2, exitpost$] toolchng = one
if ntools$ = one, [
#skip single tool outputs, stagetool must be on stagetool = m_one !next_tool$ ]
pbld, n$, *smetric, e$
pbld, n$, *sgcode, *sgplane, scc0, sg49, sg80, *sgabsinc, e$ sav_absinc = absinc$
if mi1$ <= one, #Work coordinate system [
absinc$ = one
pfbld, n$, sgabsinc, *sg28ref, \ pfbld, n$, *sg28ref, \ pfbld, n$, sg92, *xh$, *yh$, *zh$, e$ absinc$ = sav_absinc ]
pcom_moveb pcheckaxis
c_mmlt$ #Multiple tool subprogram call ptoolcomment comment$ pcan
pbld, n$, *t$, sm06, e$
if mi1$ > one, absinc$ = zero
pcan1, pbld, n$, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, [if nextdc$ <> 7, *speed, *spindle], pgear, strcantext, e$ pbld, n$, sg43, *tlngno$, pfzout, scoolant, pstagetool, e$ absinc$ = sav_absinc pcom_movea toolchng = zero
c_msng$ #Single tool subprogram call
ptlchg0$ #Call from NCI null tool change (tool number repeats) pcom_moveb pcheckaxis
c_mmlt$ #Multiple tool subprogram call comment$ pcan
result = newfs(15, feed) #Reset the output format for 'feed' pbld, n$, sgplane, e$ pspindchng
pbld, n$, scoolant, e$
if mi1$ > one & workofs$ <> prv_workofs$,
[
sav_absinc = absinc$ absinc$ = zero
pbld, n$, sgabsinc, pwcs, pfxout, pfyout, pfzout, e$ pe_inc_calc ps_inc_calc
absinc$ = sav_absinc ]
if gcode$ = one, plinout else, prapidout pcom_movea
c_msng$ #Single tool subprogram call
ptlchg$ #Tool change toolchng = one
if mi1$ = one, #Work coordinate system [
pfbld, n$, *sg28ref, \ pfbld, n$, sg92, *xh$, *yh$, *zh$, e$ ]
if prog_stop = 1, pbld, n$, *sm01, e$ if prog_stop = 2, pbld, n$, *sm00, e$ pcom_moveb pcheckaxis
c_mmlt$ #Multiple tool subprogram call ptoolcomment comment$ pcan
result = newfs(15, feed) #Reset the output format for 'feed' pbld, n$, *t$, sm06, e$ sav_absinc = absinc$
if mi1$ > one, absinc$ = zero
pcan1, pbld, n$, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, [if nextdc$ <> 7, *speed, *spindle], pgear, strcantext, e$ pbld, n$, sg43, *tlngno$, pfzout, scoolant, pstagetool, e$ absinc$ = sav_absinc pcom_movea toolchng = zero
c_msng$ #Single tool subprogram call
pstagetool #Pre-stage tools if stagetool = 1, [
if ttblend$, #Check for last toolchange
[
if stagetltype = 1, *next_tool$ #stage first tool at last toolchange ]
else, *next_tool$ #stage tool at every toolchange ]
pretract #End of tool path, toolchange sav_absinc = absinc$ absinc$ = one
sav_coolant = coolant$ coolant$ = zero
# if nextop$ = 1003, #Uncomment this line to leave coolant on until eof unless [ # explicitely turned off through a canned text edit if all_cool_off, [
#all coolant off with a single off code here if coolant_on, pbld, n$, *sall_cool_off, e$ coolant_on = zero ] else, [
local_int = zero coolantx = zero while local_int < 20, [
coolantx = and(2^local_int, coolant_on) local_int = local_int + one if coolantx > zero, [
coolantx = local_int pbld, n$, scoolantx, e$ ]
coolantx = zero ]
coolant_on = zero ] ]
#cc_pos is reset in the toolchange here cc_pos$ = zero gcode$ = zero
pbld, n$, sccomp, *sm05, psub_end_mny, e$
pbld, n$, sgabsinc, sgcode, *sg28ref, \
if nextop$ = 1003 | tlchg_home, pbld, n$, *sg28ref, \