PDA

View Full Version : Help auto tool zero not working



Terik1957
05-10-2021, 06:42 PM
Here is my problem I am hoping someone can help me. When I use my touch plate the bit does stop when it reaches the plate, but it does not retract and when I push on the go to zero button it goes back up to the starting point before the touch plate was used instead of going down to material. I went into configuration and then ports / pins then did the automated setup for input.

Here is my system I am using
Windows 7 ultimate, 32 bit. using parallel port
Mach 3 version R3.043.062
mm units

Here is the code I am using

CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state

If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P3" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-10. F4" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, 20.041) ' change .060 to your plate thickness and then adjust for final accuracy
Sleep 200 'Pause for Dro to update.
Code "G1 Z21. F50" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
End If
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If

I would appreciate any help as I am very new to all this, Thank you

phill05
06-10-2021, 03:51 PM
Hi Terik,

I might be telling you what you already know but try this it worked for me and my friends:

In Mach 3 go to Operator down to edit button script click it then go to Auto tool Zero that should be flashing click on it and a Hidden script comes up copy what is in there and save.

This is the code that was running my machine and my friends using a tool touch off plate, you will need to put your own numbers in then save and shut down.

To save any embarrassment put your touch plate on a block of wood say 50mm high touch off then move the block of wood to one side and "go to Zero" move block back under to check if it okay you might have to make some small adjustments to the figures.

Hope it helps copy the below Phill

'VB Code Start
'-------------------
CurrentFeed = GetOemDRO(818)
DoSpinStop()

ZMove = 100.00 'Total lenght of Probe to move before Stop or no Contact Made.
ZOffset = 8.60 ' Plate Hight
ZSal = ZOffset + 20.00 '+ Free Hight, Will possition the Proble 20 MM over the Material.

StopZmove = 0
If GetOemLed (825)=0 Then
DoOEMButton (1010)
Code "G4 P2.5"
Code "G31 Z-"& ZMove & "F200"
While IsMoving()
Sleep(200)
Wend
Probepos = GetVar(2002)
If Probepos = - ZMove Then
responce = MsgBox ("**ERROR** " , 4 , "Probe **ERROR**" )
Code "G0 Z10"
StopZmove = 1
Code "F" &CurrentFeed
End If
If StopZmove = 0 Then
Code "G0 Z" & Probepos
While IsMoving ()
Sleep (200)
Wend
Call SetDro (2, ZOffset)
Code "G4 P1"
Code "G0 Z" & ZSal
Code "(Z zeroed)"
Code "F" &CurrentFeed
End If
Else
Code "(Check Ground Probe)"
End If
Exit Sub
'-------------------
'VB Code Stop

Terik1957
15-10-2021, 10:34 PM
Thank you for responding, I tried using your code and the same thing happened. I am not understanding why the z axis is moving up instead of down to the material. When I click the Go to zero button,

dazp1976
16-10-2021, 01:21 AM
Thank you for responding, I tried using your code and the same thing happened. I am not understanding why the z axis is moving up instead of down to the material. When I click the Go to zero button,

When you say 'it goes back up to the starting point' is that your machine coordibate zero?.
Just something else to check. It could be working off your machine coordinates instead of your work coordinaes.
It's a long shot and odd but something to eliminate.

Terik1957
17-10-2021, 11:44 PM
Thank you for your help, I was able to finally get it working. It was a conflict in the input and was causing an m3++/m3-- llimit switch triggered error. once i fixed that it worked great.