首页/文章/ 详情

RationalDMIS 7.1 数组功能

1年前浏览231

RationalDMIS类似PC DMIS变量数组(ARRAY)功能

RationalDMIS数组之多维排列

PC DMIS  RationalDMIS数组数据输出最大值

RationalDMIS变量和数组功能


所谓数组,就是相同数据类型的元素按一定顺序排列的集 合,就是把有限个类型相同的变量用一个名字命名,然后用编号区分他们的变量的集 合。


数组分一维数组和二维数组,定义格式如下:


DECL/REAL,cData[10] $$一维数组,可以储存 10 个数据


DECL/REAL,cData[10,10] $$二维数组,可以储存 10x10=100 个数据



数组变量的赋值操作与普通变量相同,只是在在变量名称后面添加[]并设置数组编号即可。如下:

rNumber[2]=ASSIGN/3 $$ 一维数组赋值

rNumber[1,2]=ASSIGN/3 $$ 二维数组赋值



$$*/

MODE/PROG,MAN


DECL/COMMON,DOUBLE,DIA[10]


DO/KNPTN1,1,10,1


F(CIR1)=FEAT/CIRCLE,INNER,CART,31.5000,31.5000,-3.0000,0.0000,0.0000,1.0000, 20.0000

$$ Measurement points are created through nominal points

MEAS/CIRCLE, F(CIR1), 4

  PTMEAS/CART, 41.5000, 31.5000, -3.0000, -1.0000,  0.0000, 0.0000

  GOTO/CART,   37.9672, 34.1788, -3.0000

  GOTO/CART,   36.4497, 36.4497, -3.0000

  GOTO/CART,   34.1788, 37.9672, -3.0000

  PTMEAS/CART, 31.5000, 41.5000, -3.0000,  0.0000, -1.0000, 0.0000

  GOTO/CART,   28.8212, 37.9672, -3.0000

  GOTO/CART,   26.5503, 36.4497, -3.0000

  GOTO/CART,   25.0328, 34.1788, -3.0000

  PTMEAS/CART, 21.5000, 31.5000, -3.0000,  1.0000,  0.0000, 0.0000

  GOTO/CART,   25.0328, 28.8212, -3.0000

  GOTO/CART,   26.5503, 26.5503, -3.0000

  GOTO/CART,   28.8212, 25.0328, -3.0000

  PTMEAS/CART, 31.5000, 21.5000, -3.0000,  0.0000,  1.0000, 0.0000

ENDMES



DIA[KNPTN1]= OBTAIN/FA(CIR1),10


KNPTC1 = ASSIGN/CONCAT('第',STR(KNPTN1),'次测量结果=',STR(DIA[KNPTN1]))


TEXT/OUTFIL, KNPTC1



ENDDO

MODE/PROG,MAN

DECL/COMMON,INTGR,I

DECL/COMMON,INTGR,J

DECL/COMMON,DOUBLE,ARRAY[10]

DECL/COMMON,DOUBLE,MAXNUM

DECL/COMMON,DOUBLE,MINNUM

DECL/COMMON,DOUBLE,DAVG

DO/I,1,10,1

F(CIR1)=FEAT/CIRCLE,INNER,CART,31.5000,31.5000,-3.0000,0.0000,0.0000,1.0000, 20.0000

$$ Measurement points are created through nominal points

MEAS/CIRCLE, F(CIR1), 4

  GOTO/CART,   38.5000, 31.5000, 18.0000

  GOTO/CART,   38.5000, 31.5000, 17.0000

  PTMEAS/CART, 41.5000, 31.5000, -3.0000, -1.0000,  0.0000, 0.0000

  GOTO/CART,   37.9672, 28.8212, -3.0000

  GOTO/CART,   36.4497, 26.5503, -3.0000

  GOTO/CART,   34.1788, 25.0328, -3.0000

  PTMEAS/CART, 31.5000, 21.5000, -3.0000,  0.0000,  1.0000, 0.0000

  GOTO/CART,   28.8212, 25.0328, -3.0000

  GOTO/CART,   26.5503, 26.5503, -3.0000

  GOTO/CART,   25.0328, 28.8212, -3.0000

  PTMEAS/CART, 21.5000, 31.5000, -3.0000,  1.0000,  0.0000, 0.0000

  GOTO/CART,   25.0328, 34.1788, -3.0000

  GOTO/CART,   26.5503, 36.4497, -3.0000

  GOTO/CART,   28.8212, 37.9672, -3.0000

  PTMEAS/CART, 31.5000, 41.5000, -3.0000,  0.0000, -1.0000, 0.0000

  GOTO/CART,   31.5000, 38.5000, 17.0000

ENDMES

ARRAY[I] = OBTAIN/FA(CIR1),10

ENDDO

MAXNUM = ASSIGN/ARRAY[1]

MINNUM = ASSIGN/ARRAY[1]

DO/J,2,10,1

IF/(ARRAY[J].GT.MAXNUM)

MAXNUM=ASSIGN/ARRAY[J]

ELSE

ENDIF

ENDDO

DO/J,2,10,1

IF/(ARRAY[J].LT.MAXNUM)

MINNUM=ASSIGN/ARRAY[J]

ELSE

ENDIF

ENDDO

DAVG = ASSIGN/MAXNUM-MINNUM

WRITE/DID(DEFAULTSCREEN),DAVG

来源:RationalDMIS测量技术
UM
著作权归作者所有,欢迎分享,未经许可,不得转载
首次发布时间:2023-07-11
最近编辑:1年前
山涧果子
大专 签名征集中
获赞 203粉丝 48文章 1203课程 0
点赞
收藏
未登录
还没有评论
课程
培训
服务
行家
VIP会员 学习 福利任务 兑换礼品
下载APP
联系我们
帮助与反馈