# --------------------------------------------------------------------------
#Address string definitions 位址串定义 strm \strn \stro \strp \srad \srminus \sblank
#Cantext 字符串定义 (spaces must be padded here) sm00 \sm01 \strtextno strcantext
# -------------------------------------------------------------------------- # 错误信息
# --------------------------------------------------------------------------
saxiswarn \ WARNING-THE RAD OF ARC IS TOO LARGE\
# --------------------------------------------------------------------------
# 一般的 G 和 M 代码串选择表 General G and M Code String select tables # -------------------------------------------------------------------------- # 运动 G 代码选择
sg00 G00 #快速定位 sg01 G01 #直线进给
sg02 G02 #圆弧插补 CW sg03 G03 #圆弧插补 CCW sg04 G04 #暂停
sgcode #Target for string
fstrsel sg00 gcode sgcode
# -------------------------------------------------------------------------- # 选择工作平面 G 字串
sg17 G17 #XY 平面代码 sg19 G19 #YZ 平面代码 sg18 G18 #XZ 平面代码 sgplane #Target string
fstrsel sg17 plane sgplane
# -------------------------------------------------------------------------- #选择 英制/米制 字串 sg20 G20 #英制代码 sg21 G21 #米制代码
smetric #Target string
21
fstrsel sg20 met_tool smetric
# -------------------------------------------------------------------------- #选择参考点回归字串
sg28 G28 #第一参考点回归 sg30 G30 #第二参考点回归 sg28ref #Target string
fstrsel sg28 mi3 sg28ref
# -------------------------------------------------------------------------- # 切削补偿 G 字串选择
scc0 G40 #切削补偿取消 scc1 G41 #切削左补偿 scc2 G42 #切削右补偿
sccomp #Target for string
fstrsel scc0 cc_pos sccomp
# -------------------------------------------------------------------------- # 钻孔固定循环字符串选择
sg81 G81 #钻孔 - 无暂停 sg81d G82 #钻孔 - 有暂停 sg83 G83 #啄式钻孔 - 无暂停 sg83d G83 #啄式钻孔 - 有暂停 sg73 G73 #断屑 - 无暂停 sg73d G73 #断屑 - 有暂停 sg84 G84 #攻螺纹 - 右手 sg84d G74 #攻螺纹 - 左手 sg85 G85 #镗孔 #1 - 无暂停 sg85d G89 #镗孔 #1 - 有暂停 sg86 G86 #镗孔 #2 - 无暂停 sg86d G86 #镗孔 #2 - 有暂停 sgm1 G76 #misc #1 - 无暂停 sgm1d G76 #misc #1 - 有暂停 sgm2 G81 #misc #2 - 无暂停 sgm2d G82 #misc #2 - 有暂停 sgdrill #Target for string
fstrsel sg81 drlgsel sgdrill
# -------------------------------------------------------------------------- # 选择增量或绝对 G字符串 sg90 G90 #绝对代码 sg91 G91 #增量代码 sgabsinc #Target string
fstrsel sg90 absinc sgabsinc
# -------------------------------------------------------------------------- #钻孔固定循环参考高度
22
sg98 G98 #Z轴回到起始高度 sg99 G99 #Z轴回到参考高度 sgdrlref #Target for string
fstrsel sg98 drillref sgdrlref # Drill cycle G string select # -------------------------------------------------------------------------- # Generate string for spindle sm04 M04 #主轴反转 sm05 M05 #主轴停止 sm03 M03 #主轴正转 spindle #Target for string
fstrsel sm04 spdir2 spindle
# -------------------------------------------------------------------------- # 冷却 M 字符串选择
sm09 M09 #冷却液 Off sm08 M08 #冷却液 喷射 sm08_1 M08 #冷却液 喷雾 sm08_2 M08 #Coolant Tool scoolant #Target for string
fstrsel sm09 coolant scoolant
# -------------------------------------------------------------------------- # 定义齿轮选择代码
flktbl 1 3 #Lookup table definition - table no. - no. entries 40 0 #底速齿轮档 41 400 #中速齿轮档 42 2250 #高速齿轮档
# -------------------------------------------------------------------------- # 刀具交换 / NC输出变量格式
# -------------------------------------------------------------------------- fmt T 4 t #刀具号
fmt T 4 first_tool #第一把使用的刀具 fmt T 4 next_tool #下一把使用的刀具 fmt D 4 tloffno #直径偏移号 fmt H 4 tlngno #长度偏移号
fmt G 4 g_wcs #WCS G address fmt P 4 p_wcs #WCS P address fmt S 4 speed #主轴转速 fmt M 4 gear #Gear range
# -------------------------------------------------------------------------- fmt N 4 n #序号
fmt X 2 xabs #X 坐标输出 fmt Y 2 yabs #Y 坐标输出 fmt Z 2 zabs #Z 坐标输出 fmt X 3 xinc #X 坐标输出
23
fmt Y 3 yinc #Y 坐标输出 fmt Z 3 zinc #Z 坐标输出
fmt I 3 i #x 轴方向上的圆弧中心描述 fmt J 3 j #y 轴方向上的圆弧中心描述 fmt K 3 k #z 轴方向上的圆弧中心描述 fmt R 2 arcrad #圆弧半径 fmt F 15 feed #进给率 fmt P 11 dwell #暂停
fmt M 5 cantext #Canned text
# -------------------------------------------------------------------------- #Move comment (pound) to output colon with program numbers fmt O 7 progno #Program number #fmt \ progno #Program number
# -------------------------------------------------------------------------- fmt Q 2 peck1 #First peck increment (positive) fmt Q 2 shftdrl #Fine bore tool shift fmt R 2 refht_a #Reference height fmt R 2 refht_i #Reference height
# -------------------------------------------------------------------------- fmt \ 4 tnote # 注释格式 fmt \ toffnote # 注释格式 fmt \ 4 tlngnote # 注释格式 fmt \ 1 tldia # 注释格式
# --------------------------------------------------------------------------
# Tool Comment / Manual Entry Section 刀具注释/手工输入部分 # -------------------------------------------------------------------------- ptoolcomment #Comment for tool tnote = t
toffnote = tloffno tlngnote = tlngno
\ pstrtool #Comment for tool if strtool <> sblank, [
strtool = ucase(strtool) *strtool, \ ]
pcomment #Comment from manual entry (must call pcomment2 if booleans) pcomment2
pcomment2 #Comment from manual entry scomm = ucase (scomm)
if gcode = 1007, \ else, \
24
# -------------------------------------------------------------------------- # 文件起始和刀具交换设置
# -------------------------------------------------------------------------- psof0 #Start of file for tool zero psof
psof #Start of file for non-zero tool number toolchng = one if ntools = one, [
#skip single tool outputs, stagetool must be on stagetool = m_one !next_tool ] \ *progno, e
\
\ ptoolcomment
pbld, n, *sgcode, *sgplane, \ sav_absinc = absinc
pcom_moveb
absinc = zero
pcan1, pbld, n, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, *zr, *speed, *spindle, pgear, strcantext, e pe_inc_calc ps_inc_calc
absinc = sav_absinc pbld, n, sgabsinc, e
pretract #刀具路径末尾,换刀 sav_absinc = absinc absinc = one
sav_coolant = coolant coolant = zero
#cc_pos is reset in the toolchange here cc_pos = zero gcode = zero
pbld, n, sccomp, *sm05, e
absinc = sav_absinc coolant = sav_coolant
25