首页/文章/ 详情

RationalDMIS如何使用DMIS计算超差率/合格率

1年前浏览963

    经常遇到需要求一个工件中计算过的公差的合格率/超差率,以下是用DMIS程序实现的方法:
           赋值,循环语句,元素标签名自动递增。

以圆直径合格率为例,其余点轮廓,坐标轴向合格率类似!




利用软件“变量区”自带的取公差总数,超差数完成超差率的计算!

(1)$$ 得到所有计算的公差的个数
KNPTN1 = VALUE/TOL, ALL

(2)$$ 得到超差的公差的个数
KNPTN2 = VALUE/TOL, OUTOL


$$ 计算超差百分比并输出到报告中
KNPTR1 = ASSIGN/KNPTN2/KNPTN1*100
WRITE/DID(DEFAULTSCREEN),KNPTR1:4:2, '%'

 

  需要注意的是程序中必须有计算公差的语句,否则Value取得值是0,那么是没法计算出结果的;

DMISMN/'Created by [山涧果子] on 星期五, 七月 13, 2018', 4.0

UNITS/MM, ANGDEC

WKPLAN/XYPLAN

PRCOMP/ON

TECOMP/ON

FLY/1.0

MODE/PROG, MAN

SNSET/APPRCH, 2.000000

SNSET/RETRCT, 2.000000

SNSET/DEPTH, 0.000000

SNSET/SEARCH, 10.000000

SNSET/CLRSRF, 0.000000

RECALL/D(MCS)

SNSLCT/S(20-30X2)

GEOALG/CIRCLE, LSTSQR

GEOALG/ARC, LSTSQR

GEOALG/PLANE, LSTSQR

$$

$$

MODE/AUTO,PROG,MAN

F(CIR1) = FEAT/CIRCLE,INNER,CART, 8.0000, 55.0000, 35.0000, 0.000000,$

0.000000, 1.000000, 10.0000

$$ Empty Meas Block

MEAS/CIRCLE, F(CIR1), 4

ENDMES

F(CIR2) = FEAT/CIRCLE,INNER,CART, 24.0000, 27.2872, 35.0000, 0.000000,$

0.000000, 1.000000, 10.0000

$$ Empty Meas Block

MEAS/CIRCLE, F(CIR2), 4

ENDMES

F(CIR3) = FEAT/CIRCLE,INNER,CART, 56.0000, 27.2872, 35.0000, 0.000000,$

0.000000, 1.000000, 10.0000

$$ Empty Meas Block

MEAS/CIRCLE, F(CIR3), 4

ENDMES

F(CIR4) = FEAT/CIRCLE,INNER,CART, 72.0000, 55.0000, 35.0000, 0.000000,$

0.000000, 1.000000, 10.0000

$$ Empty Meas Block

MEAS/CIRCLE, F(CIR4), 4

ENDMES

F(CIR5) = FEAT/CIRCLE,INNER,CART, 56.0000, 82.7128, 35.0000, 0.000000,$

0.000000, 1.000000, 10.0000

$$ Empty Meas Block

MEAS/CIRCLE, F(CIR5), 4

ENDMES

F(CIR6) = FEAT/CIRCLE,INNER,CART, 24.0000, 82.7128, 35.0000, 0.000000,$

0.000000, 1.000000, 10.0000

$$ Empty Meas Block

MEAS/CIRCLE, F(CIR6), 4

ENDMES

F(CIR7) = FEAT/CIRCLE,INNER,CART, 40.0000, 55.0000, 35.0000, 0.000000,$

0.000000, 1.000000, 45.0000

$$ Empty Meas Block

MEAS/CIRCLE, F(CIR7), 4

ENDMES

F(CIR8) = FEAT/CIRCLE,OUTER,CART, 40.0000, 55.0000, 30.0000, 0.000000,$

0.000000, 1.000000, 30.0000

$$ Empty Meas Block

MEAS/CIRCLE, F(CIR8), 4

ENDMES

F(CIR9) = FEAT/CIRCLE,INNER,CART, 40.0000, 55.0000, 30.0000, 0.000000,$

0.000000, 1.000000, 20.0000

$$ Empty Meas Block

MEAS/CIRCLE, F(CIR9), 4

ENDMES

F(CIR10) = FEAT/CIRCLE,INNER,CART, 50.0000, 7.9081, 27.9289, 0.000000,$

-0.707107, 0.707107, 15.0000

$$ Empty Meas Block

MEAS/CIRCLE, F(CIR10), 4

ENDMES

  

 

T(TDIAM1) = TOL/DIAM, 0.0000, 0.0210

DECL/COMMON,INTGR,I

DECL/COMMON,INTGR,J

DECL/COMMON,DOUBLE,V1

DECL/COMMON,CHAR,255,C1

DECL/COMMON,CHAR,255,C2

DO/I,1,10,1

C1 = ASSIGN/CONCAT('CIR',STR(I))

OUTPUT/FA(@C1), TA(TDIAM1)

V1 = OBTAIN/TA(TDIAM1),2

IF/(V1.GT.0).AND.(V1.LT.0.021)

J = ASSIGN/J+1

ENDIF

ENDDO

DECL/COMMON,DOUBLE,V2

V2 = ASSIGN/J/10*100

C2 = ASSIGN/CONCAT('直径合格率为:',STR(V2),'%')

TEXT/OUTFIL, C2

 

 

$$

TEXT/OPER, '利用软件“变量区”自带的取公差总数,超差数完成超差率的计算!'

TEXT/OUTFIL, '利用软件“变量区”自带的取公差总数,超差数完成超差率的计算!'

DECL/COMMON, INTGR, K1

DECL/COMMON, INTGR, K2

DECL/COMMON, INTGR, K3

DECL/COMMON,CHAR,255,C3

K1 = VALUE/TOL,ALL

K2 = VALUE/TOL,OUTOL

K3 = ASSIGN/K2/K1*100

C3 = ASSIGN/CONCAT('RationalDMIS圆直径超差率为:',STR(K3),'%'.)

TEXT/OUTFIL, C3


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