Hello Guest it is April 25, 2024, 01:16:05 AM

Author Topic: "Auto tool zero" going up instead of down  (Read 620 times)

0 Members and 1 Guest are viewing this topic.

"Auto tool zero" going up instead of down
« on: October 28, 2021, 07:11:57 AM »
Hello

It is quite a simple problem and I just need to know with minus symbol should I change to +. Long story short, Z axis goes up instead of going down after the first touchdown to the probe.

I'll post the code.

Code: [Select]
'X/Y/Z referenced?
If getoemled(807) Or getoemled(808) Or getoemled(809) Then 'Kontrolli kas nullimise ledid polevad
DoOEMBUTTON(1021)
MsgBox "Teljed nullimata"
Exit Sub
End If

'probe input allready active
If GetOemled(825) <> 0 Then
DoOEMBUTTON(1021)
MsgBox "Testi raadioandurit"
Exit Sub
End If

XWork = GetOEMDRO(800)  ' Get Current X Work Coordinate
YWork = GetOEMDRO(801)  ' Get Current Y Work Coordinate
XMachine = GetOemDRO(83)  ' Get Current X Machine Coordinate
YMachine = GetOemDRO(84)  ' Get Current Y Machine Coordinate
ZMachine = GetOemDRO(85)    ' Get Current Z Machine Coordinate

Code "G49" ' cancel tool lenght offset
Code "G0 G53 Z-1" ' Home Z
code "G53 X216.90 Y3069.85" ' Move into Probe Pos ***EDIT HERE***
DoOEMButton(179) ' machine coordinates
Tool_Number = GetDRO(24) ' get actual Tool number

'fast probe
code "G31 Z-200 F300" ' Z liigub alla 300 mm kuni probini
While IsMoving()
Sleep(30)
Wend

code "G91 G0 Z10" ' Z liigub üles 10  mm
Code "G90"
While IsMoving()
Sleep(30)
Wend


'slow probe
code "G31 Z-15 F20" ' Z liigub alla 15 mm kuni probini
While IsMoving()
  Sleep(10)
Wend

If Tool_Number = 0 Then ' Master tool Cal
z = GetOEMDRO(85) ' get Machine ZPos
Call SetOEMDRO(49,z) ' Set g54 z offset
Else
Call SetDRO(24,0) ' Turn off the tool offset by loading tool #0
Height = GetDRO(2) ' Get the pos of the Z axis without the Tool comp on
Call SetDRO(24,Tool_Number) ' Turn the tool Back on so the offset will go to the
Call SetoemDRO(42,Height) ' Set the Tool Height offset
End If

DoOEMButton(181) ' back To program coordinates
code "G0 G90 G53 Z-1  F1000"
code "G43"
While IsMoving()
Sleep 10
Wend

Code "G0 X" & XWork & " Y" & YWork ' Returns to the previous XY job location
sleep(500)
While IsMoving()
sleep(20)
Wend
Thanks.