DMISMN/'Created by [山涧果子]
UNITS/MM, ANGDEC
WKPLAN/XYPLAN
PRCOMP/OFF
TECOMP/OFF
FLY/1
MODE/PROG, MAN
SNSET/APPRCH, 10.000000
SNSET/RETRCT, 10.000000
SNSET/DEPTH, 0.000000
SNSET/SEARCH, 20.0000
SNSET/CLRSRF, 5.000000
RECALL/D(MCS)
GEOALG/CIRCLE, LSTSQR
GEOALG/ARC, LSTSQR
GEOALG/PLANE, LSTSQR
$$
$$

M(RUN_T) = MACRO/SSS,EEE
           
           DECL/INTGR,NUM11[3],NUM22[3]
           DECL/DOUBLE,TOTIME  
           DECL/CHAR,255, SPLITSTR
           SPLITSTR=ASSIGN/'/'
           KNPTN1 = ASSIGN/INDX(SSS,':') 
           IF/(KNPTN1.GT.0)  
           SPLITSTR=ASSIGN/':'
           ENDIF          
                
                NUM11[1] = ASSIGN/VAL(ELEMNT(1,SPLITSTR,SSS))
                NUM11[2] = ASSIGN/VAL(ELEMNT(2,SPLITSTR,SSS))
                NUM11[3] = ASSIGN/VAL(ELEMNT(3,SPLITSTR,SSS))
                
                NUM22[1] = ASSIGN/VAL(ELEMNT(1,SPLITSTR,EEE))
                NUM22[2] = ASSIGN/VAL(ELEMNT(2,SPLITSTR,EEE))
                NUM22[3] = ASSIGN/VAL(ELEMNT(3,SPLITSTR,EEE))
           
                TOTIME = ASSIGN/(NUM22[1]-NUM11[1])*3600 + (NUM22[2]-NUM11[2])*60 + (NUM22[3]-NUM11[3])      
           
           WRITE/DID(DEFAULTSCREEN),'扫描时间共计为:',TOTIME,'秒'
           
ENDMAC  

DECL/COMMON,DOUBLE,NOM_D,SNS_D
DECL/COMMON,DOUBLE,P_Cord[3],SPH_Cord[3]
DECL/CHAR,20,STATIME,ENDTIME

TEMPSTRING = PROMPT/TITLE,'SP25',TEXT,'请将测头移动到标准球的正上方',$
                    TEXT,'标准球的理论直径为',EDIT,NOM_D

DECL/CHAR,255,SNS_NAME
SNS_NAME = VALUE/SNSLCT
SNS_D = OBTAIN/SA(@SNS_NAME),5
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$取得标准球球心的坐标值$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$定义标准球理论值$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
F(P_Point) = FEAT/POINT,CART,0,0,0,0,0,1
  MEAS/POINT,F(P_Point),0
  ENDMES
  
	P_Cord[1] = OBTAIN/FA(P_Point),3
	P_Cord[2] = OBTAIN/FA(P_Point),4
	P_Cord[3] = OBTAIN/FA(P_Point),5

  MEAS/POINT,F(P_Point),1
    PTMEAS/CART, P_cord[1], P_cord[2], P_cord[3]-1, 0, 0, 1
  ENDMES
  
	P_Cord[1] = OBTAIN/FA(P_Point),3
	P_Cord[2] = OBTAIN/FA(P_Point),4
	P_Cord[3] = OBTAIN/FA(P_Point),5

F(M_SPH) = FEAT/SPHERE, OUTER, CART, P_cord[1], P_cord[2], P_cord[3]-NOM_D/2,$
                NOM_D
                
MODE/AUTO,PROG,MAN
  MEAS/SPHERE,F(M_SPH),5
  ENDMES
  
	SPH_Cord[1] = OBTAIN/FA(M_SPH),4
	SPH_Cord[2] = OBTAIN/FA(M_SPH),5
	SPH_Cord[3] = OBTAIN/FA(M_SPH),6

F(M_SPH) = FEAT/SPHERE, OUTER, CART, SPH_Cord[1], SPH_Cord[2],$
                SPH_Cord[3],NOM_D
  MEAS/SPHERE,F(M_SPH),5
  ENDMES
  
	SPH_Cord[1] = OBTAIN/FA(M_SPH),4
	SPH_Cord[2] = OBTAIN/FA(M_SPH),5
	SPH_Cord[3] = OBTAIN/FA(M_SPH),6

