VisualDMIS 6.5更換架ACR3 高階程式設計

山澗果子發表於2020-12-16
$$DMISLAYER/'ACR3(Calibration).dms'
DECL/REAL,PortX[17],PortY[17],PortZ[17],PosX,PosY,PosZ,SNLeng,SnDia
DECL/INTGR,10,SEQ,NUM,R,PORTDIR,CrNo,PortNum,AcrNo
DECL/CHAR,10,HomeDir,CRNAME,CRNUM,PTNAME,PTNUM,calibfil,CalibFile,AXIS
UNITS/MM,ANGDEC
WKPLAN/XYPLAN
$$ENDLAYER
MODE/PROG,MAN
PRCOMP/ON
RECALL/D(MCS)
$$S(DEFAULT)=SNSDEF/PROBE,INDEX,POL,0.0000,0.0000,$
0.000000,0.000000,-1.000000,126.9744,1.9797
SNSLCT/S(DEFAULT)
SnLeng=OBTAIN/SA(DEFAULT),9
SnDia=OBTAIN/SA(DEFAULT),10
NUM = 0
CALL/EXTERN,DME, 'V3DHOME',HomeDir
CalibFile = CONCAT(HomeDir,'\Users\Sensor\ACR3calib.data')
DID(PORTDATA) = DEVICE/STOR, CalibFile
OPEN/DID(PORTDATA),DIRECT,OUTPUT,OVERWR
TEXT/OPER,'Move ACR3 to the unlocked positon (Positioned to the left-hand side of the travel)'
TEXT/OPER,'Insert the lid clips on the ACR3'
TEXT/OPER,'Move the probe to the start position, then Press OK to Continue'
DMIS/OFF
  GET/POS(PosX,PosY,PosZ) 
DMIS/ON
F(RACK_PT1)=FEAT/POINT, CART, PosX, PosY, PosZ-SnDia, 0.000000, $
 0.000000, 1.000000
MEAS/POINT, F(RACK_PT1), 1
PTMEAS/CART, PosX, PosY, PosZ-SnDia, 0.000000, 0.000000, 1.000000
ENDMES
PosX = OBTAIN/FA(RACK_PT1),3
PosY = OBTAIN/FA(RACK_PT1),4
PosZ = OBTAIN/FA(RACK_PT1),5
(GetPortNum)
TEXT/QUERY,(PortNum),1,A,L,'Please Enter the number of ports (4 or 8)'
IF/(PortNum.NE.4).AND.(PortNum.NE.8)
   TEXT/OPER,'Only "4" or "8" can be used for ACR3 operation.'
   JUMPTO/(GetPortNum)
ENDIF
(GetAxis)
TEXT/QUERY,(AXIS),1,A,L,'Please Enter the Axis of ACR3 operation (X, Y or -Y)'
IF/AXIS.EQ.'X'
	WRITE/DID(PORTDATA),'1.000000, 0.000000, 0.000000'
	JUMPTO/(PORTDIR_X)
ELSE
  IF/AXIS.EQ.'Y'
	WRITE/DID(PORTDATA),'0.000000, 1.000000, 0.000000'
	JUMPTO/(PORTDIR_Y)
  ELSE
    IF/AXIS.EQ.'-Y'
	WRITE/DID(PORTDATA),'0.000000, -1.000000, 0.000000'
	JUMPTO/(PORTDIR_MY)
    ELSE
	TEXT/OPER,'Only "X", "Y" or "-Y" axis can be used for ACR3 operation.'
	JUMPTO/(GetAxis)
    ENDIF
  ENDIF
ENDIF
$$ ************************* + X DIRECTION *************************
(PORTDIR_X)
GOTO/PosX, PosY-(SnDia*2), PosZ+(SnDia*2)
GOTO/PosX, PosY-(SnDia*2), PosZ-SnDia
F(RACK_PT2)=FEAT/POINT, CART, PosX, PosY-SnDia, PosZ-SnDia, 0.000000, $
 -1.000000, 0.000000
MEAS/POINT, F(RACK_PT2), 1
PTMEAS/CART, PosX, PosY-SnDia, PosZ-SnDia, 0.000000, -1.000000, 0.000000
ENDMES
PosY = OBTAIN/FA(RACK_PT2),4
GOTO/PosX+(SnDia*2), PosY-(SnDia*2), PosZ-SnDia
GOTO/PosX+(SnDia*2), PosY+3, PosZ-SnDia
F(RACK_PT3)=FEAT/POINT, CART, PosX-SnDia, PosY+3, PosZ-SnDia, 1.000000, $
 0.000000, 0.000000
