Hello Guest it is April 11, 2021, 09:52:48 PM

Author Topic: edit script  (Read 1217 times)

0 Members and 1 Guest are viewing this topic.

edit script
« on: May 15, 2019, 06:38:03 AM »
good morning
I found the following macro for tracer points on the net,
I would like to modify it, if possible, in the following way:
when I click on the button a menu should come where I set the parameters:
Zmin = -20
Zmax = 20
Xmax = 5
Ymax = 5
StepZsu = 5
StepX = 1
Stepy = 1
AvanzZgiu = 200
AvanzZsu = 1000
AvanzX = 1000
AvanzY = 1000
Xiniz = 0
Yiniz = 0
I don't know if it's a feasible thing, given that I'm not capable of VB programming.
I thank those who could help me
ps I apologize for English use google translator

'da fare attenzione al valore StepX
'quando lo stilo tocca il pezzo durante la discesa si ferma e vengono registrate le coordinate nel file, poi risale del valore 'StepZsu e se il contatto si chiude, si sposta verso X+ del valore inserito in StepX
'se durante lo spostamento in X lo stilo tocca la macchina non si ferma, viene comunque fatto tutto lo spostamento pari a StepX, 'quindi il valore da mettere non deve essere maggiore della corsa massima dello stilo lungo l'asse X




' 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


Rem TASTATURA 3D
Speak ("PRIMA DI INIZIARE IMPOSTARE VALORI") 'Avviso Vocale
Speak ("confermare TASTATURA 3D") 'Avviso Vocale
Message "************  INIZIO TASTATURA 3D ************"
Sleep (1000) ' pausa di 1 secondi
response = MsgBox ("CONFERMARE TASTATURA 3D")



Zmin=-20 'valore minimo a cui scende la sonda, dipende dal pezzo da tastare e dalla lunghezza dello stilo
Zmax=20 'quota Z per lo spostamento in rapido dell'asse X quando la scansione arriva in fondo a Xmax e torna a Xiniz
Xmax=5 'angolo superiore destro fine scansione
Ymax=5 'angolo superiore destro fine scansione
StepZsu=5 'step spostamento in Z+ quando la sonda tocca
StepX=1 'risoluzione della scnsione, per Y può essere messo qualunque valore, per X non bisogna superare la corsa massimo dello stilo
StepY=1 'risoluzione della scnsione, per Y può essere messo qualunque valore, per X non bisogna superare la corsa massimo dello stilo
AvanzZgiu=200 'velocità per i relativi assi
AvanzZsu=1000 'velocità per i relativi assi
AvanzX=1000 'velocità per i relativi assi
AvanzY=1000 'velocità per i relativi assi
Xiniz=0 'angolo inferiore sinistro inizio scansione
Yiniz=0 'angolo inferiore sinistro inizio scansione

Code "G17 G21 G90"
Code "G1 Z" & Zmax & "F" & AvanzZsu
Code "G1 X" & Xiniz & "Y" & Yiniz & "F" & AvanzY
Code "G1 Z0 F" & AvanzZgiu
OpenDigFile()

Label0:
   Code "G31 Z" & Zmin & "F" & AvanzZgiu   ' Avvia scansione fino a Zmin
   While IsMoving()            ' Aspetto mentre si muove
   Wend

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 X" & Xiniz
      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
         End
      Else
         GoTo Label0
      End If
   End If

Offline TPS

*
  •  2,097 2,097
    • View Profile
Re: edit script
« Reply #1 on: May 16, 2019, 02:21:03 AM »
a quick and easy Version is for example

Zmin=Question ("Enter value for Zmin:")


an other Version would be to put Label's(for the description) and OEMDro's (for the values) to
your Screen and get the values via:

Zmin=GetOEMDro(1300) where 1300 is the dro number witch is used in Screen.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: edit script
« Reply #2 on: May 16, 2019, 03:03:28 AM »
bungiorno
thanks TPS for the help, I added the suggested changes:

