Hello Guest it is April 18, 2024, 11:03:55 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - TPS

191
VB and the development of wizards / Re: macro correction
« on: September 15, 2022, 06:00:20 AM »
Code: [Select]
' CENTRO ASSE X INTERNO ESTERNO
Sub Main
Dim A As Double
Dim A1 As Double
Dim A2 As Double
Dim A3 As Double
Dim A4 As Double
Dim A5 As Double
Dim A6 As Double
Dim A7 As Double
Dim A9 As Double
Dim B As Double
Dim B1 As Double
Dim B2 As Double
Dim B3 As Double
Dim B4 As Double
Dim B5 As Double
Dim B6 As Double
Dim B7 As Double
Dim F As Double

Speak (" CENTRO ASSE x ") 'Avviso Vocale
Begin Dialog SelectCentering 240,80,140,225,"CENTRO ASSE X"
Picture 5, 65, 130, 130, "c:\mach3\addons\centri_scan_sondaggi\bitmaps\CENTRO ASSE X.BMP"
OKButton 15,203,50,14
CancelButton 70,203,50,14
GroupBox 5,10,130,50,"CENTRO ASSE X",.GroupBox1
OptionGroup .OptionGroup1
OptionButton 10,24,120,8,"-A-  CENTRO ASSE X INTERNO",.OptionButton1
OptionButton 10,38,120,8,"-B-  CENTRO ASSE X ESTERNO",.OptionButton2
End Dialog
Dim Dlg1 As SelectCentering
Button = Dialog (Dlg1)
 
If Button = 0 Then Exit Sub

Selected  = Dlg1.OptionGroup1

'centro asse x INTERNO @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
If Selected = 0 Then
Speak ("centro  interno ASSE x") 'Avviso Vocale

F1= GETOEMDRO(1111) ' leggi F di Spostamento
F2= GETOEMDRO(1014) ' leggi F di Avvicinamento
F3= GETOEMDRO(1003) ' leggi F di Accosto
F4= GETOEMDRO(1000) ' leggi diametro probe
   
Begin Dialog ButtonSample 280,270,100,30,"START SCANSIONE"
OKButton 10,8,40,14
CancelButton 50,8,40,14
End Dialog
Dim Dlg2 As ButtonSample
Button = Dialog (Dlg2)
   
If Button = 0 Then
MsgBox "SCANSIONE CANCELLATA!"
Speak ("scansione cancellata") 'Avviso Vocale
Exit Sub
End If

SetOEMDRO(1181,0)
Speak ("dro azzerati")
Sleep (500) ' pausa di 2 secondi
' TROVA CENTRO IN X
SETDRO(0,0) 'Azzera X
SETDRO(1,0) 'Azzera Y
code "g31x200" & "f" & F2 'muove verso x+
While isMoving()
Sleep (100)
Wend
A1= GETOEMDRO(800) ' legge il valore di X
A2= A1-2
code "g1x"& A2 & "f" & F2
code "g31x200" & "f" & F3 'muove verso x+
While isMoving()
Sleep (100)
Wend
A= GETOEMDRO(800) ' legge il valore di X
code "g1x0" & "F" & F1 'torna a X0
While isMoving()
Sleep (100)
Wend
code "g31x-200" & "f" & F2 'muove verso x+
While isMoving()
Sleep (100)
Wend
B1= GETOEMDRO(800) ' legge il valore di X
B2= B1+2
code "g1x" & B2 & "f" & F2
code "g31x-200" & "f" & F3 'muove verso x+
While isMoving()
Sleep (100)
Wend
B= GETOEMDRO(800) ' legge il valore di X
C= ((A+B)/2) ' trova la metà in X
code "g1 X" & C & "f" & F1 ' va alla metà in X
While isMoving()
Sleep (100)
Wend
Call SetUserDro (1181, A1 + A + F4)
E3= GetUserLED (1011)
If E3 = 0 Then
Speak ("centro  interno completato") 'Avviso Vocale
SETDRO(1,0) 'Azzera Y
SetDRO(0,0) 'Azzera X
Else
G= GETOEMDRO(1049) ' leggi offset X
G1= GETOEMDRO(1050) ' leggi offset Y
G2= GETOEMDRO(800) ' leggi coord X
G3= GETOEMDRO(801) ' leggi coord Y
G4= (G2)+(G) ' nuova coordonata in X
G5= (G3)+ (G1) ' nuova coordonata in Y
Code "G1 X" & G4 & "Y" & G5 & "F500"
While isMoving()
Sleep (100)
Wend
SETDRO(1,0) 'Azzera Y
SetDRO(0,0) 'Azzera X
End If
End If

   
'centro asse x ESTERNO selected @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    If Selected = 1 Then
Speak ("centro  esterno ASSE x") 'Avviso Vocale     
F1= GETOEMDRO(1111) ' leggi F di Spostamento
F2= GETOEMDRO(1014) ' leggi F di Avvicinamento
F3= GETOEMDRO(1003) ' leggi F di Accosto
F4= GETOEMDRO(1000) ' leggi DIAMETRO PROBE

