凯发官方首页的技术支持 放心产品,贴心服务
凯发官方首页-凯发在线平台 > 凯发官方首页的技术支持 > 产品凯发官方首页的技术支持>三坐标测量软件rationaldmis 高级编程应用实例

三坐标测量软件rationaldmis 高级编程应用实例-凯发官方首页

发表时间:2022-06-21 15:06:47 作者:三坐标 来源:www.serein.com.cn 浏览:512

前言

      一个程序适用n种产品,该如何进行编程?

在测量应用中,对于相似产品,如:环规,想要提高测量效率,并且减少产品程序的数量,测量员可以对产品的相同点进行一定分析,发现其中部分数据可实现参数化,通过rationaldmis软件的高级语言功能实现产品的快速测量,并适用于多种规格的产品。

 1、产品分析

对于有着众多规格的环规而言,如果每一个规格的大小都进行编程,是一个非常繁琐且不便的工程,对于测量员使用对应程序也是极其不便的,影响测量效率。我们对环规这类产品进行分析,特点如下图:

clip_image001.png

环规的类型内外为type,总高度定义为h,顶部向下偏移量定义为up,底部向上偏移量定义为dp,环规直径定义为dm,测量截面数量m,每个截面测量点数为n。

2、程序的设计

2.1 程序运行后,通过人为输入,可以实现不同规格产品的自动测量

2.2 流程图

clip_image003.jpg

 

2.3 rationaldmis 程序编写

(1)通过dmis提示,设置一个运行时输入参数的提示窗口

clip_image005.png

代码如下:

clip_image006.png

(2) 对参数进行判断,如判断环规类型、输入内容为字母、0 等情况

clip_image007.png

(3)手动建立坐标系

clip_image008.png

(4)设置安全平面宏

     (请将安全平面宏程序按以下内容修改)

clip_image009.png

(5)自动精建坐标系

clip_image010.png

(6)评价与分析

通过前面输入的层数与点数参数,进行圆柱测量,并进行评价

clip_image011.png

(7)生产检测报告

clip_image012.png

(8)总结

通过rationaldmis软件,只需简单3步,即可完成:

1、条件判断,输入管控参数,判断规格类型;

2、利用赋值,将管控参数赋给变量;

3、通过变量,规划测量轨迹,实现了不同规格的产品的检测;

最终实现一个程序,完成n个不同规格产品的自定、高效测量。

(9)完整代码如下


 
$$/*  header
 
dmismn/'created by [凯发官方首页-凯发在线平台测量技术(深圳)有限公司(非销售版)-101522-10825] on 星期四, 五月 26, 2022', 4.0
 
units/mm, angdec, mmps
 
wkplan/xyplan
 
prcomp/on
 
tecomp/off
 
fly/1.000000
 
mode/prog, man
 
snset/apprch, 1.000000
 
snset/retrct, 1.000000
 
snset/depth, 0.000000
 
snset/search, 10.000000
 
snset/clrsrf, 10.000000
 
recall/d(mcs)
 
snslct/s(rootsn2)
 
geoalg/bf, lstsqr
 
geoalg/anglb, defalt
 
geoalg/circle, maxins
 
geoalg/arc, lstsqr
 
geoalg/plane, lstsqr
 
$$
 
$$
 
$$*/
 
mode/man
 
decl/common, intgr, ringconfig,type,ringh,ringdm,ringup,ringdp,ringpoints,ringcounts
 
ringconfig = prompt/text,'请选择环规类型:',list,type,'内','外',text,'高度 h:',edit,ringh,text,'直径 dm:',edit,ringdm,text,'上偏移量 up:',edit,ringup,text,'下偏移量 dp:',edit,ringdp,text,'每层测点数 n:',edit,ringpoints,text,'层数 m:',edit,ringcounts
 
if/(type.eq.1)
 
knptn1=assign/1
 
else
 
knptn1=assign/-1
 
endif
 
$$检查参数
 
if/(ringh.eq.0)
 
ringh = prompt/'请输入正确的环规高度 h', 100, 1
 
endif
 
 
 
if/(ringdm.eq.0)
 
