4141
VB and the development of wizards / Re: Marco gone wild.
« on: July 05, 2011, 06:33:32 PM »
Try This:
Sub Main()
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
Sleep (250)
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 exact point the probe was hit
Sleep(150)
Code "G90 G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While ismoving()
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
SetVar(5263,(Cline+PlateThickness))'Set G56 Z
SetVar(5283,(Cline+PlateThickness))'Set G57 Z
Code "G91"
Code "G0 Z0.1" 'retract
While ismoving()
Wend
Code "G55"
Code "G90"
Code "G0 X0 Y0" 'move to start position
While ismoving()
Wend
Message "Z axis is now zeroed for G55, G56, G57" 'puts this message in the status bar
End Sub
Sub Main()
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
Sleep (250)
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 exact point the probe was hit
Sleep(150)
Code "G90 G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While ismoving()
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
SetVar(5263,(Cline+PlateThickness))'Set G56 Z
SetVar(5283,(Cline+PlateThickness))'Set G57 Z
Code "G91"
Code "G0 Z0.1" 'retract
While ismoving()
Wend
Code "G55"
Code "G90"
Code "G0 X0 Y0" 'move to start position
While ismoving()
Wend
Message "Z axis is now zeroed for G55, G56, G57" 'puts this message in the status bar
End Sub