MEAS/POINT, F(RACK_PT3), 1
PTMEAS/CART, PosX-SnDia, PosY+3, PosZ-SnDia, 1.000000, 0.000000, 0.000000
ENDMES
PosX = OBTAIN/FA(RACK_PT3),3
PosX = PosX + 12.675
PosY = PosY + 12.83
DO/SEQ,0,(PortNum*2)-1,1
GOTO/PosX+(35*NUM), PosY, PosZ+3
CrNo=SEQ+1
CRNUM=STR(CrNo)
CRNAME='PORT'
CRNAME=CONCAT(CRNAME,CRNUM)
F(CRNAME)=FEAT/CIRCLE,INNER,CART, PosX+(35*NUM), PosY, PosZ-1.5, 0.000000, $
 0.000000, 1.000000,25.350000
MEAS/CIRCLE,F(CRNAME),3
PTMEAS/CART,PosX+(35*NUM)-12.482441, PosY+ 2.200988, PosZ-1.5, 0.984808, -0.173648, 0.000000
PTMEAS/CART,PosX+(35*NUM), PosY+12.675000, PosZ-1.5, 0.000000, -1.000000, 0.000000
PTMEAS/CART,PosX+(35*NUM)+12.482441, PosY+ 2.200988, PosZ-1.5,-0.984808, -0.173648, 0.000000
ENDMES
PortX[CrNo] = OBTAIN/FA(CRNAME),4
PortY[CrNo] = OBTAIN/FA(CRNAME),5
F(RACK_PL) = FEAT/PLANE, CART, PosX+(35*NUM), PosY, PosZ, 0.000000, 0.000000, 1.000000
MEAS/PLANE,F(RACK_PL),4
PTMEAS/CART, PosX+(35*NUM)-13.5, PosY-8, PosZ, 0.000000, 0.000000, 1.000000
PTMEAS/CART, PosX+(35*NUM)-12.5, PosY+8, PosZ, 0.000000, 0.000000, 1.000000
PTMEAS/CART, PosX+(35*NUM)+12.5, PosY+8, PosZ, 0.000000, 0.000000, 1.000000
PTMEAS/CART, PosX+(35*NUM)+13.5, PosY-8, PosZ, 0.000000, 0.000000, 1.000000
ENDMES
NUM = NUM + 1
PortZ[CrNo] = OBTAIN/FA(RACK_PL),5
PortY[CrNo] = PortY[CrNo] - 1
WRITE/DID(PORTDATA),PortX[CrNo],',',PortY[CrNo],',',PortZ[CrNo]
$$
  IF/PortNum.EQ.4
     IF/SEQ == 3
	GOTO/PosX+35*(NUM-1)+13.5, PosY-8, PosZ+30
	TEXT/OPER,'Move the Rack to the Locked Position Manually, then Press OK to Continue'
	PosX = PosX - 12.675 + 88.7
        F(RACK_PT4)=FEAT/POINT, CART, PosX+2, PosY-9.83, PosZ-2, 1.000000, $
         0.000000, 0.000000
        MEAS/POINT, F(RACK_PT4), 1
        PTMEAS/CART, PosX+2, PosY-9.83, PosZ-2, 1.000000, 0.000000, 0.000000
        ENDMES
        PosX = OBTAIN/FA(RACK_PT4),3
        PosX = PosX + 12.675
        NUM = 0
     ENDIF
  ENDIF
$$
  IF/PortNum.EQ.8
     IF/(SEQ == 3).OR.(SEQ == 11)
        GOTO/PosX+35*(NUM-1)+13.5, PosY-8, PosZ+30
        PosX = PosX+35*(NUM-1) - 12.675 + 82
        GOTO/PosX + 12.675,PosY-8, PosZ+30
        F(RACK_PT4)=FEAT/POINT, CART, PosX+2, PosY-9.83, PosZ-2, 1.000000, $
         0.000000, 0.000000
        MEAS/POINT, F(RACK_PT4), 1
        PTMEAS/CART, PosX+2, PosY-9.83, PosZ-2, 1.000000, 0.000000, 0.000000
        ENDMES
        PosX = OBTAIN/FA(RACK_PT4),3
        PosX = PosX + 12.675
        NUM = 0
     ENDIF
     IF/SEQ == 7
	GOTO/PosX+35*(NUM-1)+13.5, PosY-8, PosZ+30
	TEXT/OPER,'Move the Rack to the Locked Position Manually, then Press OK to Continue'
	PosX = PosX -187 -12.675 + 88.7
	GOTO/PosX + 12.675,PosY-8, PosZ+30
        F(RACK_PT5)=FEAT/POINT, CART, PosX+2, PosY-9.83, PosZ-2, 1.000000, $
         0.000000, 0.000000
        MEAS/POINT, F(RACK_PT5), 1
        PTMEAS/CART, PosX+2, PosY-9.83, PosZ-2, 1.000000, 0.000000, 0.000000
        ENDMES
        PosX = OBTAIN/FA(RACK_PT5),3
        PosX = PosX + 12.675
        NUM = 0
     ENDIF
  ENDIF