ringdm = prompt/'请输入正确的环规直径 dm', 9999, 1
 
endif
 
 
 
if/(ringup.eq.0)
 
ringup = prompt/'请输入正确的偏移量 up', ringh, 1
 
endif
 
 
 
if/(ringdp.eq.0)
 
ringdp = prompt/'请输入正确的偏移量 dp', ringh, 1
 
endif
 
 
 
if/(ringpoints.eq.0)
 
ringpoints = prompt/'请输入正确的每层测点数 n', 9999, 3
 
endif
 
 
 
if/(ringcounts.eq.0)
 
ringcounts = prompt/'请输入正确的测量层数 m', 9999, 2
 
endif
 
 
 
 
 
f(pln1)=feat/plane,pol,0,0,0.000000,0.000000,0.000000,1.000000
 
fa(pln1)=feat/plane,pol,0,0,0.000000,0.000000,0.000000,1.000000
 
$$measurement points are created through nominal points
 
 
 
meas/plane, f(pln1), 3
 
  ptmeas/pol, 16.022606,  89.412167, 0.000000, 0.000000, 0.000000, 1.000000
 
  ptmeas/pol, 16.618454, 203.430682, 0.000000, 0.000000, 0.000000, 1.000000
 
  ptmeas/pol, 16.155284, 335.311794, 0.000000, 0.000000, 0.000000, 1.000000
 
endmes
 
 
 
d(crd1) = datset/fa(pln1), zdir
 
d(crd1) = trans/zorig, fa(pln1)
 
 
 
f(cir1)=feat/circle,inner,cart,0.000000,0.000001,-2,0.000000,0.000000,1.000000, ringdm
 
fa(cir1)=feat/circle,inner,cart,0.000000,0.000001,-2,0.000000,0.000000,1.000000, ringdm
 
$$ measurement points are created through nominal points
 
meas/circle, f(cir2), 4
 
  ptmeas/cart, 0, knptn1*ringdm/2, -2 , 0, -1*knptn1, 0
 
  ptmeas/cart, knptn1*ringdm/2, 0, -2, -1*knptn1, 0, 0
 
  ptmeas/cart, 0, -1*knptn1*ringdm/2, -2, 0,1*knptn1, 0
 
  ptmeas/cart, -1*knptn1*ringdm/2, 0, -2, 1*knptn1,0, 0
 
endmes
 
 
 
d(crd2) = datset/fa(pln1), zdir, fa(cir1), xorig
 
d(crd2) = trans/zorig, fa(pln1), yorig, fa(cir1), xorig, -0
 
 
 
 
 
mode/prog,man
 
 
 
$$ macro: easi_clearpln_goto
 
$$ function: clearance surface implementation
 
$$      move machine clear surface dist above the current clear surface
 
$$plane and then move machine parallel to the clear surface plane
 
$$ all macro parameters are in pcs and current units
 
$$ last update: 3-1-04 add mode checking. only works in prog mode
 
$$ last update: 8-24-04 clear position is based on the surface of
 
$$
 
$$ this sample dmis macro is provided by external-array software, inc.
 
$$ it should be modified for your own use. there is no guarantee for
 
$$ the quality of this macro. november, 2003
 
$$  调用参数 isom 为安全平面参考元素类型理论0(or实际1)
 
$$ 调用参数目标位置测点trax 、tray、 traz,trai,traj,trak坐标及矢量
 
m(easi_clearpln_goto) = macro/isnom, tarx, tary, tarz, tari, tarj, tark
 
decl/local, real, ccx, ccy, ccz, cci, ccj, cck
 
decl/local, real, curx, cury, curz, td, clrdist, sdiam,bjdist
 
decl/local, char, 255, clrlabel, flabel, mmode, sname
 
$$获取当前运行模式及安全平面参考元素名label
 
mmode = value/mode
 
clrlabel = value/snset, clrsrf
 
$$判断label是否存在(关闭情况为空,非关闭则会获取到字符串,字符串长度大于0) 同时判断条件 当前模式是否为自动,否则跳过
 
if/ ( (len(clrlabel) .gt. 0) .and. (mmode .eq. 'prog,man') )
 
