1951
VB and the development of wizards / Re: center hole script
« on: March 09, 2018, 11:50:01 AM »
have a try this does what you want.
the Measurement Y sjould be the Diameter of hole - Probediamater
Code: [Select]
Speak ("ricerca centro pezzointerno") 'Avviso Vocale
Message "RICERCA CENTRO PEZZO INTERNO"
Sleep (1000) ' pausa di 1 secondi
response = MsgBox ("CONFERMARE RICERCA CENTRO PEZZO INTERNO")
Sleep (1000) ' pausa di 1 secondi
Speak (" CONFERMARE centro pezzo interno") 'Avviso Vocale
Message "INIZIO CENTRO PEZZO INTERNO"
Sleep (1000) ' pausa di 1 secondi
response = MsgBox ("CONFERMARE CENTRO PEZZO INTERNO")
Call SetDRO(0,0)
Call SetDRO(1,0)
Xpos = GetParam("XDRO")
Ypos = GetParam("YDRO")
Fcurr = GetParam("FeedRate")
SP = 80 ' avanzamento prima palp impostare diametro mm del cerchio da palpare
VSP = "F200" ' velocita avanzamento prima palp
bkSP = 3 ' ritorno dopo palp mm
VbkSP = "F240" ' velocita ritorno
Spp = 5 ' avanzamento seconda palp mm
VSpp = "F40" ' velocita seconda palp
Code "G31 X" & (GetParam("XDRO")+SP) & (VSP)
While IsMoving()
Wend
Code "G0 X" & (GetParam("XDRO")-bkSP) & (VbkSP)
While IsMoving()
Wend
Code "G31 X" & (GetParam("XDRO")+Spp) & VSpp
While IsMoving()
Wend
B=GetParam("XDRO")
Code "G0 X" & Xpos
Code "G31 X" & (GetParam("XDRO")-SP) & (VSP)
While IsMoving()
Wend
Code "G0 X" & (GetParam("XDRO")+bkSP) & (VbkSP)
While IsMoving()
Wend
Code "G31 X" & (GetParam("XDRO")-Spp) & VSpp
While IsMoving()
Wend
A=GetParam("XDRO")
measuredX = B-A
Code "G0 X" & (A+(B-A)/2)
While IsMoving()
Wend
Code "G31 Y" & (GetParam("YDRO")+SP) & (VSP)
While IsMoving()
Wend
Code "G0 Y" & (GetParam("YDRO")-bkSP) & (VbkSP)
While IsMoving()
Wend
Code "G31 Y" & (GetParam("YDRO")+Spp) & VSpp
While IsMoving()
Wend
B=GetParam("YDRO")
Code "G0 Y" & Ypos
Code "G31 Y" & (GetParam("YDRO")-SP) & (VSP)
While IsMoving()
Wend
Code "G0 Y" & (GetParam("YDRO")+bkSP) & (VbkSP)
While IsMoving()
Wend
Code "G31 Y" & (GetParam("YDRO")-Spp) & VSpp
While IsMoving()
Wend
A=GetParam("YDRO")
measuredY = B-A
Code "G0 Y" & (A+(B-A)/2)
SetParam("FeedRate",Fcurr)
MsgBox (" Measurement X: " & nFmt(measuredX,3) & " mm Measurement Y: " & nFmt(measuredY,3) & " mm")
the Measurement Y sjould be the Diameter of hole - Probediamater