Mastercam后处理输出加工余量方法有多种,在2017之前的方法已不再适用于新版本的余量输出,之前的方法仅可输出一般的2D,3D刀路的预留量,对于高速加工策略种的预留量是无法输出。
下面的方法对高版本有效,其主要采用了opinfo,stockinfo等函数来完成.
stockinfo详细介绍
Mastercam函数stockinfo用法详解
opinfo详细介绍
Mastercam后处理opinfo用法详解
Mastercam后处理基于钻孔开发测头(探针)源代码
1:首先定义开关及初始数据:
oneZone_stock_to_leave : yes$ #Output stock to leave information?
squery_invalid : "-99999" #Invalid return value from query function
ssstock : ""
Mastercam后处理刀具清单输出刀具加工深度源码--方法1
2:预留量函数初始数据
#Enhanced Tool Table Variable
sstock_index : 0
wall_stock : 0
floor_stock : 0
max_wall_stock : 0
min_wall_stock : 0
max_floor_stock : 0
min_floor_stock : 0
Mastercam后处理 3+2刀尖跟随计算源代码
3:定义各操作类型
WALL_STOCK@ : 1
FLOOR_STOCK@ : 2
LOW@ : -999999
HIGH@ : 999999
sblank = ""
#tool_op$ Code Enumerators
TOOL_OP_CONTOUR@ : 1
TOOL_OP_DRILL@ : 2
TOOL_OP_POCKET@ : 3
TOOL_OP_TRANSFORM@ : 4
TOOL_OP_MULTISURF_ROUGH_PARALLEL@ : 5
TOOL_OP_MULTISURF_ROUGH_RADIAL@ : 6
TOOL_OP_MULTISURF_ROUGH_PROJECT@ : 7
TOOL_OP_MULTISURF_ROUGH_FLOWLINE@ : 8
TOOL_OP_MULTISURF_ROUGH_CONTOUR@ : 9
TOOL_OP_MULTISURF_ROUGH_POCKET@ : 10
TOOL_OP_MULTISURF_FINISH_PARALLEL@ : 11
TOOL_OP_MULTISURF_FINISH_RADIAL@ : 12
TOOL_OP_MULTISURF_FINISH_PROJECT@ : 13
TOOL_OP_MULTISURF_FINISH_FLOWLINE@ : 14
TOOL_OP_MULTISURF_FINISH_CONTOUR@ : 15
TOOL_OP_C_HOOK@ : 16
TOOL_OP_MANUAL_ENTRY@ : 17
TOOL_OP_CIRCLE_MILL@ : 18
TOOL_OP_POINT@ : 19
TOOL_OP_TRIMMED@ : 20
TOOL_OP_RULED@ : 21
TOOL_OP_REVOLVED@ : 22
TOOL_OP_LETTERS@ : 23
TOOL_OP_SWEPT_2D@ : 24
TOOL_OP_SWEPT_3D@ : 25
TOOL_OP_COONS@ : 26
TOOL_OP_LOFTED@ : 27
TOOL_OP_5_AXIS_DRILLING@ : 28
TOOL_OP_5_AXIS_CURVE@ : 29
TOOL_OP_PROJECT_PLANE@ : 30
TOOL_OP_PROJECT_CYLINDER@ : 31
TOOL_OP_PROJECT_SPHERE@ : 32
TOOL_OP_PROJECT_CONE@ : 33
TOOL_OP_PROJECT_CROSS_SECTION@ : 34
TOOL_OP_PROJECT_SURFACE@ : 35
TOOL_OP_NON_ASSOCIATIVE_CONTOUR@ : 36
TOOL_OP_NON_ASSOCIATIVE_DRILLING@ : 37
TOOL_OP_NON_ASSOCIATIVE_POCKETING@ : 38
TOOL_OP_MULTISURF_FINISH_PENCIL_TRACE@ : 39
TOOL_OP_MULTISURF_FINISH_LEFTOVER_STOCK@ : 40
TOOL_OP_MULTISURF_FINISH_STEEP@ : 41
TOOL_OP_MULTISURF_FINISH_SHALLOW@ : 42
TOOL_OP_MULTISURF_FINISH_CONSTANT_SCALLOP@ : 43
TOOL_OP_MULTISURF_ROUGH_PLUNGE@ : 44
TOOL_OP_MULTISURF_FINISH_5AX_FLOWLINE@ : 45
TOOL_OP_MULTISURF_FINISH_4AX@ : 46
TOOL_OP_MERGED_ASCII_NCI@ : 47
TOOL_OP_5AX_SWARF@ : 48
TOOL_OP_5AX_ROLL_DIE@ : 49
TOOL_OP_THREAD_MILL@ : 100
TOOL_OP_EDIT_COMMON_OP_PARAMETERS@ : 101
TOOL_OP_FACING@ : 102
TOOL_OP_ASSOCIATIVE_TRIMMED@ : 103
TOOL_OP_SOLID_DRILL_CONTROL@ : 104
TOOL_OP_SLOT_MILL@ : 105
TOOL_OP_HELIX_BORE@ : 106
TOOL_OP_MULTISURF_ROUGH_RESTMILL@ : 107
TOOL_OP_ASSOCIATIVE_NESTING_CONTAINER@ : 108
TOOL_OP_MULTISURF_FINISH_BLEND@ : 109
TOOL_OP_MULTISURF_5AX_ROUGH@ : 110
TOOL_OP_SLICE_5AX@ : 111
TOOL_OP_PORT_5AX@ : 112
TOOL_OP_5AX_CIRCLE@ : 113
TOOL_OP_TAB_CUTOFF@ : 130
TOOL_OP_MULTISURF_ROUGH_POCKET_LIGHT@ : 131
TOOL_OP_HIGH_SPEED_SURFACE@ : 132
TOOL_OP_NESTING_ONIONSKIN@ : 133
TOOL_OP_2D_HARDMILL_MACHINING_PEEL_MILL@ : 134
TOOL_OP_SAW@ : 135
TOOL_OP_FBM_DRILL_CONTROL@ : 136
TOOL_OP_FBM_MILL_POCKET@ : 137
TOOL_OP_FBM_MILL_CONTOUR@ : 138
TOOL_OP_SOLID_MODEL@ : 139
TOOL_OP_PROBE_CYCLE_PROBE_MOTION@ : 150
TOOL_OP_PROBE_CYCLE_COMMAND_BLOCK@ : 151
TOOL_OP_PROBE_CYCLE_HEADER@ : 152
TOOL_OP_PROBE_CYCLE_TRAILER@ : 153
TOOL_OP_LINKING@ : 154
TOOL_OP_DRILL5AX_SAFETYZONE@ : 155
TOOL_OP_BLOCK_DRILL@ : 306
TOOL_OP_ENGRAVING@ : 416
TOOL_OP_ART@ : 439
TOOL_OP_ADV_MULTIAX_SWARF@ : 441
TOOL_OP_ADV_MULTIAX_MORPH@ : 442
TOOL_OP_ADV_MULTIAX_PARALLEL@ : 443
TOOL_OP_ADV_MULTIAX_ALONG_CURVE@ : 444
TOOL_OP_ADV_MULTIAX_TRIANGULAR_MESH@ : 445
TOOL_OP_ADV_MULTIAX_ROUGHING@ : 446
TOOL_OP_ADV_MULTIAX_PROJECT@ : 447
TOOL_OP_CONVERT_TO_5AX@ : 448
TOOL_OP_PORT_EXPERT@ : 449
TOOL_OP_BLADE_EXPERT@ : 450
TOOL_OP_ROTARY_ADVANCED@ : 451
TOOL_OP_5AX_SURF_FLOWLINE@ : 452
TOOL_OP_5AX_CONVERT_AUTOTILT@ : 453
TOOL_OP_5AX_CONVERT_WRAP@ : 454
TOOL_OP_5AX_CONVERT_DROP@ : 455
TOOL_OP_5AX_CONVERT_LINK@ : 456
TOOL_OP_5AX_DRILLING@ : 457
TOOL_OP_5AX_WIREFRAME@ : 458
TOOL_OP_5AX_DEBURR@ : 459
#endregion
Mastercam后处理坐标偏移方法
4:定义钻孔类型集合
#region Globals for multicheck
drilling_op = (
tt_tool_op$ = TOOL_OP_DRILL@ |
tt_tool_op$ = TOOL_OP_5_AXIS_DRILLING@ |
tt_tool_op$ = TOOL_OP_NON_ASSOCIATIVE_DRILLING@ |
tt_tool_op$ = TOOL_OP_SOLID_DRILL_CONTROL@ |
tt_tool_op$ = TOOL_OP_FBM_MILL_CONTOUR@ |
tt_tool_op$ = TOOL_OP_BLOCK_DRILL@
)
5:定义高速策略
op_uses_model_geometry = (
tt_tool_op$ = TOOL_OP_HIGH_SPEED_SURFACE@
)
6:定义数据格式,前缀等。
fmt "WALL STOCK: " 3 wall_stock #Stock info note format
fmt "FLOOR STOCK: " 3 floor_stock #Stock info note format
fmt "WALL STOCK MIN: " 3 min_wall_stock ", " #Stock info note format
fmt "WALL STOCK MAX: " 3 max_wall_stock "," #Stock info note format
fmt "FLOOR STOCK MIN: " 3 min_floor_stock ", " #Stock info note format
fmt "FLOOR STOCK MAX: " 3 max_floor_stock "," #Stock info note format
7:定义输出的策略
pstock_leave
if not(drilling_op) & oneZone_stock_to_leave, pget_stock_to_leave
8:获取预留量主要过程。
pget_stock_to_leave
wall_stock = zero
floor_stock = zero
max_wall_stock = LOW@
min_wall_stock = HIGH@
max_floor_stock = LOW@
min_floor_stock = HIGH@
if op_uses_model_geometry,
[
stock_index = zero
sstock = stockinfo(zero, op_id$, stock_index)
while sstock <> sblank,
[
wall_stock = rparsngl(sstock, WALL_STOCK@)
floor_stock = rparsngl(sstock, FLOOR_STOCK@)
geo_group = stock_index + one
if wall_stock <>0 | floor_stock <>0,
[
"(",*geo_group, [if wall_stock <>0, *wall_stock], [if floor_stock <>0, *floor_stock], ")", e$
]
stock_index = stock_index + one
sstock = stockinfo(zero, op_id$, stock_index)
]
]
else,
[
wall_stock = opinfo(10010, zero)
floor_stock = opinfo(10068, zero)
if wall_stock <> INVALID_QUERY@ & floor_stock <> INVALID_QUERY@,
[
if wall_stock <>0 | floor_stock <>0,
[
"(",[if wall_stock <>0, *wall_stock], [if floor_stock <>0, *floor_stock], ")", e$
e$
]
]
]
9:在需要输出的位置调用即可
pstock_leave
GIF
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删