pos機工作時(shí)間,Mastercam后處理程序頭輸出加工時(shí)間

 新聞資訊  |   2023-07-03 12:58  |  投稿人:pos機之家

網(wǎng)上有很多關(guān)于pos機工作時(shí)間,Mastercam后處理程序頭輸出加工時(shí)間的知識,也有很多人為大家解答關(guān)于pos機工作時(shí)間的問(wèn)題,今天pos機之家(www.xjcwpx.cn)為大家整理了關(guān)于這方面的知識,讓我們一起來(lái)看下吧!

本文目錄一覽:

1、pos機工作時(shí)間

pos機工作時(shí)間

Mastercam后處理程序頭輸出加工時(shí)間--純代碼版方法。

此方法由官方提供,其原理利用了mill.set文件及buffer的方式來(lái)實(shí)現。

實(shí)現的原理及過(guò)程如下:

首先利用后處理調用mp.dll及mill.set,獲取加工時(shí)間,并把加工時(shí)間保存為doc文件。

其次正常后處理程序,并向后處理中寫(xiě)入一個(gè)標志字符串。

最后再后處理運行結束前利用buffer重讀nc文件,并搜索標志字符串。

Mastercam后處理基于鉆孔開(kāi)發(fā)測頭(探針)源代碼

找到標志字符串后替換標志字符串,并回寫(xiě)刀程序中,即可完成程序頭或任意地方出加工時(shí)間。

1:定義各項數據

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

2:定義mp.dll文件路徑,此路徑可用絕對路徑,也可用相對路徑

sdll : "D:\\Program Files\\Mastercam 2022\\Mastercam\\apps\\MP.dll" # Name of the .DLL to be called - update path as needed

3:定義mill.set文件路徑,此路徑可用絕對路徑,也可用相對路徑

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í)間數據的函數

# 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數據

# --------------------------------------------------------------------------#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數據

#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í)的獲取,輸出,回寫(xiě)到程序中

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機工作時(shí)間,Mastercam后處理程序頭輸出加工時(shí)間的知識,后面我們會(huì )繼續為大家整理關(guān)于pos機工作時(shí)間的知識,希望能夠幫助到大家!

轉發(fā)請帶上網(wǎng)址:http://www.xjcwpx.cn/news/78439.html

你可能會(huì )喜歡:

版權聲明:本文內容由互聯(lián)網(wǎng)用戶(hù)自發(fā)貢獻,該文觀(guān)點(diǎn)僅代表作者本人。本站僅提供信息存儲空間服務(wù),不擁有所有權,不承擔相關(guān)法律責任。如發(fā)現本站有涉嫌抄襲侵權/違法違規的內容, 請發(fā)送郵件至 babsan@163.com 舉報,一經(jīng)查實(shí),本站將立刻刪除。