Speak ("centro asse x pieno") 'Avviso Vocale
Begin Dialog ButtonSample1 280,270,100,30,"START SCANSIONE"
OKButton 10,8,40,14
CancelButton 50,8,40,14
End Dialog
Dim Dlg3 As ButtonSample1
Button = Dialog (Dlg3)
If Button = 0 Then
MsgBox "SCANSIONE CANCELLATA!"
Speak ("scansione cancellata") 'Avviso Vocale
Exit Sub
End If
Sleep (500) ' pausa di 2 secondi
SetOEMDRO(1181,0)   
Speak ("dro azzerati") 'Avviso Vocale
Sleep (500) ' pausa di 2 secondi
Speak ("inserire lunghezza asse x") 'Avviso Vocale
A=InputBox("INSERIRE LA LUNGHEZZA IN Y")
Speak ("confermare centro asse x pieno") 'Avviso Vocal
Tasto = MsgBox("CENTRO PIENO ASSE X" ,1+64, "CONFERMARE")
If Tasto <> 1 Then
Exit Sub
End If
A1=((A/2)+12)
SETDRO(0,0) ' azzera Z
code "g31z-50" & "f" & F2 'muove verso z-
While isMoving()
Sleep (100)
Wend
SETDRO(2,0) ' azzera Z
code "g1z3" & "f" & F1 'muove verso z+
While isMoving()
Sleep (100)
Wend
' TROVA CENTRO IN Y
SETDRO(0,0) 'Azzera Y
code "g1x-" & A1 & "f" & F1 'muove verso y-
While isMoving()
Sleep (100)
Wend
code "g1z-6" & "f" & F1 ' muove verso z-
While isMoving()
Sleep (100)
Wend
code "g31x200" & "F" & F2
While isMoving()
Sleep (100)
Wend
B1= GETOEMDRO(800) ' legge il valore di X
B2 = B1-2
code "g1x"& B2 & "f" & F2
While isMoving()
Sleep (100)
Wend
code "g31x200" & "f" & F3 'muove verso y+
While isMoving()
Sleep (100)
Wend
B3= GETOEMDRO(800) ' legge il valore di y
code "g1z4" & "f" & F1 ' alza in z
While isMoving()
Sleep (100)
Wend
code "g1x0" & "f" & F1 ' torna a y0
While isMoving()
Sleep (100)
Wend
code "g1x+" & A1 & "f" & F1 'muove verso y-
While isMoving()
Sleep (100)
Wend
code "g1z-6" & "f" & F1 ' muove verso z-
While isMoving()
Wend
code "g31x-200" & "F" & F2
While isMoving()
Sleep (100)
Wend
B4= GETOEMDRO(800) ' legge il valore di X
B5 = B4+2
code "g1x"& B5 & "f" & F2
While isMoving()
Sleep (100)
Wend
code "g31x-200" & "f" & F3 'muove verso y+
While isMoving()
Sleep (100)
Wend
B6= GETOEMDRO(800) ' legge il valore di y
code "g1z4" & "f" & F1 ' alza in z
B7= ((B3+B6)/2) ' trova la metà di Y
code "g1 x" & B7 & "f" & F1 ' va alla metà in x
While isMoving()
Sleep (100)
Wend
SETDRO(0,0) 'Azzera x
While isMoving()
Sleep (100)
Wend
Call SetUserDro (1181, B6+B6 -F4 )
E3= GetUserLED (1011)
If E3 = 0 Then
Speak ("centro asse x pieno completato") 'Avviso Vocale
SETDRO(1,0) 'Azzera Y
SetDRO(0,0) 'Azzera X
Else
G= GETOEMDRO(1049) ' leggi offset X
G1= GETOEMDRO(1050) ' leggi offset Y
G2= GETOEMDRO(800) ' leggi coord X
G3= GETOEMDRO(801) ' leggi coord Y
G4= (G2)+(G) ' nuova coordonata in X
G5= (G3)+ (G1) ' nuova coordonata in Y
Code "G1 x" & G5 & "F500"
While isMoving()
Sleep (100)
Wend
SETDRO(0,0) 'Azzera x
End If
End If
End Sub




