Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: GeorgeIoak on August 14, 2017, 12:02:54 PM

Title: Tool Zero Code w/ Wait for Probe Confirmation
Post by: GeorgeIoak on August 14, 2017, 12:02:54 PM
I was wondering if someone could help with some code that I could add to my tool zero script which waits for you to touch the plate to the bit to confirm that your ground clip is connected. I ran my script yesterday and forgot to attach the ground clip and I ended up driving into the block before I could hit the stop. That made me start thinking that rather than rely on my memory it would be good to add that into the script.

I'm thinking it might be something like this:

Code: [Select]
Code "(Touch Z-Plate to bit)" 'this goes in the status bar
Code "G4 P1" 'Pause
If GetOemLed (825) <> 0 Then
    Code "(I didn't see the Z-Plate)"
    Exit Sub
End If

Instead of a pause it would be better to wait until it sees the probe touch and then ask the operator to continue by clicking on a button or something.

Any suggestions?
Title: Re: Tool Zero Code w/ Wait for Probe Confirmation
Post by: ger21 on August 14, 2017, 03:21:56 PM
You need to use a Message box to have Mach3 wait, then continue when you click OK.
Title: Re: Tool Zero Code w/ Wait for Probe Confirmation
Post by: GeorgeIoak on August 14, 2017, 03:59:39 PM
Thanks, I'm familiar with programming but almost no experience with Mach's VBScripts.

I see the MsgBox command. Now to get a little fancy can you point me to some examples of how I could combine that with the display of the probe touch? I'm thinking now that I could have this MsgBox pop up asking to touch the probe. The box could have a circle or something that lights up with the probe is touched (like on the diagnostic screen). Once Mach detects the touch the MsgBox changes to saying something like "Saw probe, clink continue when touch plate is ready". Then of course there would be a cancel button if for some reason you change your mind or the touch plate isn't seen.
Title: Re: Tool Zero Code w/ Wait for Probe Confirmation
Post by: LerninCNC on August 14, 2017, 05:57:36 PM
Take a look at the attached script.  It has more than you asked for in that it is script for locating and setting X, Y and Z zero.  But it does have the pause script you are asking for. 

Hope this helps.
Title: Re: Tool Zero Code w/ Wait for Probe Confirmation
Post by: GeorgeIoak on August 14, 2017, 06:12:47 PM
Awesome, thank for sharing. I'll print it out and study it tonight
Title: Re: Tool Zero Code w/ Wait for Probe Confirmation
Post by: Tweakie.CNC on August 15, 2017, 02:01:55 AM
I think you will find that the above script only zero's the Z axis but it does show adding a message box.

If it's of any interest the full article for X - Y - Z zero position setting is here http://www.cooperman.talktalk.net/files/17.htm

Tweakie.
Title: Re: Tool Zero Code w/ Wait for Probe Confirmation
Post by: LerninCNC on August 15, 2017, 09:35:28 AM
Tweakie - you are correct.  I attached the wrong script.  I'll get the correct script off my machine dedicated laptop and post it..  Sorry for the mistake.
Title: Re: Tool Zero Code w/ Wait for Probe Confirmation
Post by: LerninCNC on August 15, 2017, 11:22:18 AM
Here is the X, Y, Z zero script with the pause message.  Sorry for the inconvenience.
Title: Re: Tool Zero Code w/ Wait for Probe Confirmation
Post by: GeorgeIoak on August 15, 2017, 11:54:18 AM
Thanks, this looks interesting. Is there a way to give a visual indication in a message box like to see on the diagnostics tab when you touch the probe to the plate? I would also like to "improve" the script so that it doesn't proceed until it does confirm that the probe is detected.

My goal here is to try and eliminate the situation where the ground clip is not attached or it was but came free.

Thanks for your help so far, if nothing else I see some things to improve on what I have now.
Title: Re: Tool Zero Code w/ Wait for Probe Confirmation
Post by: ger21 on August 15, 2017, 12:27:56 PM
Quote
Is there a way to give a visual indication in a message box like to see on the diagnostics tab when you touch the probe to the plate? I would also like to "improve" the script so that it doesn't proceed until it does confirm that the probe is detected.

No, I don't believe you can do either of those things.
But what you can do, is add a probe active LED on the screen, so that when you check the probe, the LED should be visible behind the message box. I think that would work.
Title: Re: Tool Zero Code w/ Wait for Probe Confirmation
Post by: LerninCNC on August 15, 2017, 07:17:27 PM
As you are doing I always touch the touch plate to the probe before running the routine to verify that I have a complete circuit.  My touch plate is a 1" thick piece of aluminum and my probe speed is 5 IPM.  When probing my hand is always on the e-stop, just in case.  The aluminum and low feedrate is somewhat forgiving should you have an over run situation.
Title: Re: Tool Zero Code w/ Wait for Probe Confirmation
Post by: GeorgeIoak on August 15, 2017, 07:53:03 PM
But my main screen does not have a probe status LED indicator. I'm not sure if it has it but I did purchase a copy of the 2010 screen set a while ago but had some initial problems running it so I saved that project for a rainy day that hasn't come yet.
Title: Re: Tool Zero Code w/ Wait for Probe Confirmation
Post by: ger21 on August 15, 2017, 08:50:21 PM
Quote
But my main screen does not have a probe status LED indicator

It's pretty simple to add one.
Title: Re: Tool Zero Code w/ Wait for Probe Confirmation
Post by: GeorgeIoak on August 15, 2017, 10:31:29 PM
OK, I'll look into that too!