4. 常用的三轴数控铣削编程后置处理
在模具、航空航天等行业中,数控铣削加工中的三轴联动切削应用最为广泛。MasterCAM系统提供了如FANUC、MAHO、Heidenhane、Century6X等众多数控系统的三轴铣削编程后处理程序,但是由于在程序起始控制、刀具说明、输出格式、程序传输等方面各数控系统有所差异,且企业为实现其程序的可读性、简洁性、可复用性、易管理性、减少手工的修改量等方面的要求,必须对后处理程序进行二次开发。下面为针对典型的数控系统,如FANUC、Century6X等对象,在输出格式、程序起始、刀具等方面介绍了如何修改其后处理程序,并以实例的形式进行了说明。

图8 X、B轴联动加工程序代码
(1)字符输出格式的控制
下面的内容主要用于单位输出和精度等方面的控制,系统可以mm、μm为单位输出,同时对小数点后的输出精度、绝对值和增量值进行输出控制。系统参数变量fs2存储不同的数字1~15,实现其输出格式的控制。
# Format statements - n=nonmodal, l=leading, t=trailing, i=inc, d=delta
#Default english/metric position format statements
fs2 10.7 0.6 #Decimal, absolute, 7 place, default for initialize (:)
fs2 20.4 0.3 #Decimal, absolute, 4/3 place
fs2 30.4 0.3d #Decimal, delta, 4/3 place
#Common format statements
fs2 41 0 1 0 #Integer, not leading
fs2 52 0 2 0l #Integer, force two leading
fs2 63 0 3 0l #Integer, force three leading
fs2 74 0 4 0l #Integer, force four leading
fs2 90.1 0.1 #Decimal, absolute, 1 place
(2)程序起始说明与控制
主要用于实现其程序起始在加工产品对象、坐标系定义等方面的规范控制。
# Start of File and Toolchange Setup
psof0 #Start of file for tool zero
……
"%", e
# *progno, e
"", sprogname, "", e
"(Product:)", e
pbld,"", *smetric, e
pbld,"", "", "", "", "", "", "", e
……
if stagetool >= zero, pbld,"", *t, "M6","(Tools:)", e
pindex
if mi1 > one, absinc = zero
pcan1, pbld,"", "G00 G17 G40 G49 G80 G54", *sgabsinc, pwcs, pfxout, pfyout,
"", *speed, *spindle, pgear, strcantext, e
pbld,"", "G43", *tlngno, pfzout, scoolant, next_tool, e
……
c_msng #Single tool subprogram call
(3)刀具交换与注释说明
用于刀具交换及返回参考点等方面的控制功能。
ptlchg #Tool change
pcuttype
toolchng = one
if mi1 = one, #Work coordinate system
[
pfbld, "", *sg28ref, "", "Y200.", e
pfbld, "", "G92", *xh, *yh, *zh, e
]
pbld,"", "M01", e
pcom_moveb
c_mmlt #Multiple tool subprogram call
ptoolcomment
comment
pcan
pbld,"", *t, "M6","(Toolnotes:)", e
……
c_msng #Single tool subprogram call
(4)程序结束输出控制
不同的数控系统在程序结束时有所不同,下述代码为例。
pretract #End of tool path, toolchange
……
pcan
pbld,"", sccomp, psub_end_mny, e
pcan1, pbld,"", "", "G00 G49", "G30 Z250.M05", scoolant, strcantext, e
pbld,"", *sg28ref, "", "Y50.", "", e
pcan2
absinc = sav_absinc
coolant = sav_coolant