Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Hobbs on February 12, 2022, 02:44:34 AM

Title: Bit depth zeroing tool help
Post by: Hobbs on February 12, 2022, 02:44:34 AM
hi all I've recently bought a new 8x4 Chinese 1325 CNC machine single cylinder, which is operating mach 3 something I'm new to having used ncstudio in the past. The machine came with its own z axis tool depth zeroing tool which is  wired up. If I touch it against the tip of a router bit the digitize light flashes up green on the screen, but nothing else. I'm unsure how to use this properly without damaging it in the process of finding out. Any help would be appreciated thank you
Title: Re: Bit depth zeroing tool help
Post by: TPS on February 12, 2022, 06:37:24 AM
reading all your Threads/questions this manual:

https://www.machsupport.com/wp-content/uploads/2013/02/Mach3Mill_Install_Config.pdf

would be a good choice to start with.
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on February 12, 2022, 10:49:39 AM
Mach 3 has an auto too zero button on the program run screen.  If you click on the "Operator" menu, then select "Edit Button Script" from the dropdown list, some of the buttons on the screen will start flashing, including this one.  Click on it - a little editor window will open up with code in it.  If it's like my copy was it will say Message( "Not Yet Implemented" ) which means the routine to do the autozero hasn't been loaded.  Whatever you see, report back here.  Close the window, and if it asks you to save click no.

If there isn't a script there fear not, there are several scripts around to do the job.  Could you describe the "z axis tool depth zeroing tool " that came with the machine?  Even post a photo?
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 01, 2022, 03:01:34 PM
Hi thanks for your reply its height is 40.5mm and brass top diameter 18.5mm. I can post pictures if someone could tell me how to do it thanks all
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on April 01, 2022, 04:14:24 PM
To post a photo, clock reply (not quick reply) and then click on the red + sign next to Attachments and other options below the text box and choose the photo file.

Have you checked to see if there is some button script present as I described above?
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 01, 2022, 04:28:42 PM
Thank you for the help, umyes sorry forgot to me toon I did check for the script and it was not yet implemented as you said. I'll post a photo of the tool with this message thank you
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on April 01, 2022, 04:33:22 PM
OK, a neat little button device.  Also working the digitise light properly. 

