Mastercam后处理片段代码使用说明

Mastercam后处理片段代码使用说明

首页冒险解谜代号one更新时间:2024-08-03

Mastercam后处理片段代码使用说明。

很多时候,在下载的后处理中看到不错的功能(假设能看到相关功能的源代码),或者购买的源代码想要移植添加到自己的后处理中,这个时候,对于这部分片段代码,如何添加是最大的问题,针对这样的问题,肯能会想到想要提供者写个修改说明,其实这些都是不好操作的,首先后处理不同,有些后处理删除了部分代码,还有部分后处理则增加了更多其他的代码,或是部分代码重复,导致无法很好的些修改说明,针对此类问题,下面将会讲解片段代码如何增加。

Mastercam后处理基于钻孔开发测头(探针)源代码

首先了解后处理预定义命令块是非常有必要的,何为后处理预定义命令块,如下图所有该类型的命令块为后处理预定义命令块(以下仅展示部分代码)可不使用,但不可重命名。

pcomment$ pheader$ psof0$ psof$ ptlchg0$ ptlchg$ #Tool change peof0$ #End of file for tool ZERO peof$ #End of file for non-zero tool ppost$ # This posblock is call AFTER all the files from the PST run are closed! pq$ #Setup post based on switch settings ptoolend$ #End of tool path, before reading new tool data ptlchg1002$ #Call at actual toolchange, end last path here pdwl_spd$ #Call from NCI gcode 4 prapid$ #Output to NC of linear movement - rapid pzrapid$ #Output to NC of linear movement - rapid Z only plin$ #Output to NC of linear movement - feed pz$ #Output to NC of linear movement - feed Z only pmx$ #Output to NC of vector NCI pcir$ #Output to NC of circular interpolation pmx0$ #5 axis gcode setup plin0$ #Linear movement, mill motion test pcir0$ #Circular interpolation, mill arc motion test pdrill0$ #Pre-process before drill call pdrill$ #Canned Drill Cycle ppeck$ #Canned Peck Drill Cycle pchpbrk$ #Canned Chip Break Cycle ptap$ #Canned Tap Cycle pbore1$ #Canned Bore #1 Cycle pbore2$ #Canned Bore #2 Cycle pmisc1$ #Canned Fine Bore (shift) Cycle pmisc2$ #Canned Rigid Tapping Cycle pdrlcst$ #Custom drill cycles 8 - 19 (user option) pdrill_2$ #Canned Drill Cycle, additional points ppeck_2$ #Canned Peck Drill Cycle pchpbrk_2$ #Canned Chip Break Cycle ptap_2$ #Canned Tap Cycle pbore1_2$ #Canned Bore #1 Cycle pbore2_2$ #Canned Bore #2 Cycle pmisc1_2$ #Canned Fine Bore (shift) Cycle pmisc2_2$ #Canned Rigid Tapping Cycle pdrlcst_2$ #Custom drill cycles 8 - 19, additional points (user option) pcanceldc$ #Cancel canned drill cycle psub_call_m$ #Call to main level, single tool psub_call_mm$ #Call to main level, multiple tools psub_st_m$ #Header in main level psub_end_m$ #End in main level psub_call_s$ #Call to sub level psub_st_s$ #Header in sub leveln psub_end_s$ #End in sub level pmiscint$ #Capture the top level absinc for subprograms pprep$ #Pre-process postblock - Allows post instructions after the post is parsed but before the NC and NCI file are opened. psynclath$ #Read NCI Axis-Combination (950) line pwrtt$ #Pre-read NCI file pwrttparam$ #Pre-read parameter data pparameter$ #Read operation parameters pmachineinfo$ #Machine information parameters postblock

以下为后处理流程:

以上代码块命令块根据功能,可以划分为:

1:预处理命令块

pmiscint$ #Capture the top level absinc for subprograms pprep$ #Pre-process postblock - Allows post instructions after the post is parsed but before the NC and NCI file are opened. psynclath$ #Read NCI Axis-Combination (950) line pwrtt$ #Pre-read NCI file pwrttparam$ #Pre-read parameter data pparameter$ #Read operation parameters pmachineinfo$ #Machine information parameters postblock

2:开始处理命令块