$$获取安全距离
 
clrdist = value/snset, clrsrf, dist
 
bjdist= value/snset,apprch
 
tarx=assign/tarx bjdist*tari
 
tary=assign/tary bjdist*tarj
 
tarz=assign/tarz bjdist*tark
 
$$给flabel赋值,默认fa
 
flabel = assign/'fa'
 
$$根据isom情况来更改fa或f
 
if/ isnom .eq. 0
 
flabel = assign/'f'
 
endif
 
$$赋值ccx,ccy,ccz,cci,ccj,cck为安全平面参考元素中心坐标的xyzijk
 
ccx = obtain/flabel(@clrlabel), 3
 
ccy = obtain/flabel(@clrlabel), 4
 
ccz = obtain/flabel(@clrlabel), 5
 
cci = obtain/flabel(@clrlabel), 6
 
ccj = obtain/flabel(@clrlabel), 7
 
cck = obtain/flabel(@clrlabel), 8
 
$$获取探头名称
 
sname = value/snslct
 
$$获取探头直径
 
sdiam = obtain/ss(sname), 8
 
$$延安全平面矢量增加一个探头半径
 
ccx = assign/ccx   cci * sdiam/2
 
ccy = assign/ccy   ccj * sdiam/2
 
ccz = assign/ccz   cck * sdiam/2
 
$$获取当前探针x,y,z坐标
 
curx = value/gotom, xaxis
 
cury = value/gotom, yaxis
 
curz = value/gotom, zaxis
 
$$计算当前坐标到安全平面的垂直距离
 
td = assign/(curx - ccx) * cci   (cury - ccy) * ccj   (curz - ccz) * cck
 
$$清除原有判断,任意位置先垂直移动到安全高度
 
$$if/ td .lt. clrdist
 
td = assign/(clrdist - td)
 
goto/curx cci*td, cury ccj*td, curz cck*td
 
$$endif
 
$$计算目标坐标到安全平面的垂直距离
 
td = assign/(tarx - ccx) * cci   (tary - ccy) * ccj   (tarz - ccz) * cck
 
if/ td .lt. clrdist
 
td = assign/(clrdist - td)
 
goto/tarx cci*td, tary ccj*td, tarz cck*td
 
$$建议增加大于的情况
 
endif
 
endif
 
endmac
 
 
 
snset/apprch, 1.0000
 
snset/retrct, 1.0000
 
snset/depth, 0.0000
 
snset/search, 10.0000
 
snset/clrsrf, fa(pln1), 10.0000
 
 
 
f(pln2)=feat/plane,pol,0,0,0.000000,0.000000,0.000000,1.000000
 
$$ measurement points are created through nominal points
 
call/m(easi_clearpln_goto), 1,0, knptn1*ringdm/2, 0 , 0, 0, 1
 
meas/plane, f(pln2), 3
 
  ptmeas/pol, knptn1*1 ringdm/2, 90, 0.000000, 0.000000, 0.000000, 1.000000
 
  ptmeas/pol, knptn1*1 ringdm/2, 210, 0.000000, 0.000000, 0.000000, 1.000000
 
  ptmeas/pol, knptn1*1 ringdm/2, 330, 0.000000, 0.000000, 0.000000, 1.000000
 
endmes
 
d(crd3) = datset/fa(pln2), zdir
 
d(crd3) = trans/zorig, fa(pln2)
 
 
 
f(cir2)=feat/circle,inner,cart,0.000000,0.00000,-2,0.000000,0.000000,1.000000, ringdm
 
$$ measurement points are created through nominal points
 
call/m(easi_clearpln_goto), 1,0, ringdm/2, -2 , 0, -1*knptn1, 0
 