192
General Mach Discussion / Re: Enable 2 pins via Mcode
« on: September 14, 2022, 07:33:16 AM »
you can only activate OutPuts one by one:

Code: [Select]
Activatesignal (Output5)
Activatesignal (Output6)

maybe your motioncontroller is able to handle it different.

193
German / Re: PWM 0-5 Volt in Mach3 umdrehen
« on: September 14, 2022, 07:29:16 AM »
Servus,

kurz und bündig gesagt: Nein.

Ich habe das bei mir mit einem Arduino Nano gelöst, da ich keinen anderen
Weg gefunden habe.

Gruß Tom

194
General Mach Discussion / Re: Help please
« on: August 23, 2022, 03:21:58 AM »
what is main menue -> help -> About Mach3 controller

showing?


195
German / Re: Mach3 nimmt G-Code nicht an
« on: August 05, 2022, 07:01:32 AM »
Servus,
ging nicht.

aus dem 'ä' habe ich dann 'ae' gemacht, schon ging es.
Du solltest grundsätzlich auf Umlaute und Sonderzeichen wie 'ß' im Dateinamen verzichten.

Gruß Tom

196
VB and the development of wizards / Re: position memorization
« on: August 05, 2022, 06:54:24 AM »
we had the same couple of day's ago:

Code: [Select]
Dim X,Y as Double
  Open "C:\Mach3\myFile.txt" For Output As #1
  X = GetDRO(0)
  Y = GetDRO(1)
  Print #1, nFmt(X,4)
  Print #1, nFmt(Y,4)
  Close #1

197
General Mach Discussion / Re: Start VB Script with button wired to input
« on: August 05, 2022, 06:16:49 AM »
the oemcode for the triggermacro is allways 301!
in my example it will allway run macro M334.M1S

within this macro you can select the oemtrigger via script:

Code: [Select]
If Oemtrigger(1) Then
     'do code for Oemtrigger1
End If

If Oemtrigger(2) Then
     'do code for Oemtrigger2
End If

'and so on

198
German / Re: Mach3 nimmt G-Code nicht an
« on: August 05, 2022, 05:05:17 AM »
Servus Manfred,
habe die beiden Dateien bei mir problemlos laden können.

Hast Du schon Mal in der Datei: C:\Mach3\lasterror.txt geschaut, ob es da Einträge gibt?

Gruß Tom

199
VB and the development of wizards / Re: position memorization
« on: August 05, 2022, 04:47:55 AM »
Code: [Select]
Dim X,Y as Double
  Open "C:\Mach3\myFile.txt" For Output As #1
  X = GetDRO(0)
  Y = GetDRO(1)
  Print #1, X
  Print #1, Y
  Close #1

Code: [Select]
Dim Answer
Dim newPosX, newPosY As Double
  Open "C:\Mach3\myFile.txt" For Input As #2              'Open the file for reading
  Line Input #2, newPosX                                                      'Read the first line of the file
  Line Input #2, newPosY                                                      'Read the second line of the file

  Answer = MsgBox ("Is it OK to move the X axis to: " & newPos & "?", 1)

  If Answer = 1 Then                                                           'You pressed OK
    Code "G0 X"& newPosX & " Y" & newPosY                                                  'Make the move
  End If

  Close #2               

NOT TESTED

200
General Mach Discussion / Re: Start VB Script with button wired to input
« on: August 05, 2022, 04:41:11 AM »
basicly OEMTriggers are used like regular input's but they Special functionalty

1st. you can assign in Config->System hotkeys oemcodes to a OEMtrigger witch will be done once if OEMTrigger comes true

2nd. you can define a triggermacro by SetTriggerMacro(number)

normaly done this way.

-add for example in Config->General Config ->Initialisation string  M333, that means every time you reset M333.M1s is called

-within M333.M1s add the VB code SetTriggerMacro(334)

-assign in Config->System hotkeys oemcodes to a OEMtrigger the code 301 witch means run triggermacro

so every time the OEMTrigger Comes True the VB Code within M334.M1S will run once.

hope i was able to explain the Basics of OEMTriggers in my bad bavarian english.