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刀尖跟随計算源代碼