Mastercam后处理刀具清单有多种方法可以输出,输出的方法至少4种以上。
下面和大家分享一个堆栈的方式输出刀具清单。
什么是堆栈,可以通过堆栈查阅相关说明。
1;定义数据格式
return : 0
#Default english/metric position format statements
fs2 1 0.7 0.6 #Decimal, absolute, 7 place, default for initialize (:)
fs2 2 0.4 0.3 #Decimal, absolute, 4/3 place
fs2 3 0.4 0.3d #D?ecimal, delta, 4/3 place#Common format statements
fs2 4 1 0 1 0 #Integer, not leading
2:初始化刀具数据
op_identity : 0
tool_number : 0
tool_offset : 0
tool_length_offset : 0
tool_diameter : 0
tool_corner_radius : 0
3:定义数据输出的前缀,函数名
stream_idx : 1
stream_op_id : 0
output_tool_number : 0
output_tool_offset : 0
output_tool_length_offset : 0
output_tool_diameter : 0
output_tool_corner_radius : 0
fmt "T-> " 2 output_tool_number
fmt "D-> " 2 output_tool_offset
fmt "H-> " 2 output_tool_length_offset
fmt "D-> " 2 output_tool_diameter
fmt "R-> " 2 output_tool_corner_radius
4:堆栈的各项数据定义。
stack_tool_number : 0
stack_tool_offset : 0
stack_tool_length_offset : 0
stack_tool_tool_diameter : 0
stack_tool_corner_radius : 0
stack_size : 0
stack_result : 0
fstack 1 5
is_tool_in_stack : no$
5:将数据压进,出栈。
padd_tool_to_stack
is_tool_in_stack = no$
stack_size = pop(1, stack_result, 0)
while stack_size > 0,
[
stack_tool_number = pop(1, stack_size, 5)
if stack_tool_number = tool_number,
[
is_tool_in_stack = yes$
stack_size = -1
]
stack_size = stack_size - 1
]
if not(is_tool_in_stack),
[
tool_number = push(1, stack_result, 0)
]
6:利用opinfo函数获取刀具数据。
opinfo用法参考
pget_tool_parameters(op_identity)
tool_number = opinfo(47, op_identity, 1)
tool_offset = opinfo(49, op_identity, 1)
tool_length_offset = opinfo(50, op_identity, 1)
tool_diameter = opinfo(10005, op_identity, 1)
tool_corner_radius = opinfo(10006, op_identity, 1)
Mastercam后处理刀具清单输出刀具加工深度源码--方法1
7:定义输出刀具清单格式
pwrite_tool_info
stream_idx = 1
stream_op_id = streaminfo(1, stream_idx)
while stream_op_id <> -99999,
[
pget_tool_parameters(stream_op_id)
padd_tool_to_stack
stream_idx = stream_idx + 1
stream_op_id = streaminfo(1, stream_idx)
]
stack_size = pop(1, stack_result, 0)
while stack_size > 0,
[
output_tool_number = pop(1, stack_size, 5)
"(Tool Information)", e$
"( ", *output_tool_number, output_tool_offset,*output_tool_length_offset,*output_tool_diameter,*output_tool_corner_radius, ")", e$
*e$
stack_size = stack_size - 1
]
Mastercam后处理 3+2刀尖跟随计算源代码
8:调用刀具清单。
利用该方法可以在任意位置输出刀具清单。
pheader$ #Call before start of file
"(--- Header---)", e$
pwrite_tool_info
以下为输出效果
(--- Header---)
(Tool Information)
( T-> 1. D-> 1. H-> 1. D-> 32. R-> 3.175 )
(Tool Information)
( T-> -99999. D-> -99999. H-> -99999. D-> 0. R-> 0. )
(Tool Information)
( T-> 2. D-> 2. H-> 2. D-> 19.05 R-> 3.175 )
(Tool Information)
( T-> 3. D-> 3. H-> 3. D-> 12.7 R-> 3.175 )
(Tool Information)
( T-> 4. D-> 4. H-> 4. D-> 10. R-> 0. )
(Tool Information)
( T-> 5. D-> 5. H-> 5. D-> 6.35 R-> 0. )
Mastercam后处理坐标偏移方法
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删