一、使用圆弧指令铣削螺纹,使用G2指令铣削,从上到下,则铣削右旋螺纹,参考程序如下:
G90G54G40G1Z100F1000M03S1500
G0X30Y0
Z3
#1=17.7
#2=1.5
G1X#1F300
WHILE[#2GE-24]DO1
G2I-#1Z#2
#2=#2-1.5
END1
G1X0Y0
G1Z5F200
Z100F1000
M5
M30
二、就是利用圆的参数方程,把整圆划分为无数小段直线,并且在走圆过程中,Z向相应递减,逐步插补处螺旋线。从上向下加工中,自变量角度#1要逐步递减,这样才能加工出右旋螺纹。参考程序如下:
G90G54G40G1Z100F1000M03S1500
G0X30Y0
Z1.5
#1=0
#4=17.7
#5=1.5
WHILE[#1GE-5760]DO1
#6=#4*COS[#1]
#7=#4*SIN[#1]
#5=#5-1.5/360
G1X#3
G1X#6Y#7Z#5F2000
#1=#1-1
END1
G1X0Y0
G1Z5F200
Z100F1000
M5
M30