Good evening
I use this macro for 3d probing, after probing it saves the file in "C: \ WORKS \ SCANNING \ SCAN.TXT" and overwrites the file, I would like (if possible) to save it for me later (scan1.txt, scan2 .txt, etc) or if you asked me for the file name.
is there anyone who can help me to modify the script, since i am not capable of it?
I thank
macro
' Macro scansione con tastatore 3D
' partenza scansione da Xiniz Yiniz Z0
' altezza max pezzo = Z0
' spostamenti in rapido a Zmax
' scansione da X0 a Xmax
Sub Main ()
If (GetOEMLED(800)) Then
Message ("ERRORE : MACCHINA IN EMERGENZA ")
Speak ("errore macchina in emergenza") 'Avviso Vocale
Exit Function
End If
Speak (" confernare avvio scansione") 'Avviso Vocale
Tasto = MsgBox("AVVIO SCANSIONE " ,1+64, "CONFERMARE")
If Tasto <> 1 Then
Exit Sub
End If
Dim X As Double
Dim Y As Double
Zmin=GETOEMDRO(1006)
Zmax=GETOEMDRO(1005)
Xmax=GETOEMDRO(1019)
Ymax=GETOEMDRO(1020)
StepZsu=GETOEMDRO(1011)
StepX=GETOEMDRO(1003)
StepY=GETOEMDRO(1004)
AvanzZgiu=GETOEMDRO(1007)
AvanzZsu=GETOEMDRO(1008)
AvanzX=GETOEMDRO(1009)
AvanzY=GETOEMDRO(1010)
intNum=1
Open "C:\LAVORI\SCANSIONE\SCAN.TXT" For Output As intNum ' Open to write file.
Code "G17 G21 G90"
Code "G1 Z" & Zmax & "F" & AvanzZsu
Code "G1 X0 Y0 F" & AvanzX
Code "G1 Z0 F" & AvanzZgiu
Label0:
Code "G31 Z" & Zmin & "F" & AvanzZgiu ' Avvia scansione fino a Zmin
While IsMoving() ' Aspetto mentre si muove
Wend
X = GetParam("XDRO")
Y = GetParam("YDRO")
Z = GetParam("ZDRO")
Write #1, X , Y, Z
Label1:
Code "G91"
Code "G1 Z" & StepZsu & "F" & AvanzZsu ' Salita Z dopo contatto tastatore
While IsMoving() ' Aspetto mentre si muove
Wend
Code "G90"
If GetOemLed (825)<>0 Then ' verifica se tastatore attivo
GoTo Label1
End If
Label3:
Code "G91"
Code "G1 X" & StepX & "F" & AvanzX
While IsMoving() ' Aspetto mentre si muove
Wend
Code "G90"
If GetOemLed (825)<>0 Then ' verifica se tastatore attivo
Code "G91"
Code "G1 X-" & StepX & "F" & AvanzX
While IsMoving() ' Aspetto mentre si muove
Wend
Code "G1 Z" & StepZsu & "F" & AvanzZsu
While IsMoving() ' Aspetto mentre si muove
Wend
Code "G90"
'If Zdro < Zmax Then
If GetVar(2002) < Zmax Then
GoTo Label3
Else
If GetOemLed (825)<>0 Then ' verifica se tastatore attivo
MachMsg("Errore, asse Z max superato","ERRORE",0)
End
Else
GoTo Label3
End If
End If
Else
'If Xdro < Xmax Then
If GetVar(2000) < Xmax Then
GoTo Label0
End If
Code "G0 Z" & Zmax
While IsMoving() ' Aspetto mentre si muove
Wend
Code "G0 X0"
While IsMoving() ' Aspetto mentre si muove
Wend
Code "G91"
Code "G1 Y" & StepY & "F" & AvanzY
While IsMoving() ' Aspetto mentre si muove
Wend
Code "G90"
'If Ydro > Ymax Then
If GetVar(2001) > Ymax Then
Speak (" scansione terminata") 'Avviso Vocale
MachMsg("SCANZIONE TERMINATA ")
End
Else
GoTo Label0
End If
End If
Close intNum
End Sub