[数控车/加工中心] 万能铣圆柱、圆孔、方块宏程序(加工中心)

[复制链接]
查看50 | 回复1 | 2020-1-8 22:56:11 | 显示全部楼层 |阅读模式
这是一名铣削大神的宏程序编程刀路,有兴趣的可以试试。
G91G28Z0.
#1=2(#1=1铣孔。=2铣圆柱。=3铣方)
#2=6(刀具直径)
#3=10(圆直径)
#4=20(方块长)
#5=20(方块宽)
#7=2(加工深度)
#8=10
#9=#2*0.3
#10=0.1
#11=0.15
IF[#1EQ1]GOTO1
IF[#1EQ2]GOTO2
IF[#1EQ3]GOTO3

N1
IF[[#3/2-#2/2]GT[#2/2]]GOTO88
IF[[#3/2-#2/2]LE0]GOTO100
G40G49G80
G91G28Z0.
G0G90G54X0Y0
M3S8000
#110=#11
Z5.
G1Z0.F1000
WHILE[#110LT#7]DO1
IF[#110GT#7]THEN#110=#7
G1Z-[#110]F1000.
G3X[#3/2-#2/2]I[[#3/2-#2/2]/2]F4000
I-[#3/2-#2/2]
X0.I-[[#3/2-#2/2]/2]
#110=#110+#11
END1
G3X[#3/2-#2/2]I[[#3/2-#2/2]/2]F1000
I-[#3/2-#2/2]
X0.I-[[#3/2-#2/2]/2]
G0Z5.
M5
M9
G91G28Z0.
M30

N2
IF[[#3/2+#2/2]LE[#2/2]]GOTO100
G40G49G80
G91G28Z0.
G0G90G54X0Y0
M3S8000
#110=#11
Z5.
X[#3/2+#2/2]
G1Z0.F1000
WHILE[#110LT#7]DO1
IF[#110GT#7]THEN#110=#7
(G1 Z-[#110] )
G2I-[#3/2+#2/2]Z-[#110]F2000
#110=#110+#11

END1
G2I-[#3/2+#2/2]F1000.
G1X[#3/2+#2/2+0.1]
G0Z5.
M5
M9
G91G28Z0.
M30

N3
G40G49G80
G91G28Z0.
G0G90G54X0Y0
M3S8000
X-[#4/2+#2/2] Y[#5/2+#2/2]
Z5.
G1 Z0.
#110=#11
WHILE[#110 LT#7] DO1
G1 X[#4/2+#2/2] Z-[#110] F4000
#110=#110+#11
Y-[#5/2+#2/2]Z-[#110]
#110=#110+#11
X-[#4/2+#2/2]Z-[#110]
#110=#110+#11
Y[#5/2+#2/2]Z-[#110]
#110=#110+#11
IF[#110 GT#7] GOTO99
END1
N99
G1 X[#4/2+#2/2] F1000
Y-[#5/2+#2/2]
X-[#4/2+#2/2]
Y[#5/2+#2/2]
G0 Z5.
M5
M9
G91G28Z0.
M30

N88
#100=#3/2-#2/2-#10
#101=#9/360
#110=#11
G40G49G80
G91G28Z0.
N888
G0G90G54X0Y0
M3S8000
Z5.
G1Z-[#110]F1000
#102=0
#106=0
#105=0
WHILE[#106LE#100]DO1
#105=#105+#8
#106=#105*#101
#107=#106*SIN[#105]
#108=#106*COS[#105]
G1X#108Y#107F3000
#102=#105
END1
G3X#108Y#107I-[#108]J-[#107]F1500.
G0Z3.
X0Y0.
#109=#7-#11
#110=#110+#11
IF[#109GE#110]GOTO888
G0Z3.
X0Y0
Z-[#7-1]
G1Z-[#7]F1000
#102=0
#106=0
WHILE[#106LE#100]DO2
#105=#105+#8
#106=#105*#101
#107=#106*SIN[#105]
#108=#106*COS[#105]
G1X#108Y#107F1000
#102=#105
END2
G3X#108Y#107I-[#108]J-[#107]
G0Z3.
X0Y0
Z-[#7/2]
G3X[#3/2-#2/2]I[[#3/2-#2/2]/2]F1000
I-[#3/2-#2/2]
X0.I-[[#3/2-#2/2]/2]
G1 Z-[#7]
G3X[#3/2-#2/2] I[[#3/2-#2/2]/2]
I-[#3/2-#2/2]
X0. I-[[#3/2-#2/2]/2]
G0 Z5.
M5
M9
G91 G28 Z0.
M30
N100
#3000=1
%

回复

使用道具 举报

浅红 | 2020-1-8 22:57:24 | 显示全部楼层
稍做改动,经过验证,以适合自己用。感谢原发贴者,如有侵权请联系删除此贴!
内容如下:
   %
O7777(Kong/Yuan/Fang)
G91G28Z0.
#190=54(G54--G59)
#191=15(TOOL-NUMBER)

#193=4500(Zhuan-su-S)


#1=3(#1=1KONG/#1=2YUAN/#1=3FANG)
#2=10.(TOOL-DIA)
#3=25.(YUAN/KONG)
#4=30.(FANG-CHANG-L)
#5=30.(FANG-KUAN-K)
#7=0.601(JIA-GONG-SHEN-DU/DP)
#11=0.15(XIA-DAO-LIANG)
#8=10.
#9=#2*0.3
#10=0.15
IF[#1EQ1]GOTO1
IF[#1EQ2]GOTO2
IF[#1EQ3]GOTO3

N1
IF[[#3/2-#2/2]GT[#2/2]]GOTO88
IF[[#3/2-#2/2]LE0]GOTO100
G40G49G80
G91G28Z0.
/M6T#191
G0G90G#190X0.Y0.
M3S#193
#110=#11
G43H#191Z50.
Z5.
G1Z0.F1000
WHILE[#110LT#7]DO1
IF[#110GT#7]THEN#110=#7
G1Z-[#110]F1000.
G3X[#3/2-#2/2]I[[#3/2-#2/2]/2]F4000
I-[#3/2-#2/2]
X0.I-[[#3/2-#2/2]/2]
#110=#110+#11
END1
G3X[#3/2-#2/2]I[[#3/2-#2/2]/2]F1000
I-[#3/2-#2/2]
X0.I-[[#3/2-#2/2]/2]
G0Z5.
M5
M9
G91G28Z0.
M30

N2
IF[[#3/2+#2/2]LE[#2/2]]GOTO100
G40G49G80
G91G28Z0.
/M6T#191
G0G90G#190 X0.Y0.
M3S#193
#110=#11
G43H#191Z50.
X[#3/2+#2/2]
Z5.
X[#3/2+#2/2]
G1Z0.F1000
WHILE[#110LT#7]DO1
IF[#110GT#7]THEN#110=#7
(G1 Z-[#110] )
G2I-[#3/2+#2/2]Z-[#110]F2000
#110=#110+#11

END1
G2I-[#3/2+#2/2]F1000.
G1X[#3/2+#2/2+0.1]
G0Z5.
M5
M9
G91G28Z0.
M30

N3
G40G49G80
G91G28Z0.
G0G90G#190X0.Y0.
M3S#193
X-[#4/2+#2/2]Y[#5/2+#2/2]
G43H#191Z50.
Z5.
G1Z0.
#110=#11
WHILE[#110LT#7]DO1
G1X[#4/2+#2/2]Z-[#110]F4000
#110=#110+#11
Y-[#5/2+#2/2]Z-[#110]
#110=#110+#11
X-[#4/2+#2/2]Z-[#110]
#110=#110+#11
Y[#5/2+#2/2]Z-[#110]
#110=#110+#11
IF[#110GT#7]GOTO99
END1
N99 (Jing-XI)
G1X[#4/2+#2/2]F1000
Y-[#5/2+#2/2]
X-[#4/2+#2/2]
Y[#5/2+#2/2]
G0Z5.
M5
M9
G91G28Z0.
M30

N88
#100=#3/2-#2/2-#10
#101=#9/360
#110=#11
G40G49G80
G91G28Z0.
N888
G0G90G#190 X0.Y0.
M3S#193
G43H#191Z50.

N999

Z5.
G1Z-[#110]F1000
#102=0
#106=0
#105=0
WHILE[#106LE#100]DO1
#105=#105+#8
#106=#105*#101
#107=#106*SIN[#105]
#108=#106*COS[#105]
G1X#108Y#107F3000
#102=#105
END1
G3X#108Y#107I-[#108]J-[#107]F1500.
G0Z3.
X0Y0.
#109=#7-#11
#110=#110+#11
IF[#109GE#110]GOTO999
G0Z3.
X0Y0
Z-[#7-1]
G1Z-[#7]F1000
#102=0
#106=0
WHILE[#106LE#100]DO2
#105=#105+#8
#106=#105*#101
#107=#106*SIN[#105]
#108=#106*COS[#105]
G1X#108Y#107F1000
#102=#105
END2
G3X#108Y#107I-[#108]J-[#107]
G0Z3.
X0Y0
Z-[#7/2]
G3X[#3/2-#2/2]I[[#3/2-#2/2]/2]F1000
I-[#3/2-#2/2]
X0.I-[[#3/2-#2/2]/2]
G1Z-[#7]
G3X[#3/2-#2/2]I[[#3/2-#2/2]/2]
I-[#3/2-#2/2]
X0.I-[[#3/2-#2/2]/2]
G0Z5.
M5
M9
G91G28Z0.
M30
N100
#3000=1
%
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则