ho questa macro per ricerca interno esterno alla riga "Sub ProbeGrounded() " mi da errore
dato che non e' nelle mie capacita'/competenze c'e' qualcuno che mi puo' aiutare a correggerla/modificarla?
ringrazio chiunque mi puo' aiutare
macro:
' pulsante CENTRO INTERNO ESTERNO
Sub Main
If (GetOEMLED(800)) Then
Message ("ERRORE : MACCHINA IN EMERGENZA ")
Speak ("errore macchina in emergenza") 'Avviso Vocale
Exit Function
End If
SetOEMDRO(1152,0)
SetOEMDRO(1824,0)
Speak (" CENTRO INTERNO ESTERNO") 'Avviso Vocale
Begin Dialog SelectCentering 250,15,150,280,"SELEZIONA CENTRO"
OKButton 20,255,40,15
CancelButton 90,255,40,15
GroupBox 5,150,140,100,"CENTRATURA",.GroupBox1
Picture 5, 5, 140, 140, "c:\mach3\bitmaps\Ita_Screenset\centro A.bmp"
text 15,195,100,8, "## INSERIRE LUNGHEZZA "
text 10,225,130,8, "PS: PER LA SCANSIONE ESTERNA > B"
text 10,236,130,8, "POSIZIONARSI 5 MM SOPRA IL PEZZO"
text 11,172,125,8, "-------------------------------------------------------------------"
OptionGroup .OptionGroup1
OptionButton 20,165,100,8," - A - CENTRO INTERNO",.OptionButton1
OptionButton 20,183,100,8," - B - CENTRO ESTERNO" ,.OptionButton2
TextBox 20,210,50,12,.TextBox1
Text 75,211,50,8,"LUNGHEZZA"
End Dialog
Dim Dlg1 As SelectCentering
Button = Dialog (Dlg1)
lunghezza = CDbl(Dlg1.TextBox1)
SetOEMDRO 1152 , lunghezza
If Button = 0 Then Exit Sub
Selected = Dlg1.OptionGroup1
'CENTRO pezzo pieno is selected @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
If Selected = 0 Then
Speak (" CENTRO interno") 'Avviso Vocale
code "M4070"
End If
'CENTRO PEZZO INTERNO is selected@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
If Selected = 1 Then
Rem VBScript Per centrare il diametro esterno della sonda Versione metrica
Speak (" CENTRO PEZZO PIENO") 'Avviso Vocale
Sleep (2000) ' pausa
Speak ("e' stata inserita lunghezza") 'Avviso Vocale
Tasto = MsgBox("LUNGHEZZA INSERITA ?" ,1+64, "CONFERMARE")
If Tasto <> 1 Then
Exit Sub
End If
Message "**** zero assi ****"
DoOEMButton (1008) 'zero X
DoOEMButton (1009) 'zero Y
DoOEMButton (1010) 'zero Z
Call SetOEMDRO(1824,0)
Speak ("ZERO assi completato") 'Avviso Vocale
CurrentFeed = GetOemDRO(818) 'Ottieni l'avanzamento corrente a cui tornare in seguito
CurrentAbsInc = GetOemLED(48) 'Ottieni lo stato G90/G91 corrente
CurrentGmode = GetOemDRO(819) 'Ottieni lo stato G0/G1 corrente
CurrentToolDiameter = GetOemDRO(1000) 'ottiene il diametro dell'utensile corrente
If GetOemLed (825) <> 0 Then 'Controlla per vedere se la sonda è già collegata a terra o difettosa
Call ProbeGrounded()
Exit Sub
Else
XCurrent = GetDro(0)
YCurrent = GetDro(1)
OutsideDiameter = GetUserDRO(1152)
Code "G4 P1" 'Pausa
While IsMoving ()
Wend
Call SetDro (0,0.000)
While IsMoving ()
Wend
Call SetDro (1,0.000)
Code "F100" 'velocità di avanzamento lento a 100 mm/sec
Code "G90 G0 X" &XNew + OutsideDiameter * .7
Code "G91 G0 Z-10"
Rem Sonda sinistra
XNew = Xcurrent - 75
Code "G31 X" &XNew
While IsMoving() 'wait for the move to finish
Sleep(100)
Wend
Code "G91 G0 X1 F10"
While IsMoving() 'wait for the move to finish
Sleep(100)
Wend
Code "G31 X" &XNew
While IsMoving() 'wait for the move to finish
Sleep(100)
Wend
XPos1 = GetVar(2000) 'get the probe touch location
Code "G91 G0 X1 F400"
Code "G91 G0 Z10"
Code "G90 G0 X" &XCurrent 'rapid move back to start point
Code "G91 G1 X" &XCurrent - OutsideDiameter * .6
Code "G91 G0 Z-10"
Rem Probe destra
XNew = XCurrent + 75 'probe 75mm to right
Code "G31 X" &XNew
While IsMoving()
Sleep(100)
Wend
Code "G91 G0 X-1 F10"
While IsMoving() 'wait for the move to finish
Sleep(100)
Wend
Code "G31 X" &XNew
While IsMoving() 'wait for the move to finish
Sleep(100)
Wend
XPos2 = GetVar(2000)
Code "G91 G0 X-1 F400"
Code "G91 G0 Z10"
XCenter = (XPos1 + XPos2) / 2 'center is midway between XPos1 and XPos2
Code "G90 G0 X" &XCenter 'rapid move to the x center location
While IsMoving ()
Sleep(100)
Wend
Call SetDro (0,0.000)
Code "G4 P0.25"
Code "G90 G1 Y" &YNew - OutsideDiameter * .6
Code "G91 G0 Z-10"
Rem sonda In su
YNew = YCurrent + 75
Code "G31 Y" &YNew
While IsMoving()
Sleep(100)
Wend
Code "G91 G0 Y-1 F10"
While IsMoving() 'wait for the move to finish
Sleep(100)
Wend
Code "G31 Y" &YNew
While IsMoving() 'wait for the move to finish
Sleep(100)
Wend
YPos1 = GetVar(2001)
Code "G91 G0 Y-1 F400"
Code "G91 G0 Z10"
Code "G90 G0 Y" &YCurrent
Code "G91 G1 Y" &YCurrent + OutsideDiameter * .6
Code "G91 G0 Z-10"
Rem Sonda abbassata
YNew = YCurrent - 75
Code "G31 Y" &YNew
While IsMoving()
Sleep(100)
Wend
Code "G91 G0 Y1 F10"
While IsMoving() 'wait for the move to finish
Sleep(100)
Wend
Code "G31 Y" &YNew
While IsMoving() 'wait for the move to finish
Sleep(100)
Wend
YPos2 = GetVar(2001)
Code "G91 G0 Y1 F400"
Code "G91 G0 Z10"
YCenter = (YPos1 + YPos2) / 2
Rem spostare Al centro
Code "G90 G0 Y" &YCenter
While IsMoving ()
Wend
Call SetDro (1,0.000)
While IsMoving ()
Wend
Call SetUserDro (1824,YPos2 - YPos1 - CurrentToolDiameter)
Code "G4 P0.25"
Code "F" &CurrentFeed 'ripristina la velocità di avanzamento iniziale
Call ReturnG90G91State()
Exit Sub
End If
Sub ProbeGrounded()
Code "(La piastra della sonda è collegata a terra, controllare la connessione e riprovare)"
Call ReturnG90G91State()
End Sub
Sub ReturnG90G91State()
If CurrentAbsInc = 0 Then 'se G91 era in vigore prima, torna ad esso
Code "G91"
End If
If CurrentGMode = 0 Then 'se G0 era in vigore prima, torna ad esso
Code "G0"
End If
End If
End Sub