Text Size

Auto Tool Zero Method for XYZ Axis Using Mach3 - Part 2

Auto Tool Zero Method for XYZ Axis Using Mach3 - Part 2

Postby airnocker » Sat Aug 21, 2010 1:49 am

Before jumping into the Auto Tool Zero button macro, the very first thing you should do is to use a test script with your Mach3 to determine which version of the Auto Tool Zero macro code you should use and whether your XML config file has any form of corruption which may have gone undetected. I found it very beneficial to run a specific SetDRO/GetDRO or SetOEMDRO/GetOEMDRO command test script first. Some earlier versions of Mach3 do not support the Set/GetOEMDRO command but will support the older variant Set/GetDRO.

Using the Test Script
This script will help rule out a specific type of corruption in the XML file used when starting Mach3. In addition to this test script I will also provide screenshots of what you will see that indicates a corrupt XML file. Two versions of the test script are provided. One uses the legacy SetupDRO/GetDRO commands the other uses the newer version of these commands.

What the Test Script Does and Should Not Do
First, we will load the test script into the Mach3 VB Editor. This script only “sets” values into the X DRO then “reads” the values it just set to a message window. Corruption in the XML file is indicated if the displayed values in the message window either have too many decimal places or incorrect values.

The script will write 6 different values to the X DRO in the following order 0.0000, 1.0000, 2.0000, 3.0000, 4.0000 and 5.0000 at two second intervals then “read back” and display each value in a message dialogue box. You will have to click the OK button in each message box to continue cycling through all six iterations.

Although the values “set” are whole inches out to four decimal places, the expected “read” and displayed values should either be “0”, “1”, “2”, “3”, or 0.0000, 1.0000, 2.0000, 3.0000 etc.. If the first value displayed in the message box is 3.813065418.... instead of “0”,

GetOEMDRO Error.jpg
0 or 0.0000 is not zero
GetOEMDRO Error.jpg (8.5 KiB) Viewed 14741 times


and the next values displayed in the message box are similar to these,
GetOEMDRO Error1.jpg
1 or 1.0000 error
GetOEMDRO Error1.jpg (7.44 KiB) Viewed 14741 times
GetOEMDRO Error1a.jpg
3 or 3.0000 error
GetOEMDRO Error1a.jpg (7.17 KiB) Viewed 14741 times


...then your XML file has some form of corruption and you need to revert to your original XML backup and not the daily Auto Save version.
Another indication of XML corruption is evident if you click and drag a message dialogue box and you get this:
GetOEMDRO Error3.jpg
Window Echo Error
GetOEMDRO Error3.jpg (12.96 KiB) Viewed 14741 times


If your XML file is healthy dragging a message dialogue box will simply move it with no “echoes” and the values “read” and displayed in the message dialogues should look like these:
GetDROMessage0.jpg
0 or 0.0000 is good
GetDROMessage0.jpg (5.49 KiB) Viewed 14741 times
GetDROMessage1.jpg
1 or 1.0000 is good
GetDROMessage1.jpg (5.7 KiB) Viewed 14741 times
GetDROMessage2.jpg
2 or 2.0000 is good
GetDROMessage2.jpg (5.37 KiB) Viewed 14741 times


If the results of this test on your system were correct then you can proceed to test the XYZ Auto Tool Zero script. If you got any message displaying values with errors similar to those shown here, then you must revert to the COPY of the original CNC Mill profile XML file your created during installation. If you weren't diligent in maintaining periodic copies of your CNC Mill XML file then this may mean that you have to redo all your settings in the original copy. Also, you cannot use any of the daily XML profile backups automatically generated by Mach3 as they may also be corrupt.

Be sure to HOME your X-axis after you have finished running the test script and before you do any normal CNC work.

[b]Loading the Test Script[/b]
1.With Mach3 running click “Operator > VB Script Editor.
Operator VB Editor.jpg
To open VB Script Editor

2.A blank editor window will open.
VB Script Editor5.jpg
VB Editor opens a blank script

3.Copy and paste the legacy version of the Test script first into the script window
4.Click the “Run” button
5.Watch the X DRO and click through the six message box OK buttons noting the values set and read back.

If you got the correct results, you can then try the newer version.
1.click any where on blank space in the script window
2.type Ctrl+A or Edit > Select All
3.copy and paste the newer test version over the selected text
4.Click the “Run” button
5.Watch the X DRO and click through the six message box OK buttons noting the values set and read back.

If you get the same results then your version of Mach3 supports the newer code commands. Any other results may indicate your version is too old, so stick with the version that works. If only the legacy test script works, then you will need to use the copy of the legacy auto tool zero macro I provide otherwise you should use the newer version that uses the "SetOEMDRO()" commands.

