網(wǎng)上有很多關(guān)于pos機(jī)工作時(shí)間,Mastercam后處理程序頭輸出加工時(shí)間的知識(shí),也有很多人為大家解答關(guān)于pos機(jī)工作時(shí)間的問題,今天pos機(jī)之家(m.afbey.com)為大家整理了關(guān)于這方面的知識(shí),讓我們一起來看下吧!
本文目錄一覽:
pos機(jī)工作時(shí)間
Mastercam后處理程序頭輸出加工時(shí)間--純代碼版方法。
此方法由官方提供,其原理利用了mill.set文件及buffer的方式來實(shí)現(xiàn)。
實(shí)現(xiàn)的原理及過程如下:
首先利用后處理調(diào)用mp.dll及mill.set,獲取加工時(shí)間,并把加工時(shí)間保存為doc文件。
其次正常后處理程序,并向后處理中寫入一個(gè)標(biāo)志字符串。
最后再后處理運(yùn)行結(jié)束前利用buffer重讀nc文件,并搜索標(biāo)志字符串。
Mastercam后處理基于鉆孔開發(fā)測(cè)頭(探針)源代碼
找到標(biāo)志字符串后替換標(biāo)志字符串,并回寫刀程序中,即可完成程序頭或任意地方出加工時(shí)間。
1:定義各項(xiàng)數(shù)據(jù)
# Define strings used in building up the command line parameters for the DLL callsspace : " " # SPACE characterssq : "'" # Single Quote charactersdq : '"' # Double Quote charactersdoc : ".doc" # .doc extensionspath_in : "" # Will be the "path\ame" of the NCI input filespath_out : "" # Will be the "path\ame" of the DOC output filesparams : "" # Will be the command parameter line passed to the DLL
Mastercam后處理 3+2刀尖跟隨計(jì)算源代碼
2:定義mp.dll文件路徑,此路徑可用絕對(duì)路徑,也可用相對(duì)路徑
sdll : "D:\\Program Files\\Mastercam 2022\\Mastercam\\apps\\MP.dll" # Name of the .DLL to be called - update path as needed
3:定義mill.set文件路徑,此路徑可用絕對(duì)路徑,也可用相對(duì)路徑
s_setfile : "C:\\Users\\Public\\Documents\\Shared Mastercam 2022\\mill\\Posts\\Mill.set" # Define the path and name of the .set file to be used.
4:定義保存時(shí)間數(shù)據(jù)的函數(shù)
# Define strings used to read cycle time from .set output and write it to .pst outputset_time : "" #String to hold cycle time read from setup sheet output - entire line from .set outputscycle_time : "" #String to hold cycle time read from setup sheet output - time only, prefix stipped from set_time stringscycle_time_out : "(cycle_time_here)" #Keyword - This will be output where cycle time output is desired, then replace with the cycle time during ppost$.loc_found : 0 #Flag to indicate that cycle time output location has been found.
5:定義buff1數(shù)據(jù)
# --------------------------------------------------------------------------#Buffer 1, Doc file created by setup sheetwc1 : 1 #Buffer 1 write counterrc1 : 1 #Buffer 1 read countersize1 : 0 #Buffer 1 sizestring1 : "" #Buffer 1fbuf 1 0 256 1 1 #Buffer 1
6:定義buff2數(shù)據(jù)
#Buffer 2, NC file after postingwc2 : 1 #Buffer 2 write counterrc2 : 1 #Buffer 2 read countersize2 : 0 #Buffer 2 sizestring2 : "" #Buffer 2fbuf 2 1 256 1 1 #Buffer 2
7:在ppost$下完成整個(gè)加工時(shí)的獲取,輸出,回寫到程序中
ppost$ # This posblock is call AFTER all the files from the PST run are closed! spath_in = spathnci$ + snamenci$ + sextnci$ spath_out = spathnc$ + snamenc$ + sdoc sparams = ssq + sdq + spath_in + sdq + sspace + sdq + s_setfile + sdq + sspace + sdq + spath_out + sdq + ssq result = dll(sdll, sparams) sbufname1$ = spath_out size1 = rbuf(one, zero) rc1 = size1 set_time = rbuf(one, rc1) end_str_ix$ = zero if end_str_ix$ = zero, result = strstr(":", set_time) if end_str_ix$ = zero, result = strstr("=", set_time) scycle_time = brksps(end_str_ix$, set_time) sbufname2$ = spathnc$ + snamenc$ + sextnc$ while loc_found = zero, [ string2 = rbuf(two, rc2) if string2 = scycle_time_out, [ wc2 = rc2 - one scycle_time = sopen_prn + "CYCLE TIME =" + scycle_time + sclose_prn scycle_time = wbuf(two, wc2) loc_found = one ] ]
8:在psof$或其他任何想要輸出加工時(shí)間的地方下面增加下面的代碼。
psof$ *scycle_time_out,e$
以上就是關(guān)于pos機(jī)工作時(shí)間,Mastercam后處理程序頭輸出加工時(shí)間的知識(shí),后面我們會(huì)繼續(xù)為大家整理關(guān)于pos機(jī)工作時(shí)間的知識(shí),希望能夠幫助到大家!