Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: birillo1959 on March 09, 2018, 05:22:28 AM
-
303/5000
Good morning, I have a macro (not mine, downloaded from cncitalia) for center hole works well I would like to add, if possible, at the end of the survey the measurement detected, the one I use is:
Rem VBScript To center probe Inside Diameter Metric Version
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")
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")
Code "G0 Y" & (A+(B-A)/2)
SetParam("FeedRate",Fcurr)
ps: I saw that in the section MACH TOOL BOX there is one of vmax549 (m1055.m1s) but I would like to apply it to my if possible
regards
-
do you mean you want a messeage box witch Shows the measured X and Y Diameter ?
-
exact, I would want that at the end it gave the diameter to me of the hole
-
have a try this does what you want.
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
-
It works very well and is what I wanted
TPS you are a BIG ;) ;) ;)
thank you for your help !!!!!!
ps: I have another problem if it is possible I have to open another topic?