ENDDO
GOTO/PosX+35*(NUM-1)+13.5, PosY-8, PosZ+30
JUMPTO/(FINISH)
$$ ************************* + Y DIRECTION *************************
(PORTDIR_Y)
GOTO/PosX+(SnDia*2), PosY, PosZ+(SnDia*2)
GOTO/PosX+(SnDia*2), PosY, PosZ-SnDia
F(RACK_PT2)=FEAT/POINT, CART, PosX+SnDia, PosY, PosZ-SnDia, 1.000000, $
 0.000000, 0.000000
MEAS/POINT, F(RACK_PT2), 1
PTMEAS/CART, PosX+SnDia, PosY, PosZ-SnDia, 1.000000, 0.000000, 0.000000
ENDMES
PosX = OBTAIN/FA(RACK_PT2),3
GOTO/PosX+(SnDia*2), PosY+(SnDia*2), PosZ-SnDia
GOTO/PosX-3, PosY+(SnDia*2), PosZ-SnDia
F(RACK_PT3)=FEAT/POINT, CART, PosX-3, PosY+SnDia, PosZ-SnDia, 0.000000, $
 1.000000, 0.000000
MEAS/POINT, F(RACK_PT3), 1
PTMEAS/CART, PosX-3, PosY+SnDia, PosZ-SnDia, 0.000000, 1.000000, 0.000000
ENDMES
PosY = OBTAIN/FA(RACK_PT3),4
PosX = PosX - 12.83
PosY = PosY + 12.675
DO/SEQ,0,(PortNum*2)-1,1
GOTO/PosX, PosY+(35*NUM), PosZ+3
CrNo=SEQ+1
CRNUM=STR(CrNo)
CRNAME='PORT'
CRNAME=CONCAT(CRNAME,CRNUM)
F(CRNAME)=FEAT/CIRCLE,INNER,CART, PosX, PosY+(35*NUM), PosZ-1.5, 0.000000, $
 0.000000, 1.000000,25.350000
MEAS/CIRCLE,F(CRNAME),3
PTMEAS/CART,PosX- 2.200988, PosY+(35*NUM)-12.482441, PosZ-1.5, 0.173648, 0.984808, 0.000000
PTMEAS/CART,PosX-12.675000, PosY+(35*NUM), PosZ-1.5, 1.000000, 0.000000, 0.000000
PTMEAS/CART,PosX- 2.200988, PosY+(35*NUM)+12.482441, PosZ-1.5, 0.173648,-0.984808, 0.000000
ENDMES
PortX[CrNo] = OBTAIN/FA(CRNAME),4
PortY[CrNo] = OBTAIN/FA(CRNAME),5
F(RACK_PL) = FEAT/PLANE, CART, PosX, PosY+(35*NUM), PosZ, 0.000000, 0.000000, 1.000000
MEAS/PLANE,F(RACK_PL),4
PTMEAS/CART, PosX+8, PosY+(35*NUM)-13.5, PosZ, 0.000000, 0.000000, 1.000000
PTMEAS/CART, PosX-8, PosY+(35*NUM)-12.5, PosZ, 0.000000, 0.000000, 1.000000
PTMEAS/CART, PosX-8, PosY+(35*NUM)+12.5, PosZ, 0.000000, 0.000000, 1.000000
PTMEAS/CART, PosX+8, PosY+(35*NUM)+13.5, PosZ, 0.000000, 0.000000, 1.000000
ENDMES
NUM = NUM + 1
PortZ[CrNo] = OBTAIN/FA(RACK_PL),5
PortX[CrNo] = PortX[CrNo] + 1
WRITE/DID(PORTDATA),PortX[CrNo],',',PortY[CrNo],',',PortZ[CrNo]
$$
  IF/PortNum.EQ.4  
     IF/SEQ == 3
	GOTO/PosX+8, PosY+35*(NUM-1)+13.5, PosZ+30
	TEXT/OPER,'Move the Rack to the Locked Position Manually, then Press OK to Continue'
	PosY = PosY -12.675 + 88.7
	F(RACK_PT4)=FEAT/POINT, CART, PosX+9.83, PosY+2, PosZ-2, 0.000000, $
	 1.000000, 0.000000
	MEAS/POINT, F(RACK_PT4), 1
	PTMEAS/CART, PosX+9.83, PosY+2, PosZ-2, 0.000000, 1.000000, 0.000000
	ENDMES
	PosY = OBTAIN/FA(RACK_PT4),4
	PosY = PosY + 12.675
	NUM = 0
     ENDIF
  ENDIF
