Hello Guest it is March 28, 2024, 10:42:32 AM

Author Topic: Auto Zero  (Read 32864 times)

0 Members and 1 Guest are viewing this topic.

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Auto Zero
« Reply #10 on: November 01, 2009, 08:45:11 AM »
This looks like a good place to start. It is the latest update I saw to yours in the thread at the zone.

Quote
1) Returns the probe to the original starting postion once contact is made. This was somewhat problematic if the "Machine Coordinates" button was activated. Finally go it solved.

2) If no contact is made while plunging the probe to the maximum distance, probe is NOT retracted and the Z-DRO shows the current position. This allows for sequential movements until the probe reaches the contact plate.

3) Put the parameters that you may want to fiddle with at the top and added comments to remind me what I did and why.


Here is the modified script:

' Program to automatically zero the Z-axis using a contact plate of known thickness positioned
' on top of the X-Y plane at the Z zero position. Cutting tool acts as a probe.

' Program moves the Z-axis downward at plunge speed defined by parameter "ProbeFeed" until
' the tool touches the contact plate. At this point, the Z-DRO is set to zero, adjusted for
' the thickness of the contact plate. Z-axis then retracts to the starting position.

' Last updated: 10/13/09

' Define fixed parameters

ProbeDist = "-1.0" 'Set the maximum distance to move the Z-axis before probe touches contact plate.
ProbeFeed = "10" 'Set the plunge speed for the probe
DelayTime = "1" 'Set the delay time in seconds from button push to start of Z-motion

' Obtain current state values so that they can be restored upon completion.

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

PlateThickness = GetUserDRO(1151) ' Read contact plate thickness DRO
StartingPoint = GetOemDRO(85) - GetOemDRO(832) ' Get starting Z position in work coordinates

If GetOemLed (825)=0 Then ' Check to see if the probe is already grounded or faulty
Code "G4 P" &DelayTime ' This delay gives me time to get from computer to hold probe in place
Code "F" &ProbeFeed ' Set the probe plunge speed
Code "G91 G31Z" &ProbeDist ' Probing move using incremental move mode.
While IsMoving() ' Wait while it happens
Wend

ZProbePos = GetVar(2002) ' Get the axact point the probe was hit
If (ProbeDist+StartingPoint = ZProbePos) Then GoTo NoContact ' No contact was made during plunge
Code "G90 G0 Z" &ZProbePos ' Go back to that point. Always a very small amount of overrun.
While IsMoving ()
Wend

Call SetDro (2, PlateThickness) ' Set the Z axis DRO to whatever is set as plate thickness
Sleep 500 ' For some reason unknown to me,need this pause or retract goes to wrong place
Retract=Val(PlateThickness)+Val(StartingPoint)-Val(ZProbePos) ' Calculate retract position
Code "G0 Z" &Retract ' Retract to original position
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" ' Puts this message in the status bar
GoTo Finish
NoContact:
Code "(No contact made within probing distance, try again!)" 'Puts this messge in the status bar
Finish:
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 aplicable
End If

' Reset the machine state

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

Exit Sub

;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Auto Zero Quit working after .029 install!
« Reply #11 on: November 08, 2009, 05:03:32 AM »
I was using the Auto Tool Zero and very happy with it unti I installed build .029.  Now it is so unpredicatble I can't use it anymore.  Sometimes it retracts over an inch, or feeds down an inch after touching the probe plate. Other times it doesn't advance more that .o1 or so the stops and reprots "Z is now zeroed." Anyone know what's different between the old version and the new version that caused this? Anyone got a new VB script that works reliably with the newer versions?
Re: Auto Zero
« Reply #12 on: November 11, 2009, 01:13:50 AM »
I had the same issue.  I took the above code and modified it to the following and now it works great, thanks for the help!

' Program to automatically zero the Z-axis using a contact plate of known thickness positioned
' on top of the X-Y plane at the Z zero position. Cutting tool acts as a probe.

' Program moves the Z-axis downward at plunge speed defined by parameter "ProbeFeed" until
' the tool touches the contact plate. At this point, the Z-DRO is set to zero, adjusted for
' the thickness of the contact plate. Z-axis then retracts to the starting position.

' Last updated: 10/13/09

' Define fixed parameters

ProbeDist = "-1.0" 'Set the maximum distance to move the Z-axis before probe touches contact plate.
ProbeFeed = "10" 'Set the plunge speed for the probe
PlateThickness = 0.040

