
Fanuc系统---分中宏程序
变量名称
#5021:机械坐标-X轴 #5022:机械坐标-Y轴 #5023:机械坐标-Z轴
#5221:G54坐标-X轴 #5222:G54坐标-Y轴 #5223:G54坐标-Z轴
#5241:G55坐标-X轴 #5242:G55坐标-Y轴 #5243:G55坐标-Z轴
#5261:G56坐标-X轴 #5262:G56坐标-Y轴 #5263:G56坐标-Z轴
#5281:G57坐标-X轴 #5282:G57坐标-Y轴 #5283:G57坐标-Z轴
#5301:G58坐标-X轴 #5302:G58坐标-Y轴 #5303:G58坐标-Z轴
#5321:G59坐标-X轴 #5322:G59坐标-Y轴 #5323:G59坐标-Z轴
程序
O9999
#10=54(G54-G55-G56-G57-G58-G59):选择分中坐标系
M03S750:主轴正转750/min
M00
#1=#5021(X:1):X轴第一点
M00
#2=#5021(X:2):X轴第二点
M00
#3=[#1+#2]/2(=):计算X轴中间值
M00
#4=#5022(Y:1):Y轴第一点
M00
#5=#5022(Y:2):Y轴第二点
M00
#6=[#4+#5]/2(=):计算Y轴中间值
M00
IF[#10EQ54]GOTO54(G54):跳转G54
IF[#10EQ55]GOTO55(G55):跳转G55
IF[#10EQ56]GOTO56(G56):跳转G56
IF[#10EQ57]GOTO57(G57):跳转G57
IF[#10EQ58]GOTO58(G58):跳转G58
IF[#10EQ59]GOTO59(G59):跳转G59
N54#5221=#3(G54-X):将X中间值赋予G54X
#5222=#6(G54-Y):将Y中间值赋予G54Y
GOTO100:跳转至N100程序段号
以下同理
▽-▽-▽-▽-▽-▽-▽-▽-▽-▽-▽-▽-▽-▽-▽-▽
N55#5241=#3(G55-X)
#5242=#6(G55-Y)
GOTO100
N56#5261=#3(G56-X)
#5262=#6(G56-Y)
GOTO100
N57#5281=#3(G57-X)
#5282=#6(G57-Y)
GOTO100
N58#5301=#3(G58-X)
#5302=#6(G58-Y)
GOTO100
N59#5321=#3(G59-X)
#5322=#6(G59-Y)
N100M05
M30