pcomment$ #Comment from manual entry (must call pcomment2) pheader$ #Call before start of file psof0$ #Start of file for tool zero psof$ #Start of file for non-zero tool number

3:中间过程命令块

ptlchg0$ #Call from NCI null tool change (tool number repeats) ptlchg$ #Tool change ptoolend$ #End of tool path, before reading new tool data ptlchg1002$ #Call at actual toolchange, end last path here pdwl_spd$ #Call from NCI gcode 4 prapid$ #Output to NC of linear movement - rapid pzrapid$ #Output to NC of linear movement - rapid Z only plin$ #Output to NC of linear movement - feed pz$ #Output to NC of linear movement - feed Z only pmx$ #Output to NC of vector NCI pcir$ #Output to NC of circular interpolation pmx0$ #5 axis gcode setup plin0$ #Linear movement, mill motion test pcir0$ #Circular interpolation, mill arc motion test pdrill0$ #Pre-process before drill call pdrill$ #Canned Drill Cycle ppeck$ #Canned Peck Drill Cycle pchpbrk$ #Canned Chip Break Cycle ptap$ #Canned Tap Cycle pbore1$ #Canned Bore #1 Cycle pbore2$ #Canned Bore #2 Cycle pmisc1$ #Canned Fine Bore (shift) Cycle pmisc2$ #Canned Rigid Tapping Cycle pdrlcst$ #Custom drill cycles 8 - 19 (user option) pdrill_2$ #Canned Drill Cycle, additional points ppeck_2$ #Canned Peck Drill Cycle pchpbrk_2$ #Canned Chip Break Cycle ptap_2$ #Canned Tap Cycle pbore1_2$ #Canned Bore #1 Cycle pbore2_2$ #Canned Bore #2 Cycle pmisc1_2$ #Canned Fine Bore (shift) Cycle pmisc2_2$ #Canned Rigid Tapping Cycle pdrlcst_2$ #Custom drill cycles 8 - 19, additional points (user option) pcanceldc$ #Cancel canned drill cycle psub_call_m$ #Call to main level, single tool psub_call_mm$ #Call to main level, multiple tools psub_st_m$ #Header in main level psub_end_m$ #End in main level psub_call_s$ #Call to sub level psub_st_s$ #Header in sub leveln psub_end_s$ #End in sub level

4:结尾命令块

peof0$ #End of file for tool zero peof$ #End of file for non-zero tool

5:结束后处理命令块

ppost$ # This posblock is call AFTER all the files from the PST run are closed!

其次需要了解后处理函数,对于高版本(X版之后)后处理,凡是函数尾带有$符号的均为后处理预定义函数/后处理预定义命令块。

如下为2017之后的版本系统级的函数,凡是所有大写函数及函数尾部带有@符号的函数。

N_TWO@ N_ONE@ ZERO@ ONE@ TWO@ THREE@ FOUR@ FIVE@ SIX@ SEVEN@ EIGHT@ NINE@ TEN@

针对片段代码如何添加,根据作者的经验可以遵循以下几种方式。

根据片段代码的功能划分:

1:涉及到刀具清单,加工范围,预读数据方面的功能代码,一般代码块调用位置大多数在pwrtt$下面完成预读,预处理工作。

2:涉及到操作开始,操作过程中,换刀,操作结束等这类功能代码主要调用位置大多在过程中。

3:凡是涉及到成立完成后还需要再次对程序进行处理的此类调用主要集中在ppost$下完成处理工作。

4:还有一些片段代码提供了主要后处理预定义代码块,这就说明在相应的命令块下增加即可,如下所示:

psof$ #Start of file for non-zero tool number #----------------------------------------------------------- ptool_header probe_head$

Ps:

片断代码增加到后处理首先不要调用输出功能,生成一个程序,利用后处理排错的方法,看看还有哪些代码缺失或者语法错误,或者逻辑错误,根据错误提示进行排错,修正后再调用并测试其功能的完整性,这样会大大节省时间,还可以因为错误的定义导致后处理长时间卡死或者软件卡死崩溃导致重启软件。

Mastercam后处理 3 2刀尖跟随计算源代码

查看全文
大家还看了
也许喜欢
更多游戏

Copyright © 2024 妖气游戏网 www.17u1u.com All Rights Reserved