Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: reuelt on April 25, 2019, 06:28:58 PM
-
' Faster Ref. ALL Home script by Reuel
Speak (" FASTER Referencing all home.") 'VOICE Alert
Message "************ FASTER Reference all home Started************"
Sleep (1000) ' Pause 1 second
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
DoOEMButton( 1024 ) ' Ref (home) Z Axis
While IsMoving()
Wend
DoOEMButton(135) ' Zero Z Encoder
Code "G90"
Code "G53 G0 Y25" '25 mm may be change to 1 inch
While IsMoving()
Wend
Code "G53 G0 X25" '25 mm may be change to 1 inch
While IsMoving()
Wend
Code "F1200"
DoOEMButton( 1023 ) ' Ref Y Axis
DoOEMButton( 1022 )' Ref X Axis
DoOEMButton( 1025 )' Ref A Axis
DoOEMButton(134) ' Zero Y Encoder
DoOEMButton(133) ' Zero X Encoder
DoOEMButton(136) ' Zero A Encoder
While IsMoving()
Wend
Code "G54"
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
Speak ("FASTER Reference all home Completed") 'Voice Alert
Message "************ FASTER Reference all home Completed************"
'idea is to get Z to the top slowly first (for safety) then move Y and X at G0 speed to 25mm from home switches and then move slowly towards the switch. The slow speed part is still controlled by speed % settings in config || motor home/soft limits as usual.
' Change 25 (mm) to 1 (inch) in 2 places if you use inches units.
'suggestions to improve on it welcomed
-
You can put units checking in your script ti make it universal :)
If GetOEMLED(801) Then
Code "G53 G0 Y1"
Else
Code "G53 G0 Y25"
End If
If you are giving someone a solution and you do not know the native units of that persons machine setting.
;)
-
Thanks
Do you know how make the script grab the data from the "SLOW ZONE" column of in config | motor home/soft limits?
Then it is not only units independent but also slow zone distance can be easily changed by users too.
Reuel
-
' Faster Ref. ALL Home script by Reuel updated thanks to ZASto & TPS - now works in either imperial or metric unit
Speak (" FASTER Referencing all home.") 'VOICE Alert
Message "************ FASTER Reference all home Started************"
Sleep (1000) ' Pause 1 second
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
DoOEMButton( 1024 ) ' Ref (home) Z Axis
While IsMoving()
Wend
DoOEMButton(135) ' Zero Z Encoder
Code "G90"
If GetOemLed(801) Then 'imperial units check
Code "G53 G0 Y1 X1" 'fast move to Y1 X1 in inches
Else
Code "G53 G0 Y25 X25" 'fast move to Y25 X25 in mm
End If
While IsMoving()
Wend
DoOEMButton( 1023 )' Ref Y Axis
DoOEMButton( 1022 )' Ref X Axis
DoOEMButton( 1025 )' Ref A Axis
DoOEMButton( 1026 )' Ref B Axis
DoOEMButton( 1027 )' Ref C Axis
DoOEMButton(134) ' Zero Y Encoder
DoOEMButton(133) ' Zero X Encoder
DoOEMButton(136) ' Zero A Encoder
DoOEMButton(137) ' Zero B Encoder
DoOEMButton(138) ' Zero C Encoder
While IsMoving()
Wend
Code "G54"
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
Speak ("FASTER Reference all home Completed") 'Voice Alert
Message "************ FASTER Reference all home Completed************"