网上有很多关于pos机工作时间,Mastercam后处理程序头输出加工时间的知识,也有很多人为大家解答关于pos机工作时间的问题,今天pos机之家(www.poszjia.com)为大家整理了关于这方面的知识,让我们一起来看下吧!
本文目录一览:
1、pos机工作时间
pos机工作时间
Mastercam后处理程序头输出加工时间--纯代码版方法。
此方法由官方提供,其原理利用了mill.set文件及buffer的方式来实现。
实现的原理及过程如下:
首先利用后处理调用mp.dll及mill.set,获取加工时间,并把加工时间保存为doc文件。
其次正常后处理程序,并向后处理中写入一个标志字符串。
最后再后处理运行结束前利用buffer重读nc文件,并搜索标志字符串。
Mastercam后处理基于钻孔开发测头(探针)源代码
找到标志字符串后替换标志字符串,并回写刀程序中,即可完成程序头或任意地方出加工时间。
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:定义保存时间数据的函数
# 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$下完成整个加工时的获取,输出,回写到程序中
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$或其他任何想要输出加工时间的地方下面增加下面的代码。
psof$ *scycle_time_out,e$
以上就是关于pos机工作时间,Mastercam后处理程序头输出加工时间的知识,后面我们会继续为大家整理关于pos机工作时间的知识,希望能够帮助到大家!
