Hello all,
I really could use some help with one command in the VB script below.
This statement works but also seeds the X- and Z-axes DRO's with random digits!
Call SetOEMDRO(824,number) 'Set tool # in DRO
Why ??
I am working on this for almost a week now.
For the rest the script works OK.
Jos
'REM _________Script to advance ATC/Turret 1 position.____________
maxtool = 6 '# of tools in turret
extraAngle = 6 'Extra angle added to turret rotation
round = 360 'One turn in degrees of turret
oldtool = getcurrenttool 'Tool # before rotation
newtool = GetOEMDRO(824) 'Get Tool #
Angle = round/maxtool 'Angle of rotation i.e. 60 degrees
number = GetOEMDro(824) 'Get Tool #
Code "G91" 'Incremental Distance Mode
If GetOEMDRO(824) = 0 Or GetOEMDRO(824) >6 Then
number1 = Question("What is current tool # ?")
Call SetOEMDRO(824,number1)
Call SetOemDro(803,number1*round/maxtool) '803 = A Turret DRO
Exit Sub
End If
number=number+1 'add 1 to the #
If nummer>maxtool Then number=1 'check if tool # is 6
'After executing the next line the X- and Z- DRO's display random figures.
'I do not know why.
Call SetOEMDRO(824,number) 'Set tool # in DRO
'now calculate the rotation angle of turret
If number=1 Then Call SetOemDro(803,0)
ToolChange = GetOEMDRO(803) 'Get A position
ToolChange = (round/maxtool)+extraAngle 'Tool-change turret 60 + 6 CW
Code "G0 A" & ToolChange 'execute rotation CW
code "G0 A" & -6 '6 steps CCW
While IsMoving()
Wend
Call SetOEMDro(803,((number-1)*round/maxtool))
Code "G90" 'back to Absolute Distance Mode