F(M_SPH) = FEAT/SPHERE, OUTER, CART, SPH_Cord[1], SPH_Cord[2],$
                SPH_Cord[3],NOM_D
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

$$$$$$$$$$$$$$$$$$$$$$$$$$$平移坐标系$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
D(SPH25) = TRANS/XORIG,FA(M_SPH),YORIG,FA(M_SPH),ZORIG,FA(M_SPH)
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

GOTO/INCR,10 + NOM_D/2, 1,0,0
GOTO/INCR,5 + NOM_D/2 + SNS_D/2, 0,0,-1

STATIME = ASSIGN/STIME()

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$   扫描   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
MODE/PROG,MAN
DECL/COMMON,DOUBLE,CIR_D1,CIR_D2,S_H
  
  CIR_D1 = ASSIGN/NOM_D/2
  S_H    = ASSIGN/CIR_D1*2/3
  CIR_D2 = ASSIGN/SQRT(CIR_D1*CIR_D1 - S_H*S_H)

$$$$$$$$$$$$$$$$$$$$$设置扫描点数,数值越大点数越少 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
SCNSET/DRAG, ANGLE,40

MEAS/SPHERE,F(M_SPH),4

  P(CIR1_SC) = PATH/ARC,CART, 0.000000, 0.000000, 0.000000, 0.000000,$
	 0.000000, 1.000000, CIR_D1, 0.000000, 360.000000, 1.000000, 0.000000,$
	 0.000000
  PAMEAS/P(CIR1_SC),-1,0,0,REMOVE,COUNT,0,0
  
  GOTO/INCR,10*CIR_D2/CIR_D1 +CIR_D2 -CIR_D1 ,1,0,0
  GOTO/INCR,80/CIR_D1 +S_H ,0,0,1
  
  P(CIR2_SC) = PATH/ARC,CART, 0.000000, 0.000000, S_H, 0.000000,$
	 0.000000, 1.000000, CIR_D2, 0.000000, 360.000000, 1.000000, 0.000000,$
     0.000000
  PAMEAS/P(CIR2_SC),-1,0,0,REMOVE,COUNT,0,0
  
  GOTO/INCR, 10+CIR_D1-CIR_D2 ,1,0,0
  GOTO/INCR,S_H,0,0,-1
  
  P(CIR3_SC) = PATH/ARC,CART,0,0,0,  0,-1,0,  CIR_D1, 0,180, 1,0,0
  PAMEAS/P(CIR3_SC),-1,0,0,REMOVE,COUNT,0,0
  
  GOTO/INCR,(CIR_D1+10)*S_H/CIR_D1 - CIR_D1 ,-1,0,0
  GOTO/INCR,CIR_D2 + 10*CIR_D2/CIR_D1, 0,1,0
  
  P(CIR4_SC) = PATH/ARC,CART,-S_H,0,0,  -1,0,0,  CIR_D2, 0,-180, 0,1,0
  PAMEAS/P(CIR4_SC),0,-1,0,REMOVE,COUNT,0,0
  
  GOTO/INCR,5,-1,-1,0
  
  
ENDMES

ENDTIME = ASSIGN/STIME()

GOTO/INCR,10+NOM_D/2,0,0,1

