View Full Version : Mach 3 tool setter Big-tex version / script help please

25-06-2013, 08:01 PM
I am using the Big-tex version on Mach3. I have installed the auto zero script.
I am using a tool offset block sensor.. CNC Werkzeuglängensensor Werkzeuglängentaster Werkzeugtaster Taster Werkzeug-Taster Werkzeugsensor Sensor Werkzeugvermessung -CNC-Plus Germany (http://www.cnc-plus.de/-1467.html?XTCsid=2defe6cd919b0ae1d5d918b0a0197276)
The hight offset of the block is in the "guage block hight" in "offsets"
When I press the button "Initial Zero setup" when x and y are homed, the Z moves down as it should and reaches the block....moves up...returns and touches the block once more and rises around 150mm. That is where I thought the process should stop, but then the Y axis moves near the center of the table and repeats the whole process again before Mach shows me the Z is set. I do not have a fixed Z plate as my X axis bed moves. How do I instruct the script to only preform the operation once, wherever X, or Y axis happen to be ?

Sub Main() 'made it a sub, so you can return on "show stopper" errors
'Option Explicit 'Written by Big-Tex Dec 26 2010
'Mod pb 11dec10

Dim ZNew, Zplate, Zrestposition, ZMaterialmachcoord, ZPlatejobcoord, Zplatetomaterial
Dim xjobcoord, yjobcoord, xmachcoord, ymachcoord, zmachcoord
Dim xprobeloc, yprobeloc, xtoprobe, ytoprobe, PlateOffset
Dim CurrentFeed
Dim CurrentAbsInc

xjobcoord = GetDRO(0) 'get current job coordinate for X
yjobcoord = GetDRO(1) 'get current job coordinate for Y
xmachcoord = GetOemDRO(83) 'get current machine coordinate for X
ymachcoord = GetOemDRO(84) 'get current machine coordinate for Y
zmachcoord = GetOemDRO(85) 'get current machine coordinate for Z
xprobeloc = GetUserDRO(1100) 'get X machine coordinate location of the touch plate
yprobeloc = GetUserDRO(1101) 'get Y machine coordinate location of the touch plate
xtoprobe = (xprobeloc - xmachcoord + xjobcoord) 'calculate the X move from the current location to the touch plate
ytoprobe = (yprobeloc - ymachcoord + yjobcoord) 'calculate the Y move from the current location to the touch plate
PlateOffset = GetUserDRO(1151) 'get plate offset DRO
CurrentFeed = GetOemDRO(818) 'get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state

'//////// the block below will set all your reusable vars depending on Inch or mm.
'//////// this sets the vars so you only need ONE large block of probing code.

If GetOEMLED(801) Then 'ON = English Measure INCH
FirstProbeDist = 6.0 'first probe travel
FirstRetractDist = 0.1 'first probe retract travel
SecProbeDist = 0.25 'second probe travel
FirstProbeFeed = 10 'First Probe Feed Speed
SecondProbeFeed = 2 'Second Probe Feed Speed
'CalcRetract = 2.6315 'calc retract
Zretract = -0.5 'Z reftact
Else 'OFF = Metric Measure MM
FirstProbeDist = 150.0 'first probe travel
FirstRetractDist = 3.0 'first probe retract travel
SecProbeDist = 6.0 'second probe travel
FirstProbeFeed = 300 'First Probe Feed Speed
SecondProbeFeed = 50 'Second Probe Feed Speed
'CalcRetract = 50 'calc retract
Zretract = -12 'Z retract
End If