Hello Guest it is May 05, 2024, 08:51:56 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.


Topics - birillo1959

Pages: « 1 2 3 4 5 »
21
VB and the development of wizards / multiple passed macros
« on: January 06, 2022, 03:23:45 AM »

Good morning
I modified the macro for multiple passes
I understand very little of VB I would like to know if it can work
Is there anyone who can help me control her?
can it work?
I thank those who can help me

original macro

REM Context 10002
repeats = Question ("Quante ripetizioni?")
depth    = Question ("Profondità massima della prima passata?")
perpass = Question ("Abbassamento asse Z per ogni passata?")

SetOEMDro  80, depth
SetOEMDro  78, repeats
SetOEMDro  79, perpass
DoOEMButton 218
Message "Premere Esegui lavorazione / Alt+R per iniziare" 


modified macro


REM Context 10002
Speak (" passate   multiple") 'Avviso Vocale
REM Context 10002

   Begin Dialog TextBoxSample 300,200,155,120," PASSATE MULTIPLE"
      OKButton 25,88,40,14
      CancelButton 80,88,40,14
        GroupBox 8,5,140,110,"PASSATE   MULTIPLE   IMPOSTAZIONI",.GroupBox1
      TextBox 15,22,40,12,.TextBox1
      Text 60,24,80,8,"NUMERO PASSATE"
      TextBox 15,42,40,12,.TextBox2
      Text 60,44,80,8,"DISCESA 1 PASSATA"
      TextBox 15,62,40,12,.TextBox3
      Text 60,64,80,8,"DISCESA PER PASSATA"
   End Dialog
   Dim Dlg1 As TextBoxSample
   
   Dialog Dlg1
   repeats = CDbl(Dlg1.TextBox1)
   depth = CDbl(Dlg1.TextBox2)
   perpass = CDbl(Dlg1.TextBox3)

   SetOEMDro  80, depth
   SetOEMDro  78, repeats
   SetOEMDro  79, perpass
   DoOEMButton 218
   Message "Premere il pulsante Lavorazione (Alt+R) per iniziare" 

22
VB and the development of wizards / error G31 Probing Arrays
« on: October 18, 2021, 06:17:10 AM »
GOOD MORNING
I downloaded the G31 Probing Arrays macro from the MACH TOOL BOX section
I installed "M1299.m1s" then I launched "G31ExtPolArrayV2.01.txt" and it gives me an error
I corrected the first line M1289 with M1299
Gcode starts but when the "G1Z3110" line is reached the Z axis goes to the end of its stroke.

  (G31 External Polar Array V2.01)
   M1289
   M40