There are a number of tool height button scripts on here, I'll try to remember to find mine tomorrow and send a copy.
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 02, 2022, 03:32:20 AM
Thank you, much appreciate, all the best
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on April 02, 2022, 06:59:24 AM
Right, I attach a copy of my macro.   Copy the file, rename it by deleting my initials at the end of the filename (so it's just M900.m1s) and pop it in the folder C:\Mach3\macros\Mach3Mill.

You will need to edit the file in two ways.  Open it using Operator/VB Script Editor, select and open M900.m1s, do the edits, save and close.

First, near the top there is a line:
PlateThickness = 38.84 'Touch Plate thickness is set here
Replace 38.84 with 40.5, which is your button height above the machine table.

Further down there is a line:
SetVar (2, 50) 'Retract height is set here
Replace "50" with the height to which you would like the tool tip to lift after referencing.  It should be greater than the button height!


Do the operator/edit button script thing again, click on Auto Tool Zero, and replace the text you see with Code "M900", then click close, and OK to save this.

Now close Mach3 and re-open it.  You should now find that you can use the tool zero button.  You jog the tool to just above the setter (a couple of mm), click the zero button, and it should move down slowly at 50mm/min until it contacts.  Then it stops, moves up 1mm, and moves down at 1mm/min until it contacts again.  Then it rapids up to the retract height you set, sets the Z DRO to read this, and stops.
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 03, 2022, 07:01:18 AM
Thanks so much for this script works, and the auto zero button works the cylinder down. It
contacts the plate, but it doesn't rise the 50mm above it goes to the zs upper limit without triggering the limit switch error. I tried a test cut but it was high above the workpiece. Any ideas would be much appreciated as to why it might be doing this

thank you
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 03, 2022, 07:04:02 AM
I've just checked my work offsets and z g54 is set at minus 102.1950 would this be affecting the script?
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on April 03, 2022, 09:47:38 AM
I assume you are working in mm?  What number did you replace 50 with in the second edit?
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 03, 2022, 01:47:05 PM
Hi yes In mm I left it at 50mm as it was greater than the 40.5mm height of the tool is that not correct? very grateful for all your help in this thanks
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on April 03, 2022, 03:39:51 PM
Why do you have a work offset set at all?
Title: Re: Bit depth zeroing tool help
Post by: TPS on April 04, 2022, 02:45:24 AM
maybe your motioncontroller is not supporting the usage of Var(2002).
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 04, 2022, 07:19:46 AM
Hi tha k you for your reply, I am unsure why there is a work offset for the Z axis, it was there when I our based the machine. Should I remove it? I have been thinking that this may be affecting the depth tool as well as a homing limit error that pops up. If you could advise that'd be much appreciated thanks
Title: Re: Bit depth zeroing tool help
Post by: TPS on April 04, 2022, 07:24:08 AM
for a quick check you can replace this line of your macro (!! used twice)

Code: [Select]
ProbePos = GetVar (2002)

by
Code: [Select]
ProbePos = GetDRO (2)
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on April 06, 2022, 07:21:21 AM
Sorry that I haven't replied on this.  I tried the script again to see if it interacts with work offsets, but have found that though I have been using it for years without issues something has changed and it operates differently which may or may not be causing your problem.  Bear with me...
Title: Re: Bit depth zeroing tool help
Post by: TPS on April 06, 2022, 09:19:52 AM
this is a very simple code to check that probing is basicly working:

Code: [Select]
If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G90 G31 Z-50 F50" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
Sleep(200)
If GetOemLed (825)=1 Then 'Check to see if the probe is hit
Call SetDro (2, 5) 'set the Z axis DRO to whatever is set as plate thickness
Sleep(200) 'pause for Dro update.
Code "G1 Z10 F500" 'put the Z retract height you want here
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Else
MSGBox "probe not hit !"
Exit Sub
End If
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
Exit Sub
End If
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 07, 2022, 05:43:47 AM
Sorry that I haven't replied on this.  I tried the script again to see if it interacts with work offsets, but have found that though I have been using it for years without issues something has changed and it operates differently which may or may not be causing your problem.  Bear with me...

Thanks very much appreciate it
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 07, 2022, 05:44:25 AM
this is a very simple code to check that probing is basicly working:

Code: [Select]
If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G90 G31 Z-50 F50" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
Sleep(200)
If GetOemLed (825)=1 Then 'Check to see if the probe is hit
Call SetDro (2, 5) 'set the Z axis DRO to whatever is set as plate thickness
Sleep(200) 'pause for Dro update.
Code "G1 Z10 F500" 'put the Z retract height you want here
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Else
MSGBox "probe not hit !"
Exit Sub
End If
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
Exit Sub
End If

Thanks very much for your help I will take a look at this, appreciate your help
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on April 07, 2022, 08:03:49 AM
OK, I've been looking again at the script I supplied and single-stepping it and there is a line:

DoOemButton (1003) 'Clear a possible feed-hold condition

When it reaches this point it jumps up 20mm or so then goes down again.  I have no idea why that line is there, and removing it restores the functionality that I remember.  Try editing it out and see what happens.

TPS' script also looks worth trying.

As background, my script is based on one I found on here with a few mods to suit my machine, but I've never taken the time to go through it and understand every line.  I think there's quite a lot of history lurking in it!  One day I think I will rewrite it from scratch so I fully understand it.
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 09, 2022, 10:29:43 AM
Hi all after a little playing around  i tried the modified line in the script and although it touches the probe, and i set it to 75mm to return above the tool, my z acis will still return to its upper limit and give me a limit switch error message.

I then tried the entire new script kindly offered by TPS and i get the probe not hit message even though it does look as if it has touched, however my z axis does not return to its upper limit with this code.

i have removed the z axis work offset that was stored to see if this offered and improvements.

i hope ive explained this well, this is not soemthing i am familiar with but continually learning from you guys and your help.

any advise as always is much appreciated thanks
Title: Re: Bit depth zeroing tool help
Post by: TPS on April 10, 2022, 04:29:00 AM
if you run my script

-z-axis goes down
-hit the probe
-then message "probe not hit"

is this the sequence what is happening?

if you do this pls go to diagnostic page , message came up. without moving z-axis, and have a look for
diditize LED.
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 10, 2022, 09:54:45 AM
Hi yes with your script that is what happened I will take a look at the diagnostic page and get back to you thanks
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 10, 2022, 03:38:34 PM
Hi yes your script does exactly as you say and diagnostic page shows digitize light in green thanks
Title: Re: Bit depth zeroing tool help
Post by: TPS on April 11, 2022, 01:18:35 AM
i have added some debug messages to the code.
pls run the script and post then the last 10 lines of the file. C:\Mach3\LastErrors.txt

Code: [Select]
If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
Message("starting z-probe at z: " &GetDro(2))
Sleep(200)
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G90 G31 Z-50 F50" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
Sleep(200)
Message("z-Position after probe: " &GetDro(2))
Sleep(200)
Message("probe input after probe: " &GetOemLed(805))
Sleep(200)
If GetOemLed (825)=1 Then 'Check to see if the probe is hit
Call SetDro (2, 5) 'set the Z axis DRO to whatever is set as plate thickness
Sleep(200) 'pause for Dro update.
Code "G1 Z10 F500" 'put the Z retract height you want here
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Else
MSGBox "probe not hit !"
Exit Sub
End If
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
Exit Sub
End If
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 27, 2022, 08:15:11 AM
Thanks for the code, sorry its taken a while to get back. struggling work hours, ive attached all the info from the last error txt doc .

thanks again for the continued support

Tue - 14:07:06 ---Program Startup
Tue - 14:07:11 ---ReConfiguration Estop.
Tue - 14:07:35 ---starting z-probe at z: 46.97
Tue - 14:07:42 ---z-Position after probe: -3.85
Tue - 14:07:42 ---probe input after probe: False
Title: Re: Bit depth zeroing tool help
Post by: TPS on April 27, 2022, 02:00:57 PM
looks like you have noise on the probe signal, because probe tripped after 3.85mm and
then probe signal was off again.

try to play with the debounce in Config-General Config or search what causes the noise.
Title: Re: Bit depth zeroing tool help
Post by: Hobbs on April 29, 2022, 02:37:17 AM
Thank you for the advice, Ive been wondering if I need some sort of grounding from the main body of the CNC to earth road in the building, as I've been having random stops when cutting and an error code of is xpod still connected. Do you think this could be related? Would 1 x ground from frame be enough or could you recommend any other grounds that should be in place thank you
Title: Re: Bit depth zeroing tool help
Post by: TPS on May 01, 2022, 04:48:17 AM
grounding and shielding is allways very hard to advice from remote without knowing the complete installation.
but shielded motor wires and shielded wires for all limit switches/probes is allways a good start. seperated motor
cables and signal wires is also a help. the main machie body should also have a ground connection.
Title: Re: Bit depth zeroing tool help
Post by: garyn on May 23, 2022, 04:38:46 PM
I also am having a problem with the auto tool zero .  The script is installed and the green light appears on the diagnostic screen under digitize when the router bit is touched with the zeroing plate.  The problem is when you push the button nothing moves--the z axis does not move at all.  I have checked all the wiring and ground and everything appears to be ok.  What is the solution?
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on May 23, 2022, 05:20:22 PM
Which script are you running?  And if you select Operator/Edit Button Script then click the now flashing Auto Tool Zero button what comes up in the editor window?
Title: Re: Bit depth zeroing tool help
Post by: garyn on May 23, 2022, 07:33:32 PM
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 GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P3" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-4. F2" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend

'ZProbePos = GetVar(2002) 'get the exact point the probe was hit
'Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
'While IsMoving ()
'Wend

Call SetDro (2, .125) ' change .060 to your plate thickness and then adjust for final accuracy
Sleep 200 'Pause for Dro to update.
Code "G1 Z1. F50" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
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 applicable
End If
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If   
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on May 24, 2022, 01:42:59 AM
OK.  And where is this code, is it a button script or stored as a macro?  If the latter then the macro has to be executed from a button script.
Title: Re: Bit depth zeroing tool help
Post by: garyn on May 24, 2022, 07:52:56 AM
It is a button script.
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on May 24, 2022, 08:16:20 AM
When you press the button, do you get a message in the status bar - (Z-Plate is grounded, check connection and try again) - ?

Have you tried single stepping through the code?  You should be able to see the control flow and where it isn't doing what's expected.
Title: Re: Bit depth zeroing tool help
Post by: garyn on May 24, 2022, 02:35:32 PM
I do get an error message.  It is  "scripter compile error  h"
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on May 24, 2022, 02:39:30 PM
Hmm.  Well I'm completely baffled I'm afraid.
Title: Re: Bit depth zeroing tool help
Post by: garyn on May 24, 2022, 02:41:46 PM
What do you suggest? Anyone in particular that I could contact that might have the solution?
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on May 24, 2022, 03:36:38 PM
Not that I can think of.  You could look for a different script?
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on May 24, 2022, 03:38:15 PM
For example the code in reply 18 to this thread.
Title: Re: Bit depth zeroing tool help
Post by: garyn on May 24, 2022, 04:24:54 PM
That one didn't work--got same error message.
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on May 24, 2022, 04:52:22 PM
Right, so it's not a problem with the scripts but something more subtle.   I have no idea what I'm afraid,  I've never had any problem like this arise.
Title: Re: Bit depth zeroing tool help
Post by: garyn on May 24, 2022, 08:03:21 PM
How do you single step through the code?
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on May 25, 2022, 01:38:20 AM
Do a Google on scripter compile error  h - quite a few hits on this forum come up, in particular one long thread from 2018.  It seems to be some kind of problem with the visual basic interpreter, possibly interacting with particular character combinations in the code.  There seem to be two fixes - one is to make sure you are running the latest Mach version, I think that's .062.  The other is to open the macro in the operator/edit VB macro menu, then select save as, and save as compiled code (.mcc). 

To single step, open the code in the VB scripter window as above (before compiling I think), you will see a row of icons just below the menu bar.  The green right arrow runs the macro, the green one with two green bars immediately after it is the single step.  If you hover your cursor over each icon its function is shown after a second or so.
Title: Re: Bit depth zeroing tool help
Post by: garyn on May 25, 2022, 08:28:55 AM
Don't lnow at this point if that will work, but I want to thank you for your patience and persistence.  I know I don't have the latest version of  Mach 3, so I will get that downloaded and installed.  Then I will try single stepping the script and see what happens. I will let you know what happens.
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on May 25, 2022, 09:03:04 AM
Happy to (try to) help.
Title: Re: Bit depth zeroing tool help
Post by: TPS on May 25, 2022, 11:39:46 AM
i have tested this code:

Code: [Select]
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 GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P3" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31Z-4. F2" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend

'ZProbePos = GetVar(2002) 'get the exact point the probe was hit
'Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
'While IsMoving ()
'Wend

Call SetDro (2, .125) ' change .060 to your plate thickness and then adjust for final accuracy
Sleep 200 'Pause for Dro to update.
Code "G1 Z1. F50" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
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 applicable
End If
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If   

here, running without any error.
Title: Re: Bit depth zeroing tool help
Post by: garyn on May 26, 2022, 09:55:29 AM
Will XP run the latest Mach 3 version?
Title: Re: Bit depth zeroing tool help
Post by: garyn on May 26, 2022, 10:23:13 AM
Should I also save the auto tool zero script as a .mcc file?
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on May 26, 2022, 04:09:15 PM
Absolutely!   I ran the latest Mach3 under XP for at least 10 years, now run it with Win10 with no issues.  Mach3 ceased active support about a decade ago (?) I think, the only way to seek support now is through this forum really.
Title: Re: Bit depth zeroing tool help
Post by: garyn on May 27, 2022, 09:05:33 AM
I got the latest version of Mach 3 installed, and the used the "TPS'S" version of the auto tool zero script, and it all works.  Since I usually z zero somewhere on the material, I would like for that script to send the z axis back to X0Y0.  I have pm'ed "TPS" asking for his assistance.

Thanks again for your assistance.
Gary
Title: Re: Bit depth zeroing tool help
Post by: JohnHaine on May 27, 2022, 09:25:38 AM
Good!  Glad you're sorted.