The Legacy Version of the Test Script: (copy and paste from "Sub Main()" down through the first "End Sub" into the VB Editor)

Sub Main()

Dim ConfirmReady As String
Dim XaxisDRO As Integer
Dim YaxisDRO As Integer
Dim ZaxisDRO As Integer
XaxisDRO=0
YaxisDRO=1
ZaxisDRO=2

MsgBox( "Starting X DRO Set and Get..." )
SetDRO(XaxisDRO, 0.0000)
Sleep 1000
MsgBox "The X-Axis DRO reads " & GetDRO(XaxisDRO)
SetDRO(XaxisDRO, 1.0000)
Sleep 1000
MsgBox "The X-Axis DRO reads " & GetDRO(XaxisDRO)
SetDRO(XaxisDRO, 2.0000)
Sleep 1000
MsgBox "The X-Axis DRO reads " & GetDRO(XaxisDRO)
SetDRO(XaxisDRO, 3.0000)
Sleep 1000
MsgBox "The X-Axis DRO reads " & GetDRO(XaxisDRO)
SetDRO(XaxisDRO, 4.0000)
Sleep 1000
MsgBox "The X-Axis DRO reads " & GetDRO(XaxisDRO)
SetDRO(XaxisDRO, 5.0000)
Sleep 1000
MsgBox "The X-Axis DRO reads " & GetDRO(XaxisDRO)
Sleep 1000

End Sub


The Newer Command Version of the Test Script:

Sub Main()

Dim ConfirmReady As String
Dim XaxisDRO As Integer
Dim YaxisDRO As Integer
Dim ZaxisDRO As Integer
XaxisDRO=800
YaxisDRO=801
ZaxisDRO=802

MsgBox( "Auto Zeroing X..." )
SetOEMDRO(XaxisDRO, 0.0000)
Sleep 1000
MsgBox "The X-Axis DRO reads " & GetOEMDRO(XaxisDRO)
SetOEMDRO(XaxisDRO, 1.0000)
Sleep 1000
MsgBox "The X-Axis DRO reads " & GetOEMDRO(XaxisDRO)
SetOEMDRO(XaxisDRO, 2.0000)
Sleep 1000
MsgBox "The X-Axis DRO reads " & GetOEMDRO(XaxisDRO)
SetOEMDRO(XaxisDRO, 3.0000)
Sleep 1000
MsgBox "The X-Axis DRO reads " & GetOEMDRO(XaxisDRO)
SetOEMDRO(XaxisDRO, 4.0000)
Sleep 1000
MsgBox "The X-Axis DRO reads " & GetOEMDRO(XaxisDRO)
SetOEMDRO(XaxisDRO, 5.0000)
Sleep 1000
MsgBox "The X-Axis DRO reads " & GetOEMDRO(XaxisDRO)
Sleep 1000

End Sub

__________________________________________________________________________________
In Part 3 of this series we will get to the real meat of Auto Tool Macro code.
airnocker

Everything depends on everything else
airnocker
 
Posts: 620
Joined: Thu Mar 25, 2010 9:43 pm
Location: Wellington, CO
CNC Machine: Custom

Re: Auto Tool Zero Method for XYZ Axis Using Mach3 - Part 2

Postby ricochet » Sat Dec 25, 2010 1:05 pm

I have tried the two script files but, When I try dragging a message dialogue box I get “echoes” the values “read” are displayed correctly. I did try a fresh XML file, Same effect.... Is this going to give problems? Should I continue? Will the Auto Tool Zero Script still work? :?
ricochet
 
Posts: 103
Joined: Sun Oct 31, 2010 7:59 pm
Location: Tyler, Texas
CNC Machine: BlackTooth

Re: Auto Tool Zero Method for XYZ Axis Using Mach3 - Part 2

Postby airnocker » Mon Dec 27, 2010 7:21 pm

If you still got echoes when dragging the values read window, your "fresh XML" file is also corrupt. That is what Mach3 support stressed to me.

I wouldn't use it and recommend you generate a clean, fresh XML file but that will mean you have to re-do all your Mach3 configuration settings. To make this easy, take screenshots of ALL your Mach3 settings or them down on a piece of paper to make re-entering them easier.

Also make sure you are on the latest version of Mach3 which is Version R3.042.040.
airnocker

Everything depends on everything else
airnocker
 
Posts: 620
Joined: Thu Mar 25, 2010 9:43 pm
Location: Wellington, CO
CNC Machine: Custom


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 158 on Thu Mar 08, 2012 8:54 pm

Users browsing this forum: No registered users and 1 guest