Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: birillo1959 on June 20, 2025, 05:24:55 AM
-
macro help to reference machine
Good morning I have this macro generated with ChatGPT to reference the machine and it works well I ask if it could be
modified in two touches (the first fast the second slow to be precise) with AI I can't modify it, it's not in my
capacities / skills I ask if someone can help me to modify it or if there is a macro already made.
I thank those who can help me.
' === Macro Mach3 per Referenziare la Macchina CNC ===
' Esegue homing su X, Y e Z e azzera le coordinate macchina
' Homing Asse Z (di solito prima per sicurezza)
DoButton(22)
While IsMoving()
Sleep(100)
Wend
' Homing Asse Y
DoButton(23)
While IsMoving()
Sleep(100)
Wend
' Homing Asse X
DoButton(24)
While IsMoving()
Sleep(100)
Wend
' Homing Asse A
DoButton(25)
While IsMoving()
Sleep(100)
Wend
' Imposta le coordinate macchina a zero (opzionale)
'DoOEMButton(1008) ' Azzera X
'DoOEMButton(1009) ' Azzera Y
'DoOEMButton(1010) ' Azzera Z
MsgBox "Homing completato con successo!"
-
something like this, not tested just written down:
' === Macro Mach3 per Referenziare la Macchina CNC ===
' Esegue homing su X, Y e Z e azzera le coordinate macchina
' Homing Asse Z (di solito prima per sicurezza)
SetParam ("ZRefPer",40) 'set Z refspeed to 40%
Sleep 200
DoButton(24) 'Ref Z-axis fast
While IsMoving()
Sleep(100)
Wend
Code "G53 Z-2" 'move off switch 2mm
While IsMoving()
Sleep(100)
Wend
SetParam ("ZRefPer",5) 'set Z refspeed to 5%
DoButton(24) 'Ref Z-axis slow
While IsMoving()
Sleep(100)
Wend
SetParam ("ZRefPer",100)
Sleep 200
' Homing Asse Y
SetParam ("YRefPer",40) 'set Y refspeed to 40%
Sleep 200
DoButton(23) 'Ref Y-axis fast
While IsMoving()
Sleep(100)
Wend
Code "G53 Y2" 'move off switch 2mm
While IsMoving()
Sleep(100)
Wend
SetParam ("YRefPer",5) 'set Y refspeed to 5%
DoButton(23) 'Ref Y-axis slow
While IsMoving()
Sleep(100)
Wend
SetParam ("YRefPer",100)
Sleep 200
' Homing Asse X
SetParam ("XRefPer",40) 'set X refspeed to 40%
Sleep 200
DoButton(22) 'Ref X-axis fast
While IsMoving()
Sleep(100)
Wend
Code "G53 X2" 'move off switch 2mm
While IsMoving()
Sleep(100)
Wend
SetParam ("XRefPer",5) 'set X refspeed to 5%
DoButton(22) 'Ref Z-axis slow
While IsMoving()
Sleep(100)
Wend
SetParam ("XRefPer",100)
Sleep 200
' Homing Asse A
SetParam ("ARefPer",40) 'set A refspeed to 40%
Sleep 200
DoButton(25) 'Ref A-axis fast
While IsMoving()
Sleep(100)
Wend
Code "G53 A2" 'move off switch 2mm
While IsMoving()
Sleep(100)
Wend
SetParam ("ARefPer",5) 'set A refspeed to 5%
DoButton(25) 'Ref A-axis slow
While IsMoving()
Sleep(100)
Wend
SetParam ("ARefPer",100)
Sleep 200
' Imposta le coordinate macchina a zero (opzionale)
'DoOEMButton(1008) ' Azzera X
'DoOEMButton(1009) ' Azzera Y
'DoOEMButton(1010) ' Azzera Z
MsgBox "Homing completato con successo!"
-
ok TPS i tried it and it seems to work fine
i changed:
SetParam ("ZRefPer",5) 'set Z refspeed to 5%
to
SetParam ("ZRefPer",3) 'set Z refspeed to 5%
to lower the speed and it seems to work
thanks again for the help offered
regards