数控编程 技术改造中加工宏程序的编制
1 引言 随着对数控刀具产品质量和经济效益要求的不断提高,我厂原有用于加工可转位硬质合金刀片的WAM336数控周边磨床因电器系统老化、加工工艺落后,已无法满足对刀具产品尺寸一致性和对称度公差严格的加工要求。为此,我们对该机床的电器系统进行了技术改造,并根据改造后的机床特点和加工要求重新编制了磨削直线面和圆弧面的加工宏程序。 2 WAM336数控磨床电器系统技术改造 WAM336数控周边磨床有一个固定主轴和三个进给轴。对该数控磨床的电器系统进行技术改造时,首先必须考虑为三个进给轴选择合适的外部电机。由于外部电机与转动轴相连接,整个外部空间的机械部分无法变更,因此所选电机的外型尺寸及功率必须与原电器系统相匹配。经过考核筛选,西班牙发格公司FAGOR 8055M电器系统的外部电机符合要求,且电器系统价格适中,因此决定采用西班牙FAGOR 8055M电器系统替换原机床电器系统。FAGOR 8055M电器系统具有控制五坐标联动功能,由于WAM336数控磨床只有三个进给轴,因此只需连接三个坐标伺服板驱动机床实现三坐标联动,即可满足WAM336数控磨床的加工工艺要求,磨削加工形状复杂的硬质合金刀片。加工实践表明,更换后的机床电器系统操作简便,加工精度及加工效率均明显优于原系统。 3 加工宏程序的编制 WAM336数控周边磨床主要用于磨削各类具有直线面和圆弧面的硬质合金可转位铣刀片。根据改造后的机床特点和加工要求,我们编制了磨削直线面和圆弧面的工艺宏程序。 磨削直线面的宏程序 磨削直线面的宏程序(9011)如下: %LINE,MX, (SUB 9011) (WRITE G54) (WRITE G90 G0 XP21) (WRITE G90 G0 CP0) (WRITE G90 G0 BP11) (P25 = P1 + 1) (WRITE G90 G0 XP25) (P15 = P1 + ORGX54*(1-1 / COS(P11))) (WRITE G90 G1 XP15 FP20) (WRITE G4 KP23) (WRITE G90 G0 XP21) (WRITE G91 G0 CP2) (WIRTE G90 G0 BP12) (P24 = P3 + 1) (WRITE G90 G0 XP24) (P16 = P3 + ORGX54*(1-1 / COS(P12))) (WRITE G90 G1 XP16 FP20) (WRITE G4 KP23) (WRITE G90 G0XP21) (WRITE G91 G0 CP4) (WRITE G90 G0 BP13) (P22 = P5 + 1) (WRITE G90 G0 XP22) (P17 = P5 + ORGX*(1-1 / COS(P13))) (WRITE G90 G1 XP5 FP20) (WRITE G4 KP23) (WRITE G90 G0 XP21) (WRITE G91 G0 CP6) (WRITE G90 G0 BP14) (P19 = P7 + 1) (WRITE G90 G0 XP19) (P17 = P7 + ORGX54*91-1 / COS(P14))) (WRITE G90 G1 XP17 FP20) (WRITE G4 KP23) (P0 = 0,P1 = 0,P2 = 0,P3 = 0,P4 = 0,P5 = 0,P6 = 0,P7 =0,P8 = 0,P9 = 0,P10 = 0,P11 = 0,P12 = 0,P13 = 0,P14 =0,P15 = 0,P16 = 0,P17 = 0,P18 = 0,P19 = 0,P20 = 0,P21= 0,P22 = 0,P23 = 0,P24 = 0,P25 = 0) (RET) 呼叫一次SUB9011 宏程序可完成磨削四个直线面的加工程序编制。在实际应用中,可根据图纸和工艺要求,通过在演算子程序中连续呼叫SUB9011宏程序来完成磨削任意直线面的加工编程。为此,首先需要建立一个演算子程序(即呼叫子程序),然后在该程序中对参数进行赋值,即可完成加工程序的编制。需要赋值的参变量包括:初始上料角度P0,磨床第一边半径尺寸P1,磨削第二边外夹角P2,磨削第二边半径尺寸P3,磨削第三边夹角P4,磨削第三边半径尺寸P5,磨削第四边外夹角P6,磨削第四边半径尺寸P7,第一边到第四边的后角P11~P14,磨削速度P20,外接圆半径P21,空磨时间P23。 磨削圆弧面的宏程序 磨削圆弧面的宏程序(9010)如下: %CYCLE,MX, (SUB 9010) (WRITE M7) (WRITE G5) (WRITE G90 G1) (P24 = P0) (P25 = SQRT (P1*P1 + P2*P2)) (P23 = P7) (P19 = P23) N10(P20 = P3 - P25) (IF P20 GT 0 G0T0 N30) (P23 = - P7 - ACOS(P1 / P25)) (P19 = P23) N20(P22 = P25*COS(P23)+ P3) (WRITE F10) (WRITE XP22) (WRITE F100) (WRITE CP24) N25(P22 = P25*COS(P23)+ P3) (WRITE XP22 CP24) (P23 = P23 + P12) (P24 = P24 + P12) (IF P23 LE(P19 + P4)GOTO N25) (RET) N30(P23 = P7) (P19 = P23) (P22 = - P25*COS(P23 + P3) (WRITE F10) (WRITE XP22) (P18 = P24 + 90 + P7) (WRITE F100) (WRITE CP18) N35(P22 = - P25*COS(P23)+ P3) (WRITE XP22 CP18) (P23 = P23 + P12) (P18 = P18 = P12) (IF P23 LE(P19 + P4)GOTO N35) (P0 = 0,P1 = 0,P2 = 0,P3 = 0,P4 = 0,P5 = 0,P6 = 0,P7 =0,P8 = 0,P9 = 0,P10 = 0,P11 = 0,P12 = 0,P13 = 0,P14 =0,P15 = 0,P16 = 0,P17 = 0,P18 = 0,P19 = 0,P20 = 0,P21= 0,P22 = 0,P23 = 0,P24 = 0,P25 = 0) (RET) 通过呼叫SUB9010 宏程序,可实现磨削任意形状圆弧面的加工程序编制。使用时,通过对参数赋值即可完成加工程序编制。需赋值的参变量包括:初始磨圆角P0,X 中心坐标P1,Y 中心坐标P2,圆弧半径P3,圆弧转角P4,切线角度P7,圆弧分度P12,圆弧速度P20,外接圆半径P21。 图1 加工实例 现以磨削加工图1所示刀片为例,说明如何调用宏程序SUB9010、SUB9011 和建立演算子程序。 该刀片需要加工的尺寸包括二个直线面(14mm×7mm)和四个圆弧面(4-R2mm)。根据工艺要求,首先磨削直线面,再依次磨削圆弧面。刀片初始上料角度为0°。编制演算子程序如下: (OPEN P8000,D) (WRITE(SUB 8000)) (PCAL9011,P0 = 0,P1 = 3. 50,P2 = 90°,P3 = 7. 00,P4 =90,P5 = 3. 50,P6 = 90°,P7 = 7. 00,P20 = 8,P21 = 12,P23= 100°) (PCALL9010,P0 = 270°,P1 = 5. 00,P2 = 1. 5,P3 = 2,P4 =90°,P7 = 0,P12 = 0.1,P20 = 100,P21 = 12°) (PCALL9010,P0 = 360,P1 = 1. 5,P2 = 5,P3 = 2,P4 = 90,P7 = 0,P12 = 0.1,P20 = 100,P21 = 12°) (PCALL 9010,P0 = 450°,P1 = 5.00,P2 = 1. 5,P3 = 2,P4 =90°,P7 = 0,P12 = 0.1,P20 = 100,P21 = 12°) (PCALL 9010,P0 = 540°,P1 = 1. 5,P2 = 5,P3 = 2,P4 =90°,P7 = 0,P12 = 0.1,P20 = 100,P21 = 12°) (WRITE(RET)) M30 将编制好的演算子程序在机床中运行,生成一个新的磨削子程序P8000。在实际加工中,将P8000连接到主程序中即可实现刀片的磨削。