Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: M250cnc on April 20, 2010, 07:18:33 PM

Title: Help needed With Auto tool zero for the lathe
Post by: M250cnc on April 20, 2010, 07:18:33 PM
I am using this macro below and have need of some more functionality.

The problem is the Z length offsets are taken into consideration when it moves to the trigger point "NOT GOOD"

So i need to have the script use the current tool number in use and remove the Z length offset when it does the line

Code "G1 Z" &ZProbePos

The macro works only if the tool has a zero Z offset value stored in the tool table

CurrentFeed = GetOemDRO(818) 'Get the current feedrate.
PlateThickness = GetUserDRO(1152) + GetUserDRO(1153) 'Tool is 15.04 thick comp is .072 approx. 15.076
Code "G94"
ProbeFeed = 100 'You could put a probing feedrate here instead.


Code "G90 F" &ProbeFeed
Code "G49"

If GetOemLed (825)=0 Then
DoOEMButton (1010) 'zero the Z axis
Code "G4 P2" ' this delay gives me time to get from computer to hold probe in place, 2 seconds
Code "G31Z-5 F" &ProbeFeed
While IsMoving()
Wend
ZProbePos = GetVar(2002)
Code "G1 Z" &ZProbePos
While IsMoving ()
Wend
Call SetOEMDro (802, PlateThickness)
Sleep 150 'Pause for Dro to update.
Code "(Z Axis Is Now Zeroed)"
Code "F" &CurrentFeed
Code "G90"
Else
Code "(Z Setting Tool Is Not Working, Check Connection And Try Again)"
End If
Exit Sub


Thanks