Ok, the SetDRO (0,0) command does work… almost.
Turns out I was changing the wrong script, thus my changes were not taking affect.
What happens is that I’ve included the SetDRO (0,0) command to run at the end of the script just before the command that restores the original federate. This does work but does not actually change all the DROs to zero. Thinking these problems may have been caused by the script executing the reset commands too quickly, I added a pause command (code “G04 p.5”) between them to give each time to reset before resetting the next DRO. This did not have any affect other then adding a half second between DRO changes.
Here is what happens…
The X axis DRO is changed to +0.6105
The Y axis DRO is changed to +0.0000
The Z axis DRO is changed to +0.4000
I do not know where these figures came from. I moved each axis to a different position and re-ran the script and those same numbers again appear once the SetDRO (0,0), SetDRO (1,0), and SetDRO (2,0) commands are executed in the script.
Any clue why this behavior is occurring? I’m very close to getting everything to function correctly.
Thanks for the responses thus far, they’ve been very helpful!
-Aaron
Rem VBScript To center mill On quick relase handle In preparation For slot cutting
If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty
Code "(Probe plate is grounded, check connection and try again)"
Else
FeedCurrent = GetOemDRO(818) 'Get the current settings
XCurrent = GetDro(0)
YCurrent = GetDro(1)
Code "G4 P1" 'Pause 1 second to give time to position probe plate
Code "F2" 'slow feed rate to 2 ipm
Rem Probe Down
ZNew = Zcurrent - 1 'set scan to top edge of part - up to 1 inch of travel
Code "G31 Z" &ZNew 'move down to scan for top edge
While IsMoving() 'wait for the move to finish
Wend
ZTop = GetVar(2002) 'get the probe touch location
Code "G0 Z" &ZTop + .25 'rapid move .25 inches above part surface
Code "G0 Y" &YCurrent + .75 'Move to far end of part for next scan start point
Code "G0 Z" &ZTop - .1 'Move down to .1 inches below part top edge
Rem Probe foward
Code "G31 Y" &YCurrent 'Scan back edge
While IsMoving()
Wend
YPos1 = GetVar(2001) 'Record back edge position
Code "G0 Y" &YPos1 + .25 'Move .25 inches away from last scanned edge
Code "G0 Z" &ZTop +.25 'Move up to .25 above part surface
Code "G0 Y" &YPos1 - 1.25 'Move 1.25 inches to front edge of part
Code "G0 Z" &ZTop - .1 'Move down to .1 inches below part top edge
Rem Probe backward
Code "G31 Y" &YPos1 'Scan for front edge of part
While IsMoving()
Wend
YPos2 = GetVar(2001) 'record front edge of part
YCenter = (YPos1 + YPos2) / 2 'calculate Y axis center
Code "G0 Y" &YPos2 - .25 'Move .25 inches away from from edge of part
Code "G0 Z" &ZTop + .25 'Move .25 inches above part surface
Rem move To the center
Code "G0 Y" &YCenter 'Move to Y axis center location
Code "G0 X" &XCurrent + .825 'Move 1 inch to right for right edge of part probe
Code "G0 Z" &ZTop - .4 'Move down to .4 inches below part top edge
Rem Probe Left
Code "G31 X" &XCurrent - 1.5 'Move into left edge of part to determine right edge
While IsMoving() 'wait for the move to finish
Wend
XPos1 = GetVar(2000) 'record location of right edge of part
Code "G0 X" &XPos1 + .25 'Move .25 inches away from last scanned edge
Code "G0 Z" &ZTop +.25 'Move up to .25 invhrd sbovr part surface
Code "G0 X" &XPos1 - 1.25 'Move 1.5 inches left side of part
Code "G0 Z" &ZTop - .4 'Move down to .4 inches below part top edge
Rem Probe Right
Code "G31 X" &XPos1 + 1.5
While IsMoving()
Wend
XPos2 = GetVar(2000)
XCenter = (XPos1 + XPos2) / 2 'center is midway between XPos1 and XPos2
Code "G0 X" &XPos2 - .25 'Move .25 inches away from from edge of part
Code "G0 Z" &ZTop + .25 'Move .25 inches above part surface
Code "G0 X" &XCenter 'rapid move to the x center location
Code "G0 Z" &ZTop 'Place mill at 0 Z height
Rem Reset DROs
SetDro (0,0.00) 'reset X axis DRO
Code "G04 P.5" 'pause .5 seconds
SetDro (1,0.00) 'reset Y axis DRO
Code "G04 P.5" 'pause .5 seconds
SetDro (2,0.00) 'reset Z axis DRO
Code "G04 P.5" 'pause .5 seconds
Code "F" &FeedCurrent 'restore starting feed rate
End If