Hello Guest it is March 28, 2024, 07:46:27 AM

Author Topic: macro tube center modification  (Read 1558 times)

0 Members and 1 Guest are viewing this topic.

macro tube center modification
« on: April 21, 2018, 05:51:44 AM »
Good morning
I have the following script for center hole I would like to make some changes
1 at the end gives me the diameter of the hole without the diameter of the probe (5mm).
the diameter of the probe imposed in the DRO oem code function 1000
the final diameter is displayed in the DRO oem code function 1152

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")
   
   
   
   
      


       

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: macro tube center modification
« Reply #1 on: April 22, 2018, 04:39:08 AM »
SetOEMDro(1152,measuredY + GetOEMDro(1000))

somewhere after measuredY  is calculated
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: macro tube center modification
« Reply #2 on: April 23, 2018, 03:07:49 AM »
Good morning
thanks TPS (as always very kind) for the answer
I inserted the line after "measuredY = B-A"
works well

THANKS AGAIN !!