25
« on: July 05, 2011, 06:10:20 PM »
Been struggling all weekend trying to figure this out.
If I go to the offset menu and click the ref all home the Z,X,Y,A home with no problems.
If I click the button on my home page to run the macro below I get random behavior. Mostly the Z rapids down but once in a while the Z will rapid up and then about half the macro will run.
If I open the macro using the edit button script command and run the macro line by line it runs flawlessly.
This system has been running with no issues for a few years. It all started with a dumbass move on my part that crashed the system. The only difference is that I added the DoOEMButton command to the macro.
I also tried reinstalling Mach.
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
PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO
Code "G54"
Code "G90"
DoButton( 24 )
DoOEMButton 1010
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )
Code "G90 G0 Z-2.75"
While ismoving()
Wend
Code "G90 G31 Z-4 F4" 'probing move, can set the feed rate here as well as how far to move
While ismoving()
Wend
ZProbePos = GetVar(2002) 'get the axact point the probe was hit
While ismoving()
Sleep 100
Wend
Code "G90 G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While ismoving()
Sleep 100
Wend
Zoffset = getvar(5223)
Cline = (ZProbePos+-3.2395) '-3.2395 Distance between center line of rotary and probe
SetVar(5243,(Cline+PlateThickness))'Set G55 Z
While ismoving()
Wend
SetVar(5263,(Cline+PlateThickness))'Set G56 Z
While ismoving()
Wend
SetVar(5283,(Cline+PlateThickness))'Set G57 Z
While ismoving()
Wend
Code "G91"
Code "G0 Z 0.1" 'retract
While ismoving()
Sleep 100
Wend
Code "G55"
Code "G90"
While ismoving()
Sleep 100
Wend
Code "G0 X0 Y0" 'move to start position
While ismoving()
Sleep 100
Wend
Code "(Z axis is now zeroed for G55, G56, G57)" 'puts this message in the status bar
Exit Sub