GOTO/CART,0,0,10+NOM_D/2
            
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 评价 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
M(EASI_SPHERE_HIGHLOW_POINTS) = MACRO/'FEATLABEL', 'DEVICELABEL', HIGHR, LOWR, RADSEPARATION, ER
	DECL/LOCAL, CHAR, 255, FNAME
	DECL/LOCAL, REAL, XC,YC,ZC,XX,YY,ZZ, CDIST,DIAMSPH,HDI,LDI
	DECL/LOCAL, INTGR, PCOUNT, LPCOUNT
	
	FNAME = OBTAIN/F(@FEATLABEL), 1
	ER = ASSIGN/0
	HIGHR = ASSIGN/0
	LOWR = ASSIGN/100000
	
	PCOUNT = VALUE/FA(@FEATLABEL), PTDATA
	XC = OBTAIN/FA(@FEATLABEL), 4
	YC = OBTAIN/FA(@FEATLABEL), 5
	ZC = OBTAIN/FA(@FEATLABEL), 6
	DIAMSPH = OBTAIN/FA(@FEATLABEL),7
	DO/LPCOUNT, 1, PCOUNT
		XX = OBTAIN/FA(@FEATLABEL)[LPCOUNT],2
		YY = OBTAIN/FA(@FEATLABEL)[LPCOUNT],3
		ZZ = OBTAIN/FA(@FEATLABEL)[LPCOUNT],4
		
		CDIST = ASSIGN/SQRT((XX-XC)*(XX-XC)+(YY-YC)*(YY-YC)+(ZZ-ZC)*(ZZ-ZC))
		
		IF/(CDIST .GT. HIGHR)
			HIGHR = ASSIGN/CDIST
		ENDIF

		IF/(CDIST .LT. LOWR)		
			LOWR = ASSIGN/CDIST
		ENDIF
		WRITE/DID(@DEVICELABEL), 'PTN = ',LPCOUNT:2, '  X = ', XX, '  Y = ', YY, '  Z = ', ZZ, '  R = ', CDIST
		WRITE/DID(DEFAULTSCREEN),'PTN = ',LPCOUNT:2, '  X = ', XX, '  Y = ', YY, '  Z = ', ZZ, '  R = ', CDIST		
	ENDDO
	RADSEPARATION = ASSIGN/(HIGHR-LOWR)
	HDI = ASSIGN/(HIGHR-DIAMSPH/2)
	LDI = ASSIGN/(DIAMSPH/2-LOWR)
    IF/(HDI .GT. LDI)
       WRITE/DID(DEFAULTSCREEN),'距离球面最大偏差值为',HDI
    ENDIF
    IF/(HDI .LT. LDI)
       WRITE/DID(DEFAULTSCREEN),'距离球面最大偏差值为',LDI
    ENDIF    
ENDMAC

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

$$$$$$$$$$$$$$$$$$$$$$$$$$输出M_SPH结果$$$$$$$$$$$$$$$$$$$$$$$$$$
DECL/COMMON, REAL, HR, LR, RADSEP
DECL/COMMON, INTGR, LPRET
DECL/COMMON, CHAR, 256, STESTDATE, STESTTIME, SSEP

DID(ISO103602-2Report) = DEVICE/STOR,'ISO-103604-Report.out'
OPEN/DID(ISO103602-2Report), DIRECT, OUTPUT, APPEND

SSEP = ASSIGN/'--------------------------------------------------------------------------------'
STESTDATE = ASSIGN/SDATE()
STESTTIME = ASSIGN/STIME()

WRITE/DID(ISO103602-2Report),SSEP 
WRITE/DID(DEFAULTSCREEN),SSEP 

WRITE/DID(ISO103602-2Report),'ISO10360-4 sphere minimin and maximun radius test. Performed on'
WRITE/DID(DEFAULTSCREEN),'ISO10360-4 sphere minimin and maximun radius test. Performed on'

WRITE/DID(ISO103602-2Report),'TIME : ', STESTTIME  
WRITE/DID(DEFAULTSCREEN),'TIME : ', STESTTIME 

WRITE/DID(ISO103602-2Report),'DATE : ', STESTDATE 
WRITE/DID(DEFAULTSCREEN),'DATE : ', STESTDATE

CALL/M(EASI_SPHERE_HIGHLOW_POINTS), (M_SPH), (ISO103602-2Report), HR, LR, RADSEP, LPRET
WRITE/DID(ISO103602-2Report),' ' 
WRITE/DID(DEFAULTSCREEN),' ' 

WRITE/DID(ISO103602-2Report),'Maximun Radius = ', HR:6:5, '  Minimun Radius = ', LR:6:5, '  Form Error = ', RADSEP:6:5
WRITE/DID(DEFAULTSCREEN),'Maximun Radius = ', HR:6:5, '  Minimun Radius = ', LR:6:5, '  Form Error = ', RADSEP:6:5

CALL/M(RUN_T),STATIME,ENDTIME
CLOSE/DID(ISO103602-2Report), KEEP