QQ登录

只需一步,快速开始

快捷登录

登录 或者 注册 请先

UG爱好者

查看: 736|回复: 1

[求助] GRIP二次开发 如何编辑表达式来更新实体

[复制链接]

列兵

Rank: 1

1

主题

2

帖子

15

积分
发表于 2023-3-7 10:50:25 | 显示全部楼层 |阅读模式
有没有大佬帮忙看一下下面的代码哪里有问题,运行之后表达式没有变化,但是读取文本的反馈框显示参数已经更改了
ENTITY/blk
string/file1(132),str1(132),strLb(10),strVl(20)
string/strL1(20),strL2(20),strD1(20),strD2(20),strR1(20),strR2(20)
NUMBER/L1,L2,D1,D2,R1,R2

XSPAWN/PROG,'D:\ZhuanJieRTest\nc\nc\bin\Debug\nc.exe'
file1='nc.para'
fetch/txt,1,'D:\ZhuanJieRTest\nc\nc\bin\Debug\nc.para',iferr,ier1:
reset/1  
i=0
ij30:
   read/1,ifend,j50:,iferr,er2:,str1
   i=i+1
   lng=LENF(str1)
   print/i,lng,str1
   eq=FNDSTR(str1,'=',1)
   ifthen/eq>1
      strLb=SUBSTR(str1,1,eq-1)
      strVl=SUBSTR(str1,eq+1,lng)
      print/'lable',strLb
      print/'value',strVl
      ifthen/CMPSTR(strLb,'L1')==0
         L1=VALF(strVl)
      endif
      ifthen/CMPSTR(strLb,'L2')==0
         L2=VALF(strVl)
      endif
      ifthen/CMPSTR(strLb,'D1')==0
         D1=VALF(strVl)
      endif
        ifthen/CMPSTR(strLb,'D2')==0
         D2=VALF(strVl)
      endif
        ifthen/CMPSTR(strLb,'R1')==0
         R1=VALF(strVl)
      endif
      ifthen/CMPSTR(strLb,'R2')==0
         R2=VALF(strVl)
      endif
   endif
   jump/ij30:

j50:
        ifthen/L1>0 and L2>0 and D1>0 and D2>0 and R1>0 and R2>0
               EXPEDT/'p0=L1'
                EXPEDT/'p3=1.2*L1'
                EXPEDT/'p4=L2'
              EXPEDT/'p1=D1'
              EXPEDT/'p6=D2'
              EXPEDT/'p5=R2'
           else
                      messg/'参数错误 无法生成块'
           endif
trm:

HALT

ier1:
   messg/'打开文件出错 检查文件'+file1
   jump/trm:
er2:
   messg/'读文件出错 检查文件'+file1
   jump/trm:


有奖推广贴子: 

回复

使用道具 举报

四级士官

Rank: 3Rank: 3

1

主题

308

帖子

711

积分
发表于 2023-3-7 11:01:24 | 显示全部楼层
进来学习学习
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

 
 
QQ:1359218528
工作时间:
9:00-17:00
 
微信公众号
手机APP
机械社区
微信小程序

手机版|UG爱好者论坛 ( 京ICP备10217105号-2 )    论坛管理员QQ:1359218528

本站信息均由会员发表,不代表本网站立场,如侵犯了您的权利请联系管理员,邮箱:1359218528@qq.com  

Powered by UG爱好者 X3.2  © 2001-2014 Comsenz Inc. GMT+8, 2024-3-28 17:14

返回顶部