华中数控铣床宏程序实例
G17G02Y[9+#2]X[-25-#2]R[45+#2]
X[#2]R[#2+13]
X[25+#2]R[#2+13]
X[-#2]Y[-#2-21]R[45+#2]
#1=#1-1.5
ENDW
G00Z50
M30
O0006(粗铣椭球)
%0006
G54G00X0Y0Z50
M03S1500
G01Z0F250
Z5
G01Z0F250
#1=180
WHILE#1LT270
#2=30*COS[#1*PI/180]
#3=30*SIN[#1*PI/180]
G18G01X[#2]Z[#3]
#4=#2
WHILE#4GE0
G17G01X[#4]
G02I[-#4]
#4=#4-5
ENDW
G01X[#2]
#1=#1+1
ENDW
#0=#0+1
#2=#2+5/360
ENDW
#1=#1+5
ENDW
G00Z50
M30
(球综合粗铣)
G54G00X-38Y0Z50
M3S1500
Z3
G01Z0F250
#1=90
WHILE#1GE0
#2=-38+15*COS[#1*PI/180]
#3=15*SIN[#1*PI/180]-15
G18G02X[#2]Z[#3]R15
G00Z50
M30
(精铣)
G54G00X0Y0Z50
M03S1500
Z5
G01Z0F250
#1=180
WHILE#1LT270
#2=30*COS[#1*PI/180]
#3=30*SIN[#1*PI/180]
G18G01X[#2]Z[#3]
G17G02I[-#2]
#1=#1+1
ENDW
G00Z50
M30
ENDW
G00Z5
X-10
#6=270
WHILE#6GE180
#7=14*COS[#6*PI/180]
#8=10*SIN[#6*PI/180]
#9=#7-10
#10=#7+28
#11=ABS[#9*COS[72*PI/180]]
#12=ABS[#9*SIN[72*PI/180]]
#13=ABS[#9*COS[144*PI/180]]
G17G01X[#6]Y[#7]
#5=#5+1
ENDW
#4=#4+5
ENDW
G01X[#2]
#1=#1-10
G00Z50
M30
(精铣椭球)
G54G00X0Y0Z50
M03S1500
Z5
G01Z0F250
#1=90
WHILE#1GE0
#2=38*COS[#1*PI/180]
#3=28*SIN[#1*PI/180]
G18G01X[#2]Z[#3]
#6=0
WHILE#6LT360
#7=#2*COS[#6*PI/180]
#8=#4*SIN[#6*PI/180]
G17G01X[#7]Y[#8]
#6=#6+1
ENDW
#1=#1-1
ENDW
G00Z50
M30
(铣螺旋)
G54G00X0Y0Z50
M03S1500
Z3
G01Z0F250
#4=#2
WHILE#4LT0
G01G17X[#4]
G02I[-#4]
#4=#4+5
ENDW
G01X[#2]
ENDW
#5=180
WHILE#5LT270
#6=23*COS[#5*PI/180]
#7=23*SIN[#5*PI/180]-15
G18G01X[#6]Z[#7]
#8=#6
WHILE#8GE0
ENDW
G00Z50
M30
o0002(花)
%0002
G54G00X0Y0Z50
M03S1500
Z5
G01Z0F250
#1=90
WHILE#1GE0
#2=10*COS[#1*PI/180]
#3=10*SIN[#1*PI/180]-10
G18G01X[#2]Z[#3]
G17G02I[-#2]
#1=#1-1.5
(粗铣变形凹椭球)
G54G00X30Y0Z50
M03S1500
Z3
G01Z0F250
#1=0
WHILE#1GE[-90]
#2=35*COS[#1*PI/180]
#3=30*SIN[#1*PI/180]
G18X[#2]Z[#3]
#8=#2
WHILE#8GE3
G01X[#8]
#4=0
WHILE#4LT360
Y-42
G02J42
Y0R21
G03Y42R21
G01Y60
G40X-20
#1=#1-1
ENDW
G00Z50
M30
O0004(椭圆铣平面)
%0004
G54G00X0Y0Z50
M03S1500
Z5
G01Z-3F250
#1=41
WHILE#1GE5
G01X[#1]
#2=0
WHILE#2LT360
#3=#1*COS[#2*PI/180]
G18X[#2]Z[#3]
#4=0
WHILE#4LT360
#6=#2*COS[#4*PI/180
#7=#2*4/5*SIN[#4*PI/180]
G17G01X[#6]Y[#7]
#4=#4+1
ENDW
#1=#1-1
ENDW
G00Z50
M30
O0007(凹球)
%0007
G54G00X0Y0Z50
M03S1500
X0Y-21R45
G03Y-75R30
G01G40Y-80
#1=#1+3
ENDW
G00Z50
M30
(粗铣变形凹椭球)2
G54G00X0Y0Z50
M03S1500
Z3
G01Z0F250
#1=0
WHILE#1GE[-90]
#0=ABS[#1]+90
#2=35*COS[#1*PI/180]
#3=35*SIN[#1*PI/180]
G01G17X[#8]
G02I[-#8]
#8=#8-5
ENDW
G17G01X[#6]
#5=#5+10
ENDW
G00Z50
M30
(精铣球综合)
G54G00X-38Y0Z50
M3S1500
Z3
G01Z0F250
#1=90
WHILE#1GE0
#2=-38+15*COS[#1*PI/180]
#3=15*SIN[#1*PI/180]-15
华中数控铣床宏程序实例
O0001(分开的太极)
%0001
G54G00X-30Y30Z50
M03S1000
Z3
#0=4
#2=90
WHILE#2LT180
G01Z[#0*SIN[#2*PI/180]]F200
#101=ABS[#0*COS[#2*PI/180]]
G01G41Y9D101
X7
G02Y-9R9
#5=#8*COS[#4*PI/180]
#6=25*SIN[#4*PI/180]
G17X[#5]Y[#6]
#4=#4+1
ENDW
#8=#8-5
ENDW
G01X[#2]
#1=#1-10
ENDW
G00Z50
M30
(精铣)
G54G00X30Y0Z50
M03S1500
Z5
G01Z0F250
#1=90
WHILE#1GE0
#1=90
WHILE#1GE0
#2=39*COS[#1*PI/180]
#3=29*SIN[#1*PI/180]
G18X[#2]Z[#3]
#4=#2
WHILE#4LT43
G01X[#4]
#5=0
WHILE#5LT360
#6=#4*COS[#5*PI/180]
#7=#4*4/5*SIN[#5*PI/180]
#4=#1*4/5*SIN[#2*PI/180]
G01X[#3]Y[#4]
#2=#2+1
ENDW
#1=#1-5
ENDW
G00Z50
M30
其二
G54G00X43Y0Z50
M03S1500
Z5
G01Z-3F250
#1=43
WHILE#1GE5
G01X[#1]
#2=360
WHILE#2GE0
#3=#1*COS[#2*PI/180]
#2=36*COS[#1*PI/180]
#3=31*SIN[#1*PI/180]
G18G01X[#2]Z[#3]
#8=0
WHILE#8LT360
#5=#2*COS[#8*PI/180]
#6=27*SIN[#8*PI/180]
G17G01X[#5]Y[#6]
#8=#8+1
ENDW
#1=#1-1
ENDW
#4=#1*4/5*SIN[#2*PI/180]
G01X[#3]Y[#4]
#2=#2+1
ENDW
#1=#1-5
ENDW