meas/circle, f(cir2), 4
 
  ptmeas/cart, 0, ringdm/2, -2 , 0, -1*knptn1, 0
 
  if/(type.eq.2)
 
  call/m(easi_clearpln_goto), 1,ringdm/2, 0, -2, -1*knptn1, 0, 0
 
  endif
 
  ptmeas/cart, ringdm/2, 0, -2, -1*knptn1, 0, 0
 
  if/(type.eq.2)
 
  call/m(easi_clearpln_goto), 1,0, -1*ringdm/2, -2, 0,1*knptn1, 0
 
   endif
 
  ptmeas/cart, 0, -1*ringdm/2, -2, 0,1*knptn1, 0
 
  if/(type.eq.2)
 
  call/m(easi_clearpln_goto), 1,-1*ringdm/2, 0, -2, 1*knptn1,0, 0
 
  endif
 
  ptmeas/cart, -1*ringdm/2, 0, -2, 1*knptn1,0, 0
 
endmes
 
d(crd4) = datset/fa(pln2), zdir, fa(cir2), xorig
 
d(crd4) = trans/zorig, fa(pln2), yorig, fa(cir2), xorig, -0
 
 
 
 
 
$$ set.term.delete
 
if/(type.eq.1)
 
knptc1=assign/'内'
 
else
 
knptc1=assign/'外'
 
endif
 
text/outfil,concat('环规类型:',knptc1)
 
text/outfil,concat('环规直径:',str(ringdm))
 
text/outfil,concat('环规高度:',str(ringh))
 
text/outfil,concat('测量上偏移量:',str(ringup))
 
text/outfil,concat('测量下偏移量:',str(ringdp))
 
text/outfil,concat('测量层数',str(ringcounts))
 
text/outfil,concat('每层测量点数:',str(ringpoints))
 
decl/common,intgr,allpoints
 
allpoints=assign/ringcounts*ringpoints
 
decl/real,prr,pa,ph,px,py,pi,pj,pda,pdb
 
if/(type.eq.1)
 
f(cyl1) = feat/cylndr,inner,cart, 0,0,-1*ringh/2, 0,0,1, ringdm, ringh
 
call/m(easi_clearpln_goto),1,ringdm/2,0,0, -1,0,0
 
meas/cylndr, f(cyl1),allpoints
 
do/pda,1,ringcounts,1
 
do/pdb,1,ringpoints,1
 
prr=assign/ringdm/2
 
pa=assign/(360/ringpoints)*(pdb-1) 
 
ph=assign/-1*ringup-(ringh-ringup-ringdp)/ringcounts*(pda-1)
 
pi=assign/cos(dtor(pa))*knptn1*-1
 
pj=assign/sin(dtor(pa))*knptn1*-1
 
px=assign/ringdm/2*pi
 
py=assign/ringdm/2*pj
 
    ptmeas/pol,prr,pa,ph,pi,pj,0
 
enddo
 
enddo
 
endmes
 
else
 
f(cyl1) = feat/cylndr,outer,cart, 0,0,-1*ringh/2, 0,0,1, ringdm, ringh
 
meas/cylndr, f(cyl1),allpoints
 
do/pda,1,ringcounts,1
 
do/pdb,1,ringpoints,1
 
prr=assign/ringdm/2
 
pa=assign/(360/ringpoints)*(pdb-1) 
 
ph=assign/-1*ringup-(ringh-ringup-ringdp)/ringcounts*(pda-1)
 
pi=assign/cos(dtor(pa))*knptn1*-1
 
pj=assign/sin(dtor(pa))*knptn1*-1
 
px=assign/ringdm/2*pi
 
py=assign/ringdm/2*pj
 
call/m(easi_clearpln_goto),1,px,py,ph,pi,pj,0
 
    ptmeas/pol,prr,pa,ph,pi,pj,0
 
enddo
 
enddo
 
endmes
 
endif
 
t(tdm1)=tol/diam,-0.500000,0.500000
 
output/fa(cyl1),ta(tdm2)
 
t(tcld1)=tol/cylcty,0.200000
 
output/fa(cyl1),ta(tcld1)

 

参考文献:《2015 pc-dmis比武大赛论文集》


上一个: ​影像测量仪维护与保养要点(影像测量仪维修)
下一个: 暂无
返回列表
最新文章: 三坐标测量软件rationaldmis 高级编程应用实例
最新文章: 思瑞扫描型三坐标测量机助力齿条进行快速检测
相关产品
网站地图