%
G90
  G0 Z # 110
  # 106 = [# 100 + # 102 * COS [# 103]]
  # 107 = [# 101 + # 102 * SIN [# 103]]
  G0 X # 106 Y # 107
  G1 Z # 123
  122 = Fix [# 122] <-------------- maybe it should be # 122 = Fix [# 122]

%

M98 P1 L # 122
G1Z3110 <-------- --------------------------------
M41
M30
%

o1 (sub1)
# 123 = [# 123 + # 121]
G1 Z # 123
  M98 P2 L # 108
  M99
 
%

o2 (sub)
  # 105 = [# 103 + # 104]
  # 106 = [# 100 + # 102 * COS [# 105]]
  # 107 = [# 101 + # 102 * SIN [# 105]]
  G90
  G0 X # 106 Y # 107
  G31 X # 100 Y # 101
  # 103 = # 105
  m99

given its usefulness it would be possible to correct it
I use version 3.043.062
I thank those who can help me

23
VB and the development of wizards / macro correction help
« on: March 23, 2021, 04:06:00 PM »
good evening
I have this macro for zero tool / tool change positioned in a button, gives me an error, is there anyone who could correct it for me?
since it is not in my capacity, I thank anyone who could help me

Sub Main
   Speak ("selezionare zero     o     cambio UTENSILE") 'Avviso Vocale
 Begin Dialog SelectCentering 420,120,160,96,"MACRO UTENSILE"
   OKButton 30,68,40,14
   CancelButton 90,68,40,14
   GroupBox 30,5,100,52,"ZERO / CAMBIO UTENSILE",.GroupBox1
   OptionGroup .OptionGroup1
   OptionButton 46,24,80,8," ZERO UTENSILE",.OptionButton1
   OptionButton 46,40,80,8," CAMBIO UTENSILE"  ,.OptionButton2
  End Dialog
  Dim Dlg1 As SelectCentering
  Button = Dialog (Dlg1)
  If Button = 0 Then Exit Sub
  Selected  = Dlg1.OptionGroup1
  'laser is selected@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  If Selected = 0 Then
     'Tool Height Setting Macro - JLH v1.1 - 4 March 2013
   'Questa versione ha un approccio a 2 fasi, veloce per la velocita e lenta per la precisione.
   
   Speak ("confermare ZERO UTENSILE") 'Avviso Vocal
        Sleep (1000)
        Begin Dialog ButtonSample 250,200,120,60," "
   OKButton 12,20,40,14
   CancelButton 68,20,40,14
End Dialog

   Dim Dlg2 As ButtonSample
   Button = Dialog (Dlg2)
   If Button = 0 Then
   MsgBox "ZERO UTENSILE CANCELLATO"
    Speak (" ZERO   UTENSILE     CANCELLATO") 'Avviso Vocale
   Exit Sub
End If
   Message "************  INIZIO ZERO UTENSILE ************"


'----- USER VARIABLES FOR DISTANCES, FEED RATES, TOUCH PLATES, OPTIONS ---------------------------------------
If GetParam("Units") = 0 Then
 '* METRIC VALUES *
 VarUnits = "  MM"
 VarMaxDistance = -25.4      'MAX Z TRAVEL * ALWAYS MAKE NEGATIVE
 VarFeedRate = 127      'MM/MIN DOWN FEEDRATE
 VarStandOff = 1.27      'STANDOFF DISTANCE ABOVE PROBE CONTACT
 VarTouchPlate = 20.066      'PRIMARY/DEFAULT TOUCH PLATE THICKNESS
 VarSecondPlate = 0.038      'SECONDARY TOUCH PLATE THICKNESS * OPTION FOR CHOICE DIALOG
 VarThirdPlate = 0.012      'TERTIARY TOUCH PLATE THICKNESS * OPTION FOR CHOICE DIALOG
Else
 '* SAE VALUES *
 VarUnits = " INCH"
 VarMaxDistance = -1.0      'MAX Z TRAVEL * ALWAYS MAKE NEGATIVE
 VarFeedRate = 5      'INCH/MIN DOWN FEEDRATE
 VarStandOff = 0.05      'STANDOFF DISTANCE ABOVE PROBE CONTACT
 VarTouchPlate = 0.79      'PRIMARY/DEFAULT TOUCH PLATE THICKNESS
 VarSecondPlate = 0.0015   'SECONDARY TOUCH PLATE THICKNESS * OPTION FOR CHOICE DIALOG 
 VarThirdPlate = 0.0005      'TERTIARY TOUCH PLATE THICKNESS * OPTION FOR CHOICE DIALOG
End If

VarRunTheChoice = 1      'RUN PLATE CHOICE DIALOG?  0=NO  1=YES

VarDelayInSec = 0      'DEFAULT SECONDS TO DELAY MOTION
VarBeepOrSpeak = 2      'COUNTDOWN AUDIO: 0=NONE 1=BEEP 2=SPEAK
VarSecOfAudio = 5      'COUNTDOWN SECOND AT WHICH AUDIO BEGINS

VarCompleteAudio = 3      'END SIGNAL: 0=NONE 1=BEEP 2=SPEAK 3=WAV_AUDIO_FILE
VarWavAudioFile = "C:\MACH3\ToolCompleteSND1.wav" 'WAV_AUDIO_FILE LOCATION

'*************************************************************************************************************
'*************************************************************************************************************

'----- GET INITIAL ENVIRONMENT SETTINGS FOR LATER REINSTATEMENT ----------------------------------------------
VarInitialLinearMode = GetOemDRO(819)        'LINEAR MODE  G00/G01
VarInitialDistMode = GetOemLED(48)           'DISTANCE MODE G90/G91   
VarInitialFeedRate = GetOemDRO(818)          'FEEDRATE
VarInitialInhibit = GetParam("ZInhibitOn")   'Z INHIBIT STATUS  OFF/ON
VarInitialZScale = GetParam("ZScale")        'Z SCALE VALUE
VarInitialFRO = GetOemDRO(821)           'FEEDRATE OVERRIDE PERCENTAGE
Message ""                      'CLEAR STATUS LINE TEXT


'----- CHECK DIGITIZE STATE; 0=CLEAR 1=ACTIVE ----------------------------------------------------------------
If GetOemLED (825) <> 0 Then
 RET = MachMsg("Digitize Status Not Clear. Check Probe/Connections And Try Again!","*** ERROR! ***",0)
 End      'END SCRIPT
End If


'----- CHECK IF USER WANTS TO RUN PLATE CHOICE DIALOG --------------------------------------------------------
If VarRunTheChoice = 1 Then RunTheThing 'RUN SUBROUTINE 


'----- ACTIVATE TIME DELAY IF USED ---------------------------------------------------------------------------
If VarDelayInSec <> 0 Then
 Do Until VarDelayInSec = 0      'LOOP UNTIL SECONDS = ZERO
  Message VarDelayInSec         'DISPLAY SECONDS VALUE IN STATUS LINE
   If VarDelayInSec < VarSecOfAudio + 1 Then
   Select Case VarBeepOrSpeak   
         Case 1 'OPTION BEEP
          Beep
         Case 2 'OPTION SPEAK
            Speak(VarDelayInSec)   
        End Select
   End If   
  Sleep 1000      'PAUSE 1 SEC.
  VarDelayInSec = VarDelayInSec - 1   'REDUCE SECONDS BY 1 AFTER EACH LOOP
 Loop
End If


'----- PREPARE FOR MOVE ----- MOVE PROBE DOWN TOWARD CONTACT -------------------------------------------------
SetParam("ZInhibitOn",0)   'TURN Z INHIBIT OFF
SetParam("ZScale",1.0)      'SET Z SCALE TO 1.0
DoOemButton(1014)      'CANCEL FEED OVERRIDE
SetOemDRO(802,0)        'ZERO Z AXIS DRO
Sleep 200         'DELAY TO ALLOW DRO TO CHANGE
Message "Auto Tool Zero Running..."
Code "G90 G31 Z" &VarMaxDistance &"F" &VarFeedRate   'MOVE DOWN @ FEEDRATE
 While IsMoving()      'WAIT UNTIL MOVE IS COMPLETE BEFORE PROCEEDING
 Wend


'----- GET Z CONTACT POSITION AND TEST FOR MAX TRAVEL ------ MOVE TO STANDOFF ------ UPDATE Z AXIS DRO -------
If GetVar(2002) <= VarMaxDistance + .001 Then   
 RET = MachMsg("Maximum Travel Reached. Reposition Z Axis Closer To Touch Plate And Try Again!","*** OOPS! ***",0)
 Message ""
 RETURNSTATE    'CALL REINSTATE SUBROUTINE
 End      'END SCRIPT
Else
 Beep
 Code "G90 G0 Z" &GetVar(2002)   'MOVE TO CONTACT POINT DUE TO OVERRUN
  While IsMoving()
  Wend
 SetOemDRO(802,0)      'ZERO Z AXIS DRO
 Sleep 200
 Code "G90 G0 Z" &VarStandOff   'MOVE TO STANDOFF DISTANCE
  While IsMoving ()
  Wend
 SetOemDRO(802, VarStandOff + VarTouchPlate)     'SET Z DRO (STANDOFF + PLATE THICKNESS)
 Sleep 200
  Select Case VarCompleteAudio
    Case 1 'OPTION BEEP
      Beep
    Case 2 'OPTION SPEAK
      Speak("Tool Zero Complete.")
    Case 3 'OPTION WAV_AUDIO_FILE
      PlayWave(VarWavAudioFile)
  End Select
 Message "Auto Tool Zero Complete! ***Remove Touch Plate***"
End If
RETURNSTATE     'CALL REINSTATE SUBROUTINE
End      'END SCRIPT

'******************************************* SUBROUTINES BELOW ***********************************************

'----- SUBROUTINE TO RETURN INITIAL SETTINGS -----------------------------------------------------------------
Sub RETURNSTATE
 'REINSTATE INITIAL FEEDRATE
 Code "F" &VarInitialFeedRate
 
 'REINSTATE DISTANCE MODE  0=G91  -1=G90
 If VarInitialDistMode = 0 Then Code "G91" Else Code "G90"

 'REINSTATE LINEAR MODE  0=G00  1=G01
 If VarInitialLinearMode = 0 Then Code "G00" Else Code "G01"

 'REINSTATE Z INHIBIT STATUS 0=OFF 1=ON
 If VarInitialInhibit = 1 Then SetParam("ZInhibitOn",1)
 
 'SET Z SCALE TO INITIAL VALUE
 If VarInitialZScale <> 1.0 Then SetParam("ZScale",VarInitialZScale)

 'SET FEEDRATE OVERRIDE TO INITIAL VALUE
 If VarInitialFRO <> 100 Then SetOemDRO(821,VarInitialFRO)
End Sub


'----- DIALOG SUBROUTINE FOR TOUCH PLATE CHOICE AND TIME DELAY -----------------------------------------------
Sub RunTheThing      
  Dim PlateList$ (2)   'DECLARE 3 ITEM ARRAY FOR PLATE SIZE LIST
  If GetParam("Units") = 0 Then
    'MM FORMATTING FOR LISTBOX
   PlateList (0) = Format(VarTouchPlate,"00.000")     'FILL ARRAY 1
   PlateList (1) = Format(VarSecondPlate,"00.000")   'FILL ARRAY 2
   PlateList (2) = Format(VarThirdPlate,"00.000")     'FILL ARRAY 3
  Else
    'INCH FORMATTING FOR LISTBOX
   PlateList (0) = Format(VarTouchPlate,"0.0000")     'FILL ARRAY 1
   PlateList (1) = Format(VarSecondPlate,"0.0000")     'FILL ARRAY 2
   PlateList (2) = Format(VarThirdPlate,"0.0000")     'FILL ARRAY 3
  End If

 Dim UnitList$ (0)   'DECLARE 1 ITEM ARRAY FOR UNIT LISTBOX
   UnitList (0) = VarUnits     'FILL ARRAY 1

 'SETUP DIALOG CONTROLS   
 Begin Dialog PlateChoice 110,68,"Touch Plate"
    ListBox 15,20,35,30, PlateList$(),.Lstbox2
   ListBox 64,20,25,10, UnitList$(),.Listbox1
    GroupBox 8,8,95,45,"Choose Plate Thickness",.GroupBox1
   OKButton 57,34,37,12
   Text 13,55,100,15, "Delay"
   TextBox 37,55,30,10, .SecText
        Text 70,55,30,15, "Seconds"         
 End Dialog

 Dim Dlg1 As PlateChoice
 Dlg1.SecText = VarDelayInSec   'FILL SECONDS TEXTBOX WITH DEFAULT VALUE

  Button = Dialog (Dlg1)   'SHOW DIALOG AND WAIT FOR BUTTON REPLY

  If Button = 0 Then   'IF CLOSE BUTTON
   Message "Auto Tool Zero CANCELED"
   End      'END SCRIPT
  End If   

  'CHECK THAT SECONDS WAS ENTERED NUMERIC
  If IsNumeric(Dlg1.SecText) = True Then
        VarDelayInSec = Int(Dlg1.SecText)
  Else
   RET = MachMsg("*****  SECONDS MUST BE ENTERED IN NUMERIC FORMAT! *****", _
   "  Substance Abuse Is Not Recommended  ",0)
   RunTheThing   'RESTART SUB
  End If
 
 'SET PLATE VARIABLE BASED ON PLATE CHOICE
 PlateNum = Dlg1.Lstbox2
 Select Case PlateNum
      Case 0 'PRIMARY PLATE
        'WILL USE PRIMARY/DEFAULT THICKNESS
      Case 1 'SECONDARY PLATE
         VarTouchPlate = VarSecondPlate
      Case 2 'TERTIARY PLATE
        VarTouchPlate = VarThirdPlate
 End Select
End Sub

  End If
 
  'web is selected@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  If Selected = 1 Then
       Rem CAMBIO UTENSILE AUTOMATICO
   Speak ("confermare cambio utensile automatico") 'Avviso Vocale
   Sleep (1000) ' pausa di 1 secondi
   Dim Dlg3 As ButtonSample
   Button = Dialog (Dlg3)
   If Button = 0 Then
   MsgBox "CAMBIO UTENSILE AUTOMATICO  CANCELLATO"
    Speak (" CAMBIO UTENSILE   AUTOMATICO      CANCELLATO") 'Avviso Vocale
   Exit Sub
End If
   If Not GetLed (7) Then         ' è referenziato X
   vxled = 1
   End If
   
   If Not GetLed (8) Then         ' è referenziato Y
   vyled = 1
   End If
   If Not GetLed (9) Then         ' è referenziato Z
   vzled = 1
   End If
   Tled = vxled + vyled + vzled
   If Tled = 3 Then         ' se non sono referenziati X, Y e Z esco
   ' parametri lavorazione
   ToolPathOnOff = 132         ' mi carico la definizione del tasto tool path
   xzero = GetDRO (30)         ' memorizzo la posizione iniziale ASSOLUTA di cambio utensile
   yzero = GetDRO (31)
   zzero = GetDRO (32)
   xpos = GetDRO (0)         ' memorizzo la posizione iniziale RELATIVA di cambio utensile
   ypos = GetDRO (1)
   zpos = GetDRO (2)
   fpos = GetDRO (18)         ' memorizzo il feedrate iniziale
   ' variabili del programma
   fmax = 500            ' imposto il feedrate massimo
   fmin = 50            ' imposto il feedrate per la palpata
   zavv = -40            ' distanza rapida di avvicinamento al palpatore
   zmin = -150            ' profondità oltre il palpatore
   xcut = 0            ' posizione X per cambio utensile
   ycut = 0            ' posizione Y per cambio utensile
   xtool = GetUserDRO (1200)      ' posizione X del palpatore (Settings -> Tool Change Location)
   ytool = GetUserDRO (1201)      ' posizione Y del palpatore
   ztool = GetUserDRO (1202)      ' posizione Z del palpatore
   ' inizio programma
   Call DoOEMButton (ToolPathOnOff)   ' disabilito il tool path
   code "G0 F" & fmax         ' porto il feedrate al valore massimo
   Code "G1 G53 Z0"         ' porto Z a ZERO macchina
   While IsMoving()
   Wend
   Call SetDro (2,0)         ' porto il contatore Z a zero
   code "G1 G53 X" & xtool & "Y" & ytool    ' mi allineo sul palpatore
   While IsMoving()
   Wend
   code "G1 Z" & zavv         ' scendo in avvicinamento (fino a zavv)
   While IsMoving()
   Wend
   code "G0 F" & fmin         ' porto il feedrate al minimo
   If IsSuchSignal (22) Then      ' scendo sul palpatore per vedere la misura della punta attuale
      code "G31 Z" & zmin
      While IsMoving()
      Wend
   End If
   
   zuno = GetVar (2002)         ' memorizzo il valore di Z della punta attuale
   zsu = zuno + 2
   code "G0 Z" & zsu         ' salgo per la seconda misura
   While IsMoving()
   Wend
   If IsSuchSignal (22) Then      ' scendo per la seconda volta per vedere la misura della punta attuale
      code "G31 Z" & zmin
      While IsMoving()
      Wend
   End If
   zdue = GetVar (2002)         ' memorizzo il valore di Z della punta attuale
   zorig = (zuno + (zdue)) / 2
   code "G0 F" & fmax         ' riporto il feedrate al massimo
   code "G1 G53 Z0"         ' porto Z a ZERO macchina
   While IsMoving()
   Wend
   code "G1 G53 X" & xcut & "Y" & ycut   ' vado in una posizione comoda per il cambio utensile
   While IsMoving()
   Wend
Speak ("ora si puo' cambiare la punta") 'Avviso Vocale
MsgBox ("ORA SI PUO' SOSTITUIRE LA PUNTA")

Speak ("attenzione      e' stata sostituita la punta") 'Avviso Vocale
Response = MsgBox ("E' STATA SOSTITUITA LA PUNTA?", 4 , "ATTENZIONE")
   If (Response = 6) Then
   i = 99
   Else
   Speak ("ATTENZIONE , LA PUNTA NON E' STATA SOSTITUITA, RIPRENDO IL LAVORO CON LA PUNTA INIZIALE") 'Avviso Vocale
   MsgBox ("LA PUNTA NON E' STATA SOSTITUITA RIPRENDO IL LAVORO CON LA PUNTA INIZIALE")
End If

If i <> 99 Then               ' non faccio nulla
   code "G1 G53 X" & xzero & "Y" & yzero   ' torno alla posizione X Y zero pezzo
   While IsMoving()
   Wend
   code "G1 X" & xpos & "Y" & ypos      ' torno alla posizione X Y da dove ero partito
   While IsMoving()
   Wend
   code "G1 G53 Z" & zzero         ' riporto Z al valore zero pezzo
   While IsMoving()
   Wend
   Call SetDro (2,0)         ' porto il contatore Z a zero
   code "G1 Z" & zpos         ' riporto Z al valore di partenza
   While IsMoving()
   Wend
   code "G0 F" & fpos         ' riporto il feedrate al valore di partenza
   Speak ("ATTENZIONE , CAMBIO UTENSILE NON EFFETTUATO , SI PUO' RIPRENDERE LA LAVORAZIONE") 'Avviso Vocale
   MsgBox ("LA PUNTA NON E' STATA SOSTITUITA")
   'DoSpinCW()            ' riaccendo il motore M3 e riprendo il lavoro da dove l'avevo lasciato
Else

   code "G1 G53 X" & xtool & "Y" & ytool    ' mi allineo sul palpatore
   While IsMoving()
   Wend
   code "G1 Z" & zavv         ' scendo in avvicinamento
   While IsMoving()
   Wend
   code "G0 F" & fmin         ' porto il feedrate al minimo
   If IsSuchSignal (22) Then      ' scendo sul palpatore
      code "G31 Z" & zmin
      While IsMoving()
      Wend
   End If

   zuno = GetVar (2002)         ' memorizzo il valore di Z della nuova punta
   zsu = zuno +4
   code "G0 Z" & zsu         ' salgo per la seconda misura
   While IsMoving()
   Wend

   If IsSuchSignal (22) Then      ' scendo per la seconda volta per vedere la misura della nuova punta
      code "G31 Z" & zmin
      While IsMoving()
      Wend
   End If

   zdue = GetVar (2002)         ' memorizzo il valore di Z della nuova punta

   znew = (zuno + (zdue)) / 2
   
      code "G0 F" & fmax      ' riporto il feedrate al massimo

      code "G1 G53 Z0"      ' ritorno Z ZERO macchina
      While IsMoving()
      Wend

   code "G0 G53 X " & xzero & "Y" & yzero   ' torno alla posizione X Y zero pezzo
   While IsMoving()
   Wend
   code "G0 X " & xpos & "Y" & ypos      ' torno alla posizione X Y da dove ero partito
   While IsMoving()
   Wend
   zdif = zorig - (znew)         ' controllo se l'utensile è più corto o piu lungo
   code "G1 G53 Z" & zzero-(zdif)      ' riporto Z al valore zero pezzo con la differenza utensile
   While IsMoving()
   Wend
   Call SetDro (2,0)         ' porto contatore Z a zero
   code "G1 Z" & zpos         ' riporto Z al valore di partenza (inizio programma)
   While IsMoving()
   Wend
   code "G0 F" & fpos         ' riporto il feedrate al valore di partenza
   
      Speak ("CAMBIO UTENSILE EFFETTUATO ,   SI PUO' RIPRENDERE LA LAVORAZIONE ,      RIMUOVERE PIASTRA") 'Avviso Vocale
   
   MsgBox ("RIMUOVERE PIASTRA E PREMERE IL TASTO LAVORAZIONE")
   Message "************ CAMBIO UTENSILE EFFETTUATO ************"
End If

Else
   speak ("Per poter cambiare l'utensile bisognava prima aver referenziato la macchina" )
   MsgBox ("PER CAMBIARE LA PUNTA BISOGNAVA REFERENZIARE LA MACCHINA")
End If
Call DoOEMButton (ToolPathOnOff)   ' abilito il tool path

   End If
   Exit Sub

End Sub                   

24
VB and the development of wizards / save configuration
« on: March 14, 2021, 04:10:20 AM »
good morning
I created a file.bat with inside:
copy c: \ mach3 \ larossa.SET D: \ BACKUP \ INUSE \
copy c: \ mach3 \ mach3mill.XML D: \ BACKUP \ INUSE \
so that every time I change the screen I save it and it works, what I would like to do (since I am not capable of it) is to save it to me in sequence like "larossa.set.001 larossa.set.002 larossa.set. 003 etc etc "I don't know if it's achievable.
I thank those who can help me

25
VB and the development of wizards / macro external center piece
« on: December 20, 2020, 04:53:27 AM »
Buongirno
I use this macro for full center piece (modified to my needs by TPS) I would like to make some changes:
add double tap as it is not in my capacity.
I thank those who can help me.

  Rem VBScript To center probe outside diameter Metric Version
 
 
 
 
Speak (" psizionarsi CINQUE millimetri sopra il pezzo") 'Avviso Vocale
response = MsgBox ("   5 mm    SOPRA IL PEZZO")


  Begin Dialog ButtonSample 250,200,120,60,"   CENTRO PEZZO PIENO ? "
   OKButton 12,20,40,14
   CancelButton 68,20,40,14
End Dialog

Dim Dlg2 As ButtonSample
Button = Dialog (Dlg2)
If Button = 0 Then
   MsgBox "CENTRO PEZZO CANCELLATO !"
    Speak ("     CENTRO        PEZZO      CANCELLATO") 'Avviso Vocale
   Exit Sub
End If




Sleep (1000) ' pausa di 1 secondi
Speak (" CONFERMARE centro pezzo pieno") 'Avviso Vocale
Message "INIZIO CENTRO PEZZO PIENO"
Sleep (1000) ' pausa di 1 secondi
response = MsgBox ("CONFERMARE CENTRO PEZZO PIENO")

 Message "**** zero assi ****"
 
   DoOEMButton (1008) 'zero X
   DoOEMButton (1009) 'zero Y
   DoOEMButton (1010) 'zero Z
   Sleep (2000) ' pausa di 1 secondi   
Speak ("ZERO assi completato") 'Avviso Vocale


CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state
CurrentToolDiameter = GetOemDRO(1000) 'gets the current tool diameter

If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty

    Call ProbeGrounded()
    Exit Sub

Else

    XCurrent = GetDro(0)
    YCurrent = GetDro(1)
    OutsideDiameter = GetUserDRO(1152)

    Code "G4 P1" 'Pause 1 second to give time to position probe plate
    While IsMoving ()
    Wend
    Call SetDro (0,0.000)
    While IsMoving ()
    Wend
    Call SetDro (1,0.000)
    Code "F50" 'slow feed rate to 100mm/sec
    Code "G90 G0 X" &XNew + OutsideDiameter * .6
    Code "G91 G0 Z-10"

Rem Probe Left

    XNew = Xcurrent - 75
    Code "G31 X" &XNew
    While IsMoving() 'wait for the move to finish
    Wend
    XPos1 = GetVar(2000) 'get the probe touch location
    Code "G91 G0 X2"
    Code "G91 G0 Z10"
    Code "G90 G0 X" &XCurrent 'rapid move back to start point
    Code "G91 G0 X" &XCurrent - OutsideDiameter * .6
    Code "G91 G0 Z-10"

Rem Probe Right

    XNew = XCurrent + 75 'probe 75mm to right
    Code "G31 X" &XNew
    While IsMoving()
    Wend
    XPos2 = GetVar(2000)
    Code "G91 G0 X-2"
    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 ()
    Wend
    Call SetDro (0,0.000)
    Code "G4 P0.25"
    Code "G90 G0 Y" &YNew - OutsideDiameter * .6
    Code "G91 G0 Z-10"

Rem Probe up

    YNew = YCurrent + 75
    Code "G31 Y" &YNew
    While IsMoving()
    Wend
    YPos1 = GetVar(2001)
    Code "G91 G0 Y-2"
    Code "G91 G0 Z10"
    Code "G90 G0 Y" &YCurrent
    Code "G91 G0 Y" &YCurrent + OutsideDiameter * .6
    Code "G91 G0 Z-10"

Rem Probe down

    YNew = YCurrent - 75
    Code "G31 Y" &YNew
    While IsMoving()
    Wend
    YPos2 = GetVar(2001)
    Code "G91 G0 Y2"
    Code "G91 G0 Z10"
    YCenter = (YPos1 + YPos2) / 2

Rem move To the center

    Code "G90 G0 Y" &YCenter
    While IsMoving ()
    Wend
    Call SetDro (1,0.000)
    While IsMoving ()
    Wend
    Call SetUserDro (1152,YPos2 - YPos1 - CurrentToolDiameter)

    Code "G4 P0.25"

    Code "F" &CurrentFeed 'restore starting feed rate
   Call ReturnG90G91State()
   Exit Sub
End If

26
VB and the development of wizards / post processor modification
« on: January 13, 2020, 05:38:11 AM »
good morning
I would like to insert in the gcode (saved by artcam) the date of creation of the file, example:
(FILE = clock)
date <--------------------------------------------
(MATERIAL MEASUREMENT) (X = 310.000, Y = 380.000, Z = 10.400)
  (3,000 mm Flat tool diam.)
%
G90
G49
M3 S15000
G0 X-1.097 Y-10.347 Z3.000
G1 Z-0.936 F1140
.........
I do not know if it is feasible, I ask for help from those who know more than me
the post processor that I use is the following:

;
; Fanuc G - Code 4-Axis rotary post processor
;
; Linear Y Axis is wrapped onto A rotary axis
;
; History
;
; Who When     What
; === ======== ========================================
; TM  04/07/95 Written
; BEM 06/08/96 Modified for Rotary Axis support
; BEM 19/06/00 Fixed
; BEM 03/02/00 Added description
; JVG 27/10/03 Modified for Mach2 controller, Wolverine3 or Elite6 machines
; JVG 12/12/03 Modified for Mach2 3axis machining
; JVG Feb 23 05 Small modifications with Bill P

DESCRIPTION = "Mach2 mm(*.txt)"
;
FILE_EXTENSION = "txt"
;
UNITS = MM
;
;
; Cariage return - line feed at end of each line
;
END_OF_LINE = "[13][10]"
;
; Block numbering
;
LINE_NUM_START     = 0
LINE_NUM_INCREMENT = 1
LINE_NUM_MAXIMUM   = 999999
;
; Set up default formating for variables
;
; Line numbering
FORMAT = [N|@|N|1.0]
; Spindle Speed
FORMAT = [S|@|S|1.0]
; Feed Rate
FORMAT = [F|#|F|1.0]
; Tool moves in x,y and z
FORMAT = [X|#|X|1.3]
FORMAT = [Y|#|Y|1.3]
FORMAT = [Z|#|Z|1.3]
; Home tool positions
FORMAT = [XH|@|X|1.3]
FORMAT = [YH|@|Y|1.3]
FORMAT = [ZH|@|Z|1.3]
;
; Set up program header
;
START = "(FILE=[FILENAME])"
START = "(MISURA MATERIALE) (X=[XSIZE], Y=[YSIZE], Z=[ZMATERIAL])"
START = " ([TOOLDESC])"
START = "%"
START = "G90"
;START = "G21"
; G20 = Use MM as unit value
START = "G49"
;START = "M6 T1"
; M6T1 = tool change via macros (commented out)
START = "M3 "
;START = "M7"
; M7 = turn misting coolant on (commented out)
;
; Program moves
;
FIRST_RAPID_RATE_MOVE  = "G0 [X] [Y] [Z]"
FIRST_FEED_RATE_MOVE   = "G1 [X] [Y] [Z] [F]"
FEED_RATE_MOVE         = "[X] [Y] [Z]"
;
; End of file
;
END = "G0[ZH]"
END = "[XH][YH]"
END = "M05"
END = "M30"
END = "%"


  I sincerely thank those who can help me
regards

27
Mach Screens / change color keys
« on: August 24, 2019, 04:20:34 AM »
good morning
Is it possible to change the color of the button when it is selected?
I would like to change it from blue to red
I thank those who can help me


28
VB and the development of wizards / 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


29
VB and the development of wizards / REFF ALL HOME 2 SCRIPT
« on: December 23, 2018, 07:18:56 AM »
Good morning
I have the following script for "REFF ALL HOME" modified a window two buttons "NORMAL and FAST" (I had the TPS user had me) the normal part works fine.
what I would like to change is the fast part:
1) the "Z" rises to the origin
2) "X and Y" at the same time
I state that I have no skills with VB, I thank those who can help me
GOOD HOLIDAYS TO EVERYONE!

Sub Main
 Begin Dialog SelectCentering 350,145,125,96,"REFF ALL HOME"
   OKButton 20,68,40,14
   CancelButton 70,68,40,14
   GroupBox 30,5,72,52,"REFF ALL HOME",.GroupBox1
   OptionGroup .OptionGroup1
   OptionButton 46,24,54,8," NORMALE",.OptionButton1
   OptionButton 46,40,54,8," VELOCE"  ,.OptionButton2
  End Dialog

  Dim Dlg1 As SelectCentering
  Button = Dialog (Dlg1)
 
  If Button = 0 Then Exit Sub
  Selected  = Dlg1.OptionGroup1

  'NORMALE is selected ********************************************************************
  If Selected = 0 Then '*****************************************************************

Speak ("  zero   macchina") 'Avviso Vocale
   Message "************   ZERO MACCHINA ************"
   Sleep (1000) ' pausa di 1 secondi
   
   DoButton(24)
   RefCombination(3)
   'DoButton(23)
   'DoButton(22)
   'DoButton(25)
   While IsMoving()
   Sleep(100)
   Wend
   SetParam("XRefPer", GetParam("XRefPer")/15)
   SetParam("YRefPer", GetParam("YRefPer")/15)
   SetParam("ZRefPer", GetParam("ZRefPer")/15)
   'SetParam("ARefPer", GetParam("ARefPer")/15)
   DoButton(24)
   RefCombination(3)
   'DoButton(23)
   'DoButton(22)
   'DoButton(25)
   While IsMoving()
   Sleep(100)
   Wend
   SetParam("XRefPer", GetParam("XRefPer")*15)
   SetParam("YRefPer", GetParam("YRefPer")*15)
   SetParam("ZRefPer", GetParam("ZRefPer")*15)
   'SetParam("ARefPer", GetParam("ARefPer")*15)
   Speak ("zero macchina completato") 'Avviso Vocale


 
  End If '********************************************************************************
 
  'VELOCE is selected ***********************************************************************
  If Selected = 1 Then '******************************************************************
 
     Speak ("  zero   macchina  veloce") 'Avviso Vocale
Message "***   ZERO MACCHINA VELOCE   ***"
   Sleep (1000) ' pausa di 1 secondi
   
   RefCombination(7)
   'RefCombination(15)
   
   Sleep(300)
   'While ((GetOemLed(807) = true) Or (GetOemLed(808) = true) Or (GetOemLed(809) = true) Or (GetOemLed(810) = true))
   While ((GetOemLed(807) = true) Or (GetOemLed(808) = true) Or (GetOemLed(809) = true))
   Sleep(50)
   Wend
   
   SetParam("XRefPer", GetParam("XRefPer")/15)
   SetParam("YRefPer", GetParam("YRefPer")/15)
   SetParam("ZRefPer", GetParam("ZRefPer")/15)
   'SetParam("ARefPer", GetParam("ARefPer")/15)
   
   RefCombination(7)
   'RefCombination(15)
   
   Sleep(300)
   'While ((GetOemLed(807) = true) Or (GetOemLed(808) = true) Or (GetOemLed(809) = true) Or (GetOemLed(809) = true))
   While ((GetOemLed(807) = true) Or (GetOemLed(808) = true) Or (GetOemLed(809) = true))
   Sleep(50)
   Wend
   
   SetParam("XRefPer", GetParam("XRefPer")*15)
   SetParam("YRefPer", GetParam("YRefPer")*15)
   SetParam("ZRefPer", GetParam("ZRefPer")*15)
   'SetParam("ARefPer", GetParam("ARefPer")*15)
   
   Speak ("ZERO MACCHINA VELOCE COMPLETATO") 'Avviso Vocale

30
VB and the development of wizards / edit REF ALL HOME macro
« on: August 14, 2018, 01:28:21 PM »
Good evening
I would like some help to modify this "ref all home" macro I use:

Speak ("  zero   macchina") 'Avviso Vocale
   Message "************   ZERO MACCHINA ************"
   Sleep (1000) ' pausa di 1 secondi
   
   DoButton(24)
   DoButton(23)
   DoButton(22)
   'DoButton(25)
   While IsMoving()
   Sleep(100)
   Wend
   SetParam("XRefPer", GetParam("XRefPer")/15)
   SetParam("YRefPer", GetParam("YRefPer")/15)
   SetParam("ZRefPer", GetParam("ZRefPer")/15)
   'SetParam("ARefPer", GetParam("ARefPer")/15)
   DoButton(24)
   DoButton(23)
   DoButton(22)
   'DoButton(25)
   While IsMoving()
   Sleep(100)
   Wend
   SetParam("XRefPer", GetParam("XRefPer")*15)
   SetParam("YRefPer", GetParam("YRefPer")*15)
   SetParam("ZRefPer", GetParam("ZRefPer")*15)
   'SetParam("ARefPer", GetParam("ARefPer")*15)
   Speak ("zero macchina completato") 'Avviso Vocale

the change I would like to make is the following:
1) the "Z" rises up to the origin
2) the "X and Y" simultaneously up to the origin
I state that I do not understand VB, is it possible to modify it? Is there anyone who can help me?
thank you

Pages: « 1 2 3 4 5 »