$$
  IF/PortNum.EQ.8
     IF/(SEQ == 3).OR.(SEQ == 11)
        GOTO/PosX+8, PosY+35*(NUM-1)+13.5, PosZ+30
        PosY = PosY+35*(NUM-1) - 12.675 + 82
        GOTO/PosX+8, PosY+12.675, PosZ+30
        F(RACK_PT4)=FEAT/POINT, CART, PosX+9.83, PosY+2, PosZ-2, 0.000000, $
         1.000000, 0.000000
        MEAS/POINT, F(RACK_PT4), 1
        PTMEAS/CART, PosX+9.83, PosY+2, PosZ-2, 0.000000, 1.000000, 0.000000
        ENDMES
        PosY = OBTAIN/FA(RACK_PT4),4
        PosY = PosY + 12.675
        NUM = 0
     ENDIF
     IF/SEQ == 7
	GOTO/PosX+8, PosY+35*(NUM-1)+13.5, PosZ+30
	TEXT/OPER,'Move the Rack to the Locked Position Manually, then Press OK to Continue'
	PosY = PosY - 187 - 12.675 + 88.7
	GOTO/PosX+8, PosY+12.675, PosZ+30
        F(RACK_PT5)=FEAT/POINT, CART, PosX+9.83, PosY+2, PosZ-2, 0.000000, $
         1.000000, 0.000000
        MEAS/POINT, F(RACK_PT5), 1
        PTMEAS/CART, PosX+9.83, PosY+2, PosZ-2, 0.000000, 1.000000, 0.000000
        ENDMES
        PosY = OBTAIN/FA(RACK_PT5),4
        PosY = PosY + 12.675
        NUM = 0
     ENDIF
  ENDIF
ENDDO
GOTO/PosX+8, PosY+35*(NUM-1)+13.5, PosZ+30
JUMPTO/(FINISH)
$$ ************************* - Y DIRECTION *************************
(PORTDIR_MY)
GOTO/PosX-(SnDia*2), PosY, PosZ+(SnDia*2)
GOTO/PosX-(SnDia*2), PosY, PosZ-SnDia
F(RACK_PT2)=FEAT/POINT, CART, PosX-SnDia, PosY, PosZ-SnDia, -1.000000, $
 0.000000, 0.000000
MEAS/POINT, F(RACK_PT2), 1
PTMEAS/CART, PosX-SnDia, PosY, PosZ-SnDia, -1.000000, 0.000000, 0.000000
ENDMES
PosX = OBTAIN/FA(RACK_PT2),3
GOTO/PosX-(SnDia*2), PosY-(SnDia*2), PosZ-SnDia
GOTO/PosX+3, PosY-(SnDia*2), PosZ-SnDia
F(RACK_PT3)=FEAT/POINT, CART, PosX+3, PosY-SnDia, PosZ-SnDia, 0.000000, $
 -1.000000, 0.000000
MEAS/POINT, F(RACK_PT3), 1
PTMEAS/CART, PosX+3, PosY-SnDia, PosZ-SnDia, 0.000000, -1.000000, 0.000000
ENDMES
PosY = OBTAIN/FA(RACK_PT3),4
PosX = PosX + 12.83
PosY = PosY - 12.675
DO/SEQ,0,(PortNum*2)-1,1
GOTO/PosX, PosY-(35*NUM), PosZ+3
CrNo=SEQ+1
CRNUM=STR(CrNo)
CRNAME='PORT'
CRNAME=CONCAT(CRNAME,CRNUM)
F(CRNAME)=FEAT/CIRCLE,INNER,CART, PosX, PosY-(35*NUM), PosZ-1.5, 0.000000, $
 0.000000, 1.000000,25.350000
