Author Topic: Z zero touch probe issues  (Read 133 times)

0 Members and 1 Guest are viewing this topic.

Offline miroutllc

  • Active Member
  • Posts: 3
    • View Profile
Z zero touch probe issues
« on: January 15, 2019, 08:32:34 AM »
First time poster here.  I loaded a z zero script into the auto zero button and it worked great.  I then felt I would rather have a script that did a double measure, so I found a script that was posted that from what I understood was from BigTex, but now when the tool hits the sensor, instead of just retracting the specified distance, the spindle retracts all the way back up until it hits the home switch and then faults out.  I deleted everything and re-installed the original script that worked perfect, and the spindle still raises all the way up.  Any recommendations about what could be the problem?  Here is the script that I entered.

Rem   VBScript To probe In the z axis

If GetOemLED(801) Then            'NOTE: This script is for Inches as Native Units

   If GetOemLed (825) <> 0 Then       'check to see if the probe is already grounded or faulty
      Message "Z-Plate is grounded, check connection and try again" 'this goes in the status bar if aplicable
   Else
      Code "G4 P1"         'pause 1 seconds to give time to position probe plate
      PlateOffset = GetUserDRO(1151)   'get plate offset DRO
      CurrentFeed = GetOemDRO(818)    'get the current feedrate to return to later
      Code "F12"         'slow down feedrate to 12 ipm

   Rem   Probe In the z direction
   ZNew = GetOEMDro(802) - 6      'probe move to current z - 6 inches
      Code "G31Z" &ZNew
      While IsMoving()         'wait For probe move to finish
      Sleep(10)
      Wend

      ZNew = GetVar(2002)       'read the touch point
      Code "G0 Z" &ZNew +.05      'move back  +.1 to hit point incase there was overshoot +.1
      While IsMoving ()
      Sleep(10)
      Wend
   
   Rem End add lines   
   
      Code "F1"         'slow down feedrate to 2 ipm
      ZNew = GetOEMDro(802) - .1   'probe move to current z - .25 inches
      Code "G31Z" &ZNew
      While IsMoving()         'wait For probe move to finish
      Sleep(10)
      Wend

      ZNew = GetVar(2002)       'read the touch point
      Code "G0 Z" &ZNew       'move back to hit point incase there was overshoot
      While IsMoving ()
      Sleep(10)
      Wend

      If PlateOffset <> 0 Then
         Call SetOEMDro (802, PlateOffset)   'set the Z axis DRO to  plate thickness
         Code "G4 P0.25"       'pause for Dro to update.
         ZNew = PlateOffset + .937   'calc retract
         Code "G0 Z" &ZNew    'put the Z retract height you want here
         While IsMoving ()
         Sleep(10)
         Wend
         Message "Z axis is now zeroed in Imperial units"    'puts this message in the status bar
      
      End If

      Code "F" &CurrentFeed       'returns to prior feed rate
   End If         
Else                                             'NOTE: This portion of script is for Metric as Native Units

   If GetOemLed (825) <> 0 Then       'check to see if the probe is already grounded or faulty
      Message "Z-Plate is grounded, check connection and try again" 'this goes in the status bar if aplicable
   Else
      Code "G4 P1"         'pause 1 seconds to give time to position probe plate
      PlateOffset = GetUserDRO(1151)   'get plate offset DRO
      CurrentFeed = GetOemDRO(818)    'get the current feedrate to return to later
      Code "F300"         'slow down feedrate to 300 mmpm

   Rem   Probe In the z direction
      ZNew = GetOEMDro(802) - 150   'probe move to current z - 150 mm
      Code "G31Z" &ZNew
      While IsMoving()         'wait For probe move to finish
      Sleep(10)
      Wend
   
      ZNew = GetVar(2002)       'read the touch point
      Code "G0 Z" &ZNew + 3      'move back  + 3 mm to hit point incase there was overshoot + 3 mm
      While IsMoving ()
      Sleep(10)
      Wend
   
   Rem End add lines   

      Code "F50"         'slow down feedrate to 50 mmpm
      ZNew = GetOEMDro(802) - 6   'probe move to current z - 6 mm
      Code "G31Z" &ZNew
      While IsMoving()         'wait For probe move to finish
      Sleep(10)
      Wend

      ZNew = GetVar(2002)       'read the touch point
      Code "G0 Z" &ZNew       'move back to hit point incase there was overshoot
      While IsMoving ()
      Sleep(10)
      Wend

      If PlateOffset <> 0 Then
         Call SetOEMDro (802, PlateOffset)   'set the Z axis DRO to  plate thickness
         Code "G4 P0.25"       'pause for Dro to update.
         ZNew = PlateOffset + 20   'calc retract
         Code "G0 Z" &ZNew    'put the Z retract height you want here
         While IsMoving ()
         Sleep(10)
         Wend
         Message "Z axis is now zeroed in Metric units"    'puts this message in the status bar
      
   End If

      Code "F" &CurrentFeed       'returns to prior feed rate
