上一篇文章分享了通过opinfo函数获取全局最大最小值,下面的代码将通过opinfo函数获取每个刀具及每个操作的最大最小值,相较于其他方法,这个更直观,同时扩展性也更好。
特别说明:
此最大最小值仅适用于在换刀位置输出,不支持在程序头刀具清单里面输出
后面将会发布获取全局,刀具,操作X,Y最大最小值的相关代码。
以下为输出效果:
%
O0
(TEST)
(DATE=DD-MM-YY - 14-12-21 TIME=HH:MM - 20:06)
(------------------------------)
OAL MAX Z= 1.5
OAL MIN Z= -.12
(------------------------------)
G20
G0 G17 G40 G49 G80 G90
(ROUGH PROFILES)
(------------------------------)
MAX TOOL Z = 1.5
MIN TOOL Z = -.12
(------------------------------)
MAX OP Z = 1.5
MIN OP Z = -.12
(------------------------------)
T3 M6
G187 P3 E.001
G0 G90 G55 X-15.1795 Y-.7705 C0. S10000 M3
G43 H3 Z1.5
M8
Z1.1949
G1 Z-.12 F300.
X-15.4662 Y-.3609 F150.
G3 X-15.4775 Y-.3475 I-.082 J-.0573
G1 X-15.5365 Y-.2885
G2 X-15.7049 Y.1181 I.4066 J.4066
G1 Y4.4823
X-15.4184 Y4.7688
G2 X-15.0118 Y4.9372 I.4066 J-.4066
G1 X-14.3309
X-14.2453 Y5.0041
X15.2342
X15.5995 Y4.6389
G2 X15.7679 Y4.2323 I-.4066 J-.4066
G1 Y.1968
G2 X15.5995 Y-.2097 I-.575 J0.
G1 X15.2342 Y-.575
X11.428
G2 X10.9577 Y-.4661 I-.0385 J.9035
G1 X9.163 Y.6455
X3.9039
X2.1508 Y-.4415
G2 X1.6819 Y-.575 I-.4689 J.7564
G1 X-.5862
X-15.0118
G2 X-15.4184 Y-.4066 I0. J.575
G1 X-15.4775 Y-.3475
G3 X-15.4908 Y-.3363 I-.0707 J-.0707
G1 X-15.9004 Y-.0495
G0 Z1.5
(ROUGH POCKET #1 WALL)
(------------------------------)
MAX OP Z = 1.5
MIN OP Z = .12
G187
X-10.9533 Y2.3478
Z1.1949
G1 Z1. F300.
X-11.3196 Y2.8576 Z.12
X-11.3505 F150.
G2 X-11.6542 Y2.3622 I-1.4172 J.5282
X-11.3196 Y1.7751 I-1.1135 J-1.0236
G1 Y2.8576
X-11.3378 Y2.8393
G3 X-11.5873 Y3.1701 I-3.6384 J-2.4843
G2 X-12.1415 Y2.3622 I-1.1804 J.2157
X-11.5677 Y1.3386 I-.6262 J-1.0236
G1 Y1.263
X-11.0071
Y3.1701
X-11.5873
X-11.5874 Y3.17
G3 X-11.7835 Y3.3858 I-2.4389 J-2.018
G1 X-12.1927
G2 X-12.7677 Y2.8108 I-.575 J0.
G1 X-14.3187
Y2.4052
G2 X-14.488 Y1.9978 I-.575 J0.
G1 Y1.9136
X-12.7677
G2 X-12.1927 Y1.3386 I0. J-.575
G1 Y1.2598
G2 X-12.7677 Y.6848 I-.575 J0.
G1 X-14.3187
Y.638
X-10.3821
Y3.7951
X-12.2972
G2 X-12.1927 Y3.4646 I-.4705 J-.3305
G1 Y3.3858
G0 Z1.5
M5
G91 G28 Z0. M9
G28 X0. Y0. C0.
M30
%
代码和步骤正式开始:
1:在任意2个代码块之间增加以下代码,如有重复,需要更名。
以下代码为获取单个刀具最大最小值,多次调用,会有多次不同的结果。
pcomm_max_min_for_tool
z_min_tool = opinfo(19, 0)
z_max_tool = opinfo(16, 0)
loop = 1
result = opinfo(92, loop)
while result = 1000,
[
z_min_op = opinfo(19, loop)
z_max_op = opinfo(16, loop)
if z_min_op < z_min_tool, z_min_tool = z_min_op
if z_max_op > z_max_tool, z_max_tool = z_max_op
loop = loop + 1
result = opinfo(92, loop)
]
"MAX TOOL Z = ", *z_max_tool, e$
"MIN TOOL Z = ", *z_min_tool, e$
2:在任意2个代码块之间增加以下代码,如有重复,需要更名。
以下代码为获取单个操作的最大最小值。
pcomm_max_min_op
zmin_op = opinfo(19, 0)
zmax_op = opinfo(16, 0)
"MAXIMUM OPERATION DEPTH = ", *zmax_op, e$
"MINIMUM OPERATION DEPTH = ", *zmin_op, e$
3:在psof$,ptlchg$ 换刀代码前增加如下代码:
pcomm_max_min_for_tool
pcomm_max_min_op
4:在ptlchg0$增加如下代码:
以下代码可能还需要判断当前操作和前一个操作的id是否相同
pcomm_max_min_op
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删