Hello Guest it is March 09, 2021, 02:26:20 AM

Author Topic: Auto Zero  (Read 28325 times)

0 Members and 1 Guest are viewing this topic.

Offline Toad

*
  •  58 58
    • View Profile
Re: Auto Zero
« Reply #20 on: November 14, 2009, 02:49:46 PM »
Good day;

I loded this code to auto zero Z and it does work, But I have a question, When it touches the plate, it backs off .25 and sets the DRO to .25 as it should by what I best understand. How can I get it to allow for the thickness of the touch plate so when I set Z to zero it touches the material. My touch plate I am using now is .375. 

Also, when I go to auto Zero Z it dwells for 6 minutes before moving, how do I change that?




'Auto Tool Zero Script

CurrentFeed = GetOemDRO(818) 'Get the current feedrate.
PlateThickness =0.375
ProbeFeed = 5

Code "G90 F" &ProbeFeed

If GetOemLed (825)=0 Then
Code "G4 P5000" 'Time to get to the z-plate
Code "G31Z-5 F" &ProbeFeed
Code "G4 P0.25"
While IsMoving()
Sleep(100)
Wend
ZProbePos = GetVar(2002)
Code "G0 Z" &ZProbePos
While IsMoving ()
Sleep(100)
Wend
Call SetDro (2, PlateThickness)
Sleep(100)
Code "G4 P0.5" 'Pause for Dro to update.
Code "G0 Z0.25" 'Change the Z retract height here
Code "(Z axis is now zeroed)"
Code "F" &CurrentFeed
Else
Code "(Z-Plate is grounded, check connection and try again)"
Exit Sub
End If

Offline Toad

*
  •  58 58
    • View Profile
Re: Auto Zero
« Reply #21 on: November 14, 2009, 03:13:43 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

Offline Greolt

*
  •  956 956
    • View Profile
Re: Auto Zero
« Reply #22 on: November 14, 2009, 05:00:53 PM »
Here is the same code with a couple of small edits.

This will dwell for 3 seconds.

'Auto Tool Zero Script modified for Toad

CurrentFeed = GetOemDRO(818) 'Get the current feedrate.
PlateThickness =0.375

If GetOemLed (825)=0 Then
DoOEMButton (1010)
Code "G4 P3" 'Time to get to the z-plate, 3 seconds
Code "G90 G31 Z-2 F4" ' probing move, can set the feed rate here as well as how far to move
While IsMoving()
Wend
ZProbePos = GetVar(2002)
Code "G1 Z" &ZProbePos
While IsMoving ()
Wend
Call SetDro (2, PlateThickness)
Sleep(120)
Code "G0 Z1" 'Change the Z retract height here to what you want, must be higher than touch plate
Code "(Z axis is now zeroed)"
Code "F" &CurrentFeed 'returns to prior feedrate
Else
Code "(Z-Plate is grounded, check connection and try again)"
End If
Exit Sub
%

Offline Toad

*
  •  58 58
    • View Profile
Re: Auto Zero
« Reply #23 on: November 14, 2009, 05:09:04 PM »
Thanks, I'll give it a try

Offline Toad

*
  •  58 58
    • View Profile
Re: Auto Zero
« Reply #24 on: November 14, 2009, 05:38:15 PM »
Greolt

Thanks, that worked.  If I get a thinner plate, do I just need to go into edit script and change the plate thickness, or is there something else I have to change?

You are a big help.

Toad

Offline Greolt

*
  •  956 956
    • View Profile
Re: Auto Zero
« Reply #25 on: November 14, 2009, 05:44:56 PM »
Yes edit the plate thickness.

This is something that will need fine tuning to get the Z zero really accurate.

Greg
Re: Auto Zero
« Reply #26 on: July 25, 2010, 04:25:02 PM »
I'm sorry but how do I get the VB code in mach3 mill? what do I have to click n paste? I have the text copy of the script somewhere from a guy here.
can anyone teach me step by step?

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Auto Zero
« Reply #27 on: July 25, 2010, 05:59:12 PM »
I'm sorry but how do I get the VB code in mach3 mill? what do I have to click n paste? I have the text copy of the script somewhere from a guy here.
can anyone teach me step by step?

I have not read through the rest of the post so may not be understanding what you want fully. If it is just making a button with the Auto Zero code then go to Operator menu then Edit Button Scripts. You will then see the AutoZero button flash, click it and the editor window will open, paste your code in there and save.
Hood
Re: Auto Zero
« Reply #28 on: July 26, 2010, 05:06:39 AM »
I apologize for posting someone else's work here and without his permission. I can not find his thread anymore because there are so many of them. Again I apologize for posting his work without his permission:
 the codes for auto tool zero

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     

please help me what to do with this? What do I need to click in mach3? I really wanted to try his codes seems like it is VERY GOOD!

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Auto Zero
« Reply #29 on: July 26, 2010, 06:34:57 AM »
As said above, Open Mach and from Operator menu choose to edit Button scripts. The Auto tool zero button will be flashing, click on it and the editor will open. Replace any code in the editor with the code you have posted above and then save.
Thats it, should work now when you press that button.
Hood