Zmin = Question ("minimum value at which the probe drops:") the minimum value at which the probe drops, depends on the part to be probed and the length of the stylus
Zmax = Question ("altitude Z for the rapid movement of the X axis:") 'altitude Z for the rapid movement of the X axis when the scan reaches the bottom of Xmax and returns to Xiniz
Xmax = Question ("upper right corner end scan x max:") 'upper right corner end scan
Ymax = Question ("upper right corner end scan Ymax:") 'upper right corner end scan
StepZsu = Question ("movement in Z + when the probe touches Z high:") 'step shift in Z + when the probe touches
StepX = Question ("resolution of the scnsione X:") resolution of the scansione, for Y any value can be put, for X the maximum stroke of the stylus must not be exceeded
StepY = Question ("resolution of the Y scnsione:") resolution of the scnsione, for Y any value can be put, for X the maximum stroke of the stylus must not be exceeded
AvanzZgiu = Question ("Z 'axis descent speed-:")' speed for the relative axes
Advance Zsu = Question ("Z + axis climb speed:") 'speed for the relative axes
AvanzX = Question ("X-axis speed:") 'speed for the relative axes
AvanzY = Question ("velocity Y axis:") velocity for the relative axes
Xiniz = Question ("bottom corner X:") 'bottom left corner start of scan
Yiniz = Question ("bottom angle Y:") 'bottom left corner start of scan


seems to work well, as I repeat programming I understand little, I ask you how I did okay?
I thank you for the help given
regards

Offline TPS

*
  •  2,097 2,097
    • View Profile
Re: edit script
« Reply #3 on: May 16, 2019, 03:12:12 AM »
some Syntax Errors corrected:

Code: [Select]
Zmin     = Question ("minimum value at which the probe drops:")          'the minimum value at which the probe drops, depends On the part To be probed And the length of the stylus
Zmax     = Question ("altitude Z for the rapid movement of the X axis:") 'altitude Z for the rapid movement of the X axis when the scan reaches the bottom of Xmax and returns to Xiniz
Xmax     = Question ("upper right corner end scan x max:")               'upper right corner end scan
Ymax     = Question ("upper right corner end scan Ymax:")                'upper right corner end scan
StepZsu     = Question ("movement in Z + when the probe touches Z high:")   'step shift in Z + when the probe touches
StepX     = Question ("resolution of the scnsione X:")                    'resolution of the scansione, For Y Any value can be Put, For X the maximum stroke of the stylus must Not be exceeded
StepY     = Question ("resolution of the Y scnsione:")                    'resolution of the scnsione, For Y Any value can be Put, For X the maximum stroke of the stylus must Not be exceeded
AvanzZgiu   = Question ("Z 'axis descent speed-:")                          'speed for the relative axes
AvanzZsu    = Question ("Z + axis climb speed:")                            'speed for the relative axes
AvanzX     = Question ("X-axis speed:")                                    'speed for the relative axes
AvanzY     = Question ("velocity Y axis:")                                 'velocity For the relative axes
Xiniz     = Question ("bottom corner X:")                                 'bottom left corner start of scan
Yiniz     = Question ("bottom angle Y:")                                  'bottom left corner start of scan


anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: edit script
« Reply #4 on: May 16, 2019, 04:19:48 AM »
ok TPS
  I tried the change, it works fine
after choosing the values it asks me where to save triplet file
save and immediately part of the scan, for security you could put a confirmation start scan?

Offline TPS

*
  •  2,097 2,097
    • View Profile
Re: edit script
« Reply #5 on: May 16, 2019, 04:32:59 AM »
put this code:
Code: [Select]
Begin Dialog ButtonSample 16,32,100,30,"Start Scan?"
OKButton 10,8,40,14
CancelButton 50,8,40,14
End Dialog

Dim Dlg1 As ButtonSample
Button = Dialog (Dlg1)
If Button = 0 Then
MsgBox "Scan Canceled!"
Exit Sub
End If

behind the OpenDigfile()
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: edit script
« Reply #6 on: May 16, 2019, 04:49:11 AM »
I made the recommended changes everything works great !!!!!!!
sincere thanks to TPS for your availability for the help given and for the problems solved
regards