MEAS/CIRCLE,F(CRNAME),3
PTMEAS/CART,PosX+ 2.200988, PosY-(35*NUM)+12.482441, PosZ-1.5, -0.173648, -0.984808, 0.000000
PTMEAS/CART,PosX+12.675000, PosY-(35*NUM), PosZ-1.5, -1.000000, 0.000000, 0.000000
PTMEAS/CART,PosX+ 2.200988, PosY-(35*NUM)-12.482441, PosZ-1.5, -0.173648, 0.984808, 0.000000
ENDMES
PortX[CrNo] = OBTAIN/FA(CRNAME),4
PortY[CrNo] = OBTAIN/FA(CRNAME),5
F(RACK_PL) = FEAT/PLANE, CART, PosX, PosY-(35*NUM), PosZ, 0.000000, 0.000000, 1.000000
MEAS/PLANE,F(RACK_PL),4
PTMEAS/CART, PosX-8, PosY-(35*NUM)+13.5, PosZ, 0.000000, 0.000000, 1.000000
PTMEAS/CART, PosX+8, PosY-(35*NUM)+12.5, PosZ, 0.000000, 0.000000, 1.000000
PTMEAS/CART, PosX+8, PosY-(35*NUM)-12.5, PosZ, 0.000000, 0.000000, 1.000000
PTMEAS/CART, PosX-8, PosY-(35*NUM)-13.5, PosZ, 0.000000, 0.000000, 1.000000
ENDMES
NUM = NUM + 1
PortZ[CrNo] = OBTAIN/FA(RACK_PL),5
PortX[CrNo] = PortX[CrNo] - 1
WRITE/DID(PORTDATA),PortX[CrNo],',',PortY[CrNo],',',PortZ[CrNo]
$$
  IF/PortNum.EQ.4  
     IF/SEQ == 3
	GOTO/PosX-8, PosY-35*(NUM-1)-13.5, PosZ+30
	TEXT/OPER,'Move the Rack to the Locked Position Manually, then Press OK to Continue'
	PosY = PosY +12.675 - 88.7
	F(RACK_PT4)=FEAT/POINT, CART, PosX-9.83, PosY-2, PosZ-2, 0.000000, $
	 -1.000000, 0.000000
	MEAS/POINT, F(RACK_PT4), 1
	PTMEAS/CART, PosX-9.83, PosY-2, PosZ-2, 0.000000, -1.000000, 0.000000
	ENDMES
	PosY = OBTAIN/FA(RACK_PT4),4
	PosY = PosY - 12.675
	NUM = 0
     ENDIF
  ENDIF
$$
  IF/PortNum.EQ.8
     IF/(SEQ == 3).OR.(SEQ == 11)
        GOTO/PosX-8, PosY-35*(NUM-1)-13.5, PosZ+30
        PosY = PosY-35*(NUM-1) + 12.675 - 82
        GOTO/PosX-8, PosY-12.675, PosZ+30
        F(RACK_PT4)=FEAT/POINT, CART, PosX-9.83, PosY-2, PosZ-2, 0.000000, $
         -1.000000, 0.000000
        MEAS/POINT, F(RACK_PT4), 1
        PTMEAS/CART, PosX-9.83, PosY-2, PosZ-2, 0.000000, -1.000000, 0.000000
        ENDMES
        PosY = OBTAIN/FA(RACK_PT4),4
        PosY = PosY - 12.675
        NUM = 0
     ENDIF
     IF/SEQ == 7
	GOTO/PosX-8, PosY-35*(NUM-1)-13.5, PosZ+30
	TEXT/OPER,'Move the Rack to the Locked Position Manually, then Press OK to Continue'
	PosY = PosY + 187 + 12.675 - 88.7
	GOTO/PosX-8, PosY-12.675, PosZ+30
        F(RACK_PT5)=FEAT/POINT, CART, PosX-9.83, PosY-2, PosZ-2, 0.000000, $
         -1.000000, 0.000000
        MEAS/POINT, F(RACK_PT5), 1
        PTMEAS/CART, PosX-9.83, PosY-2, PosZ-2, 0.000000, -1.000000, 0.000000
        ENDMES
        PosY = OBTAIN/FA(RACK_PT5),4
        PosY = PosY - 12.675
        NUM = 0
     ENDIF
  ENDIF
ENDDO
GOTO/PosX-8, PosY-35*(NUM-1)-13.5, PosZ+30
$$ *****************************************************
(FINISH)
TEXT/OPER,'Remove all LID retaining clips.'
WRITE/DID(PORTDATA),SNLENG,',0.000000,36.000000'
WRITE/DID(PORTDATA),'0.000000,0.000000,0.000000'
CLOSE/DID(PORTDATA),KEEP
dmesw/COMAND,'configacr:calibfile'
TEXT/OPER,'Calibration completed!'
ENDFIL

相關文章