End If   
End If     

Offline miroutllc

  • Active Member
  • Posts: 3
    • View Profile
Re: Z zero touch probe issues
« Reply #1 on: January 15, 2019, 09:37:20 AM »
Just to be clear, I am not putting any blame on anyone or any particular script.  I know they work for a lot of people, and as I stated, it did work at one point, so I'm sure it's something I am overlooking. 

Offline ZASto

  • Active Member
  • Posts: 119
    • View Profile
Re: Z zero touch probe issues
« Reply #2 on: January 15, 2019, 10:45:09 AM »
Try this one, it works flawlesly on my router:

Code: [Select]
Sub Main() 'made it a sub, so you can return on "show stopper" errors
'Option Explicit 'Written by Big-Tex Dec 26 2010 Updated Jun 3 2014
'Mod pb 11dec10

Dim ZNew, Zplate, Zrestposition, ZMaterialmachcoord, ZPlatejobcoord, Zplatetomaterial
Dim xjobcoord, yjobcoord, xmachcoord, ymachcoord, zmachcoord
Dim xprobeloc, yprobeloc, xtoprobe, ytoprobe, PlateOffset
Dim CurrentFeed, Zretract
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
Zretract = GetOemDRO(1202) 'get Z tool change location
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
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
End If

'//////// Error Condition checking code

If GetOemLED(16)<>0 Then 'Checks for machine coordinates
  Code "(Please change to working coordinates)"
  Exit Sub 'ERROR! exit the macro
End If

If GetOemLED(825)<>0 Then
  Code "(Z-Plate Grounded Check connection and try again)"
  Exit Sub 'ERROR! exit the macro
End If

'//////// Start Probing Code, Probe In -Z direction.MOVABLE PROBE PLATE
'//////// The vars will be Inch or Metric from above if/else statment

sleep(1000) 'pause 1 seconds to give time to position probe plate
Code "F" & FirstProbeFeed 'slow down feedrate to 10 ipm
ZNew = ( GetDro(2) - FirstProbeDist ) 'probe move to current z - 6 inches
Code "G90 G31Z" & ZNew
While IsMoving() 'wait for probe move to finish
Wend
ZNew = GetVar(2002) 'read the touch point
Code "G0 Z" & ( ZNew + FirstRetractDist ) 'move back to hit point incase there was overshoot +.1
While IsMoving ()
Wend
Code "F" & SecondProbeFeed 'slow down feedrate to 2 ipm
ZNew = ( GetDro(2) - SecProbeDist ) 'probe move to current z - .25 inches
Code "G90 G31Z" & ZNew
While IsMoving() 'wait for probe move to finish
Wend
ZNew = GetVar(2002) 'read the touch point
Code "G0 Z" & ZNew 'move back to hit point incase there was overshoot
While IsMoving ()
Wend
Call SetDro (2, PlateOffset) 'set the Z axis DRO to plate thickness
sleep(250) 'pause for Dro to update.
Code "G53 G0 Z" & Zretract
While IsMoving ()
Wend
Code "F" & CurrentFeed 'returns to prior feed rate

'//////// End Probing Code,

If GetOEMLED(801) Then 'ON = English Measure INCH
  Code "(Z axis is now zeroed in English Units)" 'puts this message in the status bar
Else 'OFF = Metric Measure MM
  Code "(Z axis is now zeroed in Metric Units)" 'puts this message in the status bar
End If

If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
  Code "G91"
End If

End Sub
Make no mistake between my personality and my attitude.
My personality is who I am.
My attitude depends on who you are.

Offline miroutllc

  • Active Member
  • Posts: 3
    • View Profile
Re: Z zero touch probe issues
« Reply #3 on: January 15, 2019, 11:13:47 AM »
Thank you very much!  I will try that this evening.  From what I understand, I enter my sensor thickness into the "gauge block" in the offset screen, the one in the upper left hand side?

Offline ZASto

  • Active Member
  • Posts: 119
    • View Profile
Re: Z zero touch probe issues
« Reply #4 on: January 15, 2019, 03:19:00 PM »
On BigTex Blue screenset it is on Program Run page, in a lower quarter of the screen.

Ayway, open your screenset in a screen editor and find where you have OEM DRO 1151
Make no mistake between my personality and my attitude.
My personality is who I am.
My attitude depends on who you are.