Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: rlbob on January 28, 2022, 02:16:39 PM

Title: Auto tool zero Help
Post by: rlbob on January 28, 2022, 02:16:39 PM
Hello,
I just buy chinise VEVOR 3 Axis 3040 CNC. the manufacturer has given the following code for auto tool zero, but it doesn't work:

'Rem   Probe Down by PEU (Based on Erniebro Work)
FeedCurrent = GetOemDRO(818)    'Get the current settings
ZCurrent = GetDro(2)
Code "G4 P1"         'Pause 1 second to give time to position probe plate
Code "F1"         'slow feed rate to 10 MM/MIN
GageH = GetOEMDRO (1002)
Rem   Probe Down by PEU (Based On Erniebro Work)
FeedCurrent = GetOemDRO(818)    'Get the current settings
ZCurrent = GetOemDro(802)
Code "G4 P1"         'Pause 1 second to give time to position probe plate
Code "F1"         'slow feed rate to 10 MM/MIN
GageH = GetUserDRO(1152)
ZNew = ZCurrent - 30      'probe down 30mm
Code "G31 Z" &ZNew
While IsMoving()
Wend
Call SetDro (2,GageH)
FinalMove = GageH * 1
Code  "G0 Z" &FinalMove
Code  "G0 Z" &30
Code "F" &FeedCurrent        'restore starting 


Can somebody help me? I'm new to mach3.
Title: Re: Auto tool zero Help
Post by: JohnHaine on January 29, 2022, 02:35:03 AM
What horrible code! Seems to repeat itself.  Despite the comments the probe feed rate is 1mm/minute so you could be waiting a long time!
Have you checked that the digitise input is working in the diagnostics tab? Where have you put that code?
Title: Re: Auto tool zero Help
Post by: rlbob on January 29, 2022, 02:55:32 AM
Yes. I checked in diagnostics tab, input works well. I copy this code  in "Auto Tool Zero" script.
Title: Re: Auto tool zero Help
Post by: TPS on January 29, 2022, 03:35:17 AM
this is a very simple/basic z-probe script for metric use:

Code: [Select]

'simple Z-probe
GageH = 20   'enter the gauge height here
FeedCurrent = GetOemDRO(818)  'Get the current settings
ZNew = GetOemDro(802) - 30      'probe down 30mm
Code "G31 Z" &ZNew & " F10"   'do the probing with 10mm/s
While IsMoving()
Wend
Call SetDro (2,GageH)
Code  "G91 G0 Z10"
Code  "G90"
Code "F" &FeedCurrent                 'restore starting
Title: Re: Auto tool zero Help
Post by: JohnHaine on January 29, 2022, 05:41:37 AM
That looks good! Simple and should do the job.  Only comment is that if the touch isn't detected in the 30mm the touch plate will get squashed.  A refinement is to probe down at say 50mm/min until touch, then withdraw say .5mm, then probe slowly at say 5mm/min.

When you say you copied the code into the "Auto Tool Zero" script, do you mean that you pasted it into the button script?  That should be fine, though for historical reasons my script is in a macro (M900) which is called from the button script.
Title: Re: Auto tool zero Help
Post by: inflationmountain on October 17, 2023, 09:49:36 PM
snake io (https://snake-io.io/)
In spite of the remarks, the probe feed rate is 1mm/minute, so you may have to wait quite a while! However, for historical reasons, my script is stored in a macro (M900) that is invoked by the button script.