Hello Guest it is March 28, 2024, 11:17:29 AM

Author Topic: center hole script  (Read 1972 times)

0 Members and 1 Guest are viewing this topic.

center hole script
« 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

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: center hole script
« Reply #1 on: March 09, 2018, 09:41:15 AM »
do you mean you want a messeage box witch Shows the measured X and Y Diameter ?
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: center hole script
« Reply #2 on: March 09, 2018, 11:35:25 AM »
exact, I would want that at the end it gave the diameter to me of the hole

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: center hole script
« Reply #3 on: March 09, 2018, 11:50:01 AM »
have a try this does what you want.

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
« Last Edit: March 09, 2018, 12:05:17 PM by TPS »
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: center hole script
« Reply #4 on: March 09, 2018, 01:16:11 PM »
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?