mastercamX版本之后由控制器控制是否支持子程序输出,但由于每次软件版本的升级,还有就是又要满足不同的机器,不能做到需要时开不需要时关的效果。
   下面的这些代码可以做到开关自如,输出子程序和不输出子程序。完全由用户在后处理程序时自由选择。但要完全做到自由选择,还需要写部分代码才可以。
mastercam V9.1代码
   1.增加子程序的监视开关
subout_flg  : 0     #Subprogram Status
   2.增加错误提示信息
ssubwarn    "WARNING - THIS PROGRAM SUBPROGRAM IS ON"
   3.增加命令块
psub_check   #Sub Program Check
        #if subprg$ = yes, result = mprint(ssubwarn)
        if subout_flg = 1,
        [
          result = mprint(ssubwarn)
          *sm00, "(", "OPERATION : ",35, *op_number, ")", e
          *sm00, "(", ssubwarn, ")", e
         ppost_real
         ]
         ppost_real   #Remove Program
          exitpost
   4.增加系统预处理及预读参数
pparameter # Run parameter table
           if prmcode = 15378, subout_flg = rpar(sparameter,1)
           pwrttparam #Information from parameters
           if prmcode = 15378,
           [
           subout_flg = 1
           ]
   5.在plinout下面条用刚刚新建的命令快
psub_check
   6.测试结果

mastercam X及以上版本后处理代码
   1.增加子程序的监视开关
subout_flg  : 0     #Subprogram Status
   2.增加错误提示信息
ssubwarn    : "WARNING - THIS PROGRAM SUBPROGRAM IS ON"
   3.增加命令块
psub_check   #Sub Program Check
        #if subprg$ = yes, result = mprint(ssubwarn)
        if subout_flg = 1,
        [
          result = mprint(ssubwarn)
          *sm00, "(", "OPERATION : ",35, *op_number, ")", e$
          *sm00, "(", ssubwarn, ")", e$
         ppost_real
         ]
ppost_real   #Remove Program
          exitpost$
   4.增加系统预处理及预读参数
pparameter$ # Run parameter table
           if prmcode$ = 15378, subout_flg = rpar(sparameter$,1)pwrttparam$ #Information from parameters
           if prmcode$ = 15378,
           [
           subout_flg = 1
           ]
   5.在plinout下面条用刚刚新建的命令快
psub_check6.测试结果
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删