This routine will sample 4 points around the manual touch and calculate the actual hit based on a sampled plane
DMISMN/'Created by [山涧果子] on 星期四, 一月 25, 2018', 4.0
UNITS/MM, ANGDEC
WKPLAN/XYPLAN
PRCOMP/ON
TECOMP/ON
FLY/1.000000
MODE/MAN
SNSET/APPRCH, 3
SNSET/RETRCT, 3
SNSET/DEPTH, 0
SNSET/SEARCH, 10
SNSET/CLRSRF, 30
RECALL/D(MCS)
SNSLCT/S(ROOTSN1)
GEOALG/CIRCLE, LSTSQR
GEOALG/ARC, LSTSQR
GEOALG/PLANE, LSTSQR
$$
$$ 这个程序的目的,手动随机取一点,根据取样距离,实际触测四点,测量平面!
MODE/MAN
DECL/COMMON, INTGR, KNPTN1
KNPTN1 = PROMPT/TEXT, '请手动在工件上表面测量一点!'
F(PT1) = FEAT/POINT,CART, 0, 0, 0, 0.000000,$
0.000000, 1.000000
$$ Empty Meas Block
MEAS/POINT, F(PT1), 1
ENDMES
D(CRD1) = TRANS/XORIG, FA(PT1), YORIG, FA(PT1), ZORIG, FA(PT1)
MODE/PROG,MAN
DECL/COMMON,DOUBLE,X1,Y1,Z1,I1,J1,K1
DECL/COMMON,DOUBLE,Juli
Juli = PROMPT/'请输入用于取样的距离!!'
X1 = OBTAIN/FA(PT1),3
Y1 = OBTAIN/FA(PT1),4
Z1 = OBTAIN/FA(PT1),5
I1 = OBTAIN/FA(PT1),6
J1 = OBTAIN/FA(PT1),7
K1 = OBTAIN/FA(PT1),8
DECL/COMMON,DOUBLE,Xmes1,Ymes1,Zmes1
DECL/COMMON,DOUBLE,Xmes2,Ymes2,Zmes2
DECL/COMMON,DOUBLE,Xmes3,Ymes3,Zmes3
DECL/COMMON,DOUBLE,Xmes4,Ymes4,Zmes4
Xmes1 = ASSIGN/X1+(1-I1)*Juli
Ymes1 = ASSIGN/Y1+(1-J1)*Juli
Zmes1 = ASSIGN/Z1+(1-K1)*Juli
Xmes2 = ASSIGN/X1+(1-I1)*Juli
Ymes2 = ASSIGN/Y1-(1-J1)*Juli
Zmes2 = ASSIGN/Z1-(1-K1)*Juli
Xmes3 = ASSIGN/X1-(1-I1)*Juli
Ymes3 = ASSIGN/Y1-(1-J1)*Juli
Zmes3 = ASSIGN/Z1+(1-K1)*Juli
Xmes4 = ASSIGN/X1-(1-I1)*Juli
Ymes4 = ASSIGN/Y1+(1-J1)*Juli
Zmes4 = ASSIGN/Z1-(1-K1)*Juli
F(PLN1) = FEAT/PLANE,CART, X1, Y1, Z1, I1,J1, K1
$$ Measurement points are created through nominal points
MEAS/PLANE, F(PLN1), 4
PTMEAS/CART, Xmes1,Ymes1,Zmes1, I1,J1, K1
PTMEAS/CART, Xmes2,Ymes2,Zmes2, I1,J1, K1
PTMEAS/CART, Xmes3,Ymes3,Zmes3, I1,J1, K1
PTMEAS/CART, Xmes4,Ymes4,Zmes4, I1,J1, K1
ENDMES