1751
General Mach Discussion / Re: Need Stop before running script
« on: April 18, 2018, 11:35:21 AM »
made some changes to your code, pls test
Code: [Select]
'Check oemdro# And oemled#
'Code"1003"
SetOEMDRO(800,0.5)
SetOEMDRO(801,0.5)
SetOEMDRO(802,2.0)
Sleep(100)
CurrentFeed = GetOemDRO(818) 'Get the current feedrate.
PlateThickness =1.250 'Set gauge thickness
ProbeFeed = 20 'Set feedrate during probing
Code "G90 F" &ProbeFeed 'Set to Absolute Distance mode
'X Axis Home
If GetOemLed (825)=0 Then 'Check LED to see probe is ready
Code "G4 P1" 'Time to get to the X-plate
Code "G31X4 F" &ProbeFeed 'Start X probe routine
While IsMoving() 'Probe moving X axis
Sleep(50)
Wend 'End of move
Code "G4 P0.25" 'Pause
XProbePos = GetVar(2000) 'Get position of probe
Code "G0 X" &XProbePos
While IsMoving () 'Axis moving
Sleep(50)
Wend 'End of move
SetOEMDRO(800,0) 'Set X DRO for correct direction
Sleep(100) 'Pause for Dro to update.
Code "G0 X-1.065" 'Change the X retract distance here
While IsMoving () 'Axis moving
Sleep(50)
Wend 'End of move
Code "(X axis is now homed)"
'Code "F" &CurrentFeed 'Store current feedrate to F
Else
Code "(Plate is grounded, check connection and try again)"
End If
'Y Axis Home
Code "G90 F" &ProbeFeed 'Set to Absolute Distance mode
If GetOemLed (825)=0 Then 'Check LED to see probe is ready
'Code "G4 P1" 'Time to get to the Y-plate
Code "G31Y4 F" &ProbeFeed 'Start Y probe routine
While IsMoving() 'Probe moving Y axis
Sleep(50)
Wend 'End of move
Code "G4 P0.25" 'Pause
YProbePos = GetVar(2001) 'Get position of probe
Code "G0 Y" &YProbePos
While IsMoving ()
Sleep(50)
Wend
SetOEMDRO(801,0)
Sleep(100) 'Pause for Dro to update.
Code "G0 Y-6.820 F20" 'Change the Y retract distance here
While IsMoving () 'Axis moving
Sleep(50)
Wend 'End of move
Code "(Y axis is now homed)"
'Code "F" &CurrentFeed 'Store current feedrate to F
SetOEMDRO(800,8.8641) 'Set X work offset for Spoons
SetOEMDRO(802,2) 'Set Z work offset for All
SetOEMDRO(801,0.0000) 'Set Y work offset for Spoons
Else
Code "(Plate is grounded, check connection and try again)"
Exit Sub
End If
Code "X0 Y0" 'Ready to make spoons
While IsMoving () 'Axis moving
Sleep(50)
Wend 'End of move