' Obtain current state values so that they can be restored upon completion.

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 MsgBox("Ready to auto-detect z zero" & Chr(13) & Chr(13) & "Auto-height pad in place?",1) =1 Then
   If GetOemLed (825)=1 Then ' Check to see if the probe is already grounded or faulty
      MsgBox("Touch-Plate is grounded, check connection and try again")
      Code "Z-Plate is grounded, check connection and try again" 'this goes in the status bar if aplicable
   Else   
      StartingPoint = GetOemDRO(85) - GetOemDRO(832) ' Get starting Z position in work coordinates
      Code "F" &ProbeFeed ' Set the probe plunge speed
      Code "G91 G31Z" &ProbeDist ' Probing move using incremental move mode.
      While IsMoving() ' Wait while it happens
      Wend
      
      ZProbePos = GetVar(2002) ' Get the axact point the probe was hit
      If Val(ProbeDist)+Val(StartingPoint) >= Val(ZProbePos) Then ' No contact was made during plunge
         Code "G90 G0 Z" & StartingPoint ' Go back to that point. Always a very small amount of overrun.
         While IsMoving ()
         Wend
      Else
         Call SetDro (2, PlateThickness) ' Set the Z axis DRO to whatever is set as plate thickness
         Sleep 500 ' For some reason unknown to me,need this pause or retract goes to wrong place
         Code "G90 G0 Z0.25" '&Retract .25 inches up ' Retract to original position
         While IsMoving ()
         Wend
         Code "(Z axis zeroed)" ' Puts this message in the status bar
      End If   
   End If
End If   

' Reset the machine state
Code "F" &CurrentFeed ' Returns to prior feed rate
If CurrentAbsInc = 0 Then Code "G91" ' If G91 was in effect before then return to it
If CurrentGMode = 0 Then Code "G0" ' If G0 was in effect before then return to it

Exit Sub
It's not what you can buy, it's what you can build.

Offline bowber

*
  •  216 216
  • Kirkby Stephen,Cumbria, UK
    • View Profile
Re: Auto Zero
« Reply #13 on: November 11, 2009, 06:26:16 AM »
Does this code work for sensible units (mm  ;)) and just change the -1.0 to -25 and the plate thickness in mm.

Steve
Re: Auto Zero
« Reply #14 on: November 11, 2009, 12:51:09 PM »
One way to find out! (I think it should)  ;D
It's not what you can buy, it's what you can build.

Offline bowber

*
  •  216 216
  • Kirkby Stephen,Cumbria, UK
    • View Profile
Re: Auto Zero
« Reply #15 on: November 12, 2009, 04:44:37 AM »
One way to find out! (I think it should)  ;D

I could mount the touch plate on a spring then it would just give when the tool caries on.
I could call it Zebedy ;-)

Steve
Re: Auto Zero
« Reply #16 on: November 12, 2009, 10:02:08 AM »
I wouldn't worry about damaging bit due to the over run, here is a youtube video showing that it won't damage even a tiny bit

http://www.youtube.com/watch?v=DOBxt9MIbFo&feature=channel
It's not what you can buy, it's what you can build.

Offline bowber

*
  •  216 216
  • Kirkby Stephen,Cumbria, UK
    • View Profile
Re: Auto Zero
« Reply #17 on: November 12, 2009, 10:48:07 AM »
Yes I'd seen that.
I was just joking about changing it to metric "should" be ok. ;)

Steve
Re: Auto Zero
« Reply #18 on: November 12, 2009, 11:13:06 AM »
 ;D Yes, I think mm is the sensible type of units too. Being in Canada, I work in both inches and mm.
« Last Edit: November 12, 2009, 11:18:43 AM by ruzter »
It's not what you can buy, it's what you can build.

Offline Toad

*
  •  58 58
    • View Profile
Re: Auto Zero
« Reply #19 on: November 14, 2009, 02:01:14 PM »
OK, I re-loaded mach 3 and now it works.   How do I change the Dwell time? It is taking 6 minutes before it begins to move.

 

When to goes down and touches the plate,( which I have the thickness set @ .375) it backs off .25 above the plate and resets Z DRO to .25 . How do I get it to allow for the plate thickness so when I go to 0.000 it is touching the piece I am working on?

Toad