ok spending a little time on this tonight and Go figure if you use the DoSpinStop() that code line works great... Thanks again. I think I just spent to much time on it and everything was looking correct even when it was stupid mistakes like that. Thanks again Ger21 for your help on this.
Ok so for today I did make it into 2 different macros one for m6start and one for m6end. Now I started my using the edit macro button and placing the m6start macro in the auto tool zero location making it easy to test. and all I did for it was have it go to the G59p200 x0yoz0 location that worked great...
my m06start macro looks like
DoSpinStop()
Code "G59P200 X0 Y0 Z0" ' This sets the spindle so you can change the tool
While IsMoving() 'Pauses the code read while machine moves
Wend
Just to get the spindle to a good place to change the tool which is also above the tool setter.
Then I started on the m6end and it looks like the fallowing.
' This area does not need adjusting
Currentfeed = GetOemDRO(818) ' Gets the current feed rate for return after tool change
CurrentAbsInc = GetOemLed(48) ' Gets current G90/G91 to return it later
CurrentGMode = GetOemDRO(819) ' Gets current G00/G01 to return it later
CurrentTool = GetOeMDRO(824) ' Gets current tool number
' Adjust below to the machine.
' use G59P199 X0 Y0 Z0 at the point where the spindle is just about to trigger the tool setter
' use G59P200 X0 Y0 Z0 at the point you want the Z to travel down from
ZMove = 4.0 'Max allowable Z travel before spindle contacts tool length setter
DoSpinStop()
Code "G59P200 X0 Y0 Z0" ' This sets the spindle so you can change the tool
While IsMoving() 'Pauses the code read while machine moves
Wend
If GetOemLed(825) = 0 Then 'This checks the tool probe before moving forward
Code "G59P200 X0 Y0 Z0"
DoOemButton(1010)
Code "G90 G31 z-" & zmove &"F4" 'Feed rate here for how fast you want z to go down
While IsMoving()
Wend
ZprobePos = GetVar(2002)
Code "G00 Z" &ZprobePos 'place tool at the exact where the tool touched the tool setter
While IsMoving()
Wend
Code "G59P199"
Call SetOemDro(109)'sets the current tool Offset
Sleep 200 'allows time for update
Code "G59P200 X0 Y0 Z0"
While IsMoving()
Wend
Code "This tool's Length is now set"
Code "F" &CurrentFeed
Else
Code "Tool SEtter Error"
End If
If CurrentAbsInc = 0 Then
Code "G91"
End If
If CurrentGMode = 0 Then
Code "G00"
End If
Still testing because I noticed I had a G00 where I ment G90 seams I missed a lot of little things like that.
Now I have always seen that VB code have capital letters and all do they truly matter for example is dospinstop() the same as DoSpinStop()?