Text Size

## Auto Tool Zero Method for XYZ Axis Using Mach3 - Part 3

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

Here is the macro script I use for Auto Tool Zero button.

Code: Select all
`Sub Main()Dim ConfirmReady As StringDim DoXY As StringDim DoZ As StringDim TouchPlate As DoubleDim XaxisDRO As IntegerDim YaxisDRO As IntegerDim ZaxisDRO As IntegerDim ToolDia As DoubleXaxisDRO=800YaxisDRO=801ZaxisDRO=802Message ( " Prepare to enter tool diameter. " )ConfirmReady = AskTextQuestion("Confirm Touch plate leads are connected and ready. (y/n)")If ConfirmReady = "y" Then GoTo 1 Else GoTo 51:DoXY = AskTextQuestion("Zero X and Y also? (y/n)")If DoXY = "y" Then GoTo 2 Else GoTo 32:ToolDia = Question("What is the tool diameter?")Message( "Auto Zeroing X...")SetOEMDRO(XaxisDRO, 0.0000)Sleep 1000If IsSuchSignal (22) Then   code "G31 X-2 F10"   While IsMoving()   Sleep 100   Wend   SetOEMDRO(XaxisDRO, ToolDia/2)        Sleep 1000   code "G1 X.5"End IfMessage( "Auto Zeroing Y..." )SetOEMDRO(YaxisDRO, 0.0000)Sleep 1000If IsSuchSignal (22) Then   code "G31 Y-1 F10"   While IsMoving()   Sleep 100   Wend   SetOEMDRO(YaxisDRO, ToolDia/2)   Sleep 1000   code "G1 Y.5"End If3:DoZ = AskTextQuestion("Position the touch plate to zero Z.  y  to continue or n to skip.  (y/n)")If DoZ = "y" Then GoTo 4 Else GoTo 64:TouchPlate = Question("Enter Touch Plate thickness: e.g. 0, .050 or .180")Message( "Auto Zeroing Z..." )SetOEMDRO(ZaxisDRO, 0.0000)Sleep 1000If IsSuchSignal (22) Then   code "G31 Z-2 F5"   While IsMoving()   Sleep 100   Wend   SetOEMDRO(ZaxisDRO, TouchPlate)   Sleep 1000   code "G1 Z1"End IfGoTo 65:Message ("Tool zeroing aborted.  Try again when ready.")GoTo 76:Message "Tool zeroing complete.  Check the results on the DROs."7:End Sub`
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 3

ok, I'm back operational for now.. added 3" to my z height, it was all the slack chain I had available at the eyebolts..

will try and find time to experiment this weekend with the macro..

are you talking about how ger21 uses a touch plate at the side of the table? or I remember at least seeing a video using a touch plate but would that be more for setting tool length offset and maybe I'm thinking wrong has to hoe that would work for setting Z in a part/stock z height zeroing..
kevinl

Posts: 886
Joined: Tue Feb 02, 2010 3:47 pm
Location: Birmingham, AL, USA
CNC Machine: Custom

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

I think I saw ger21's video you mentioned but don't recall much about it. But my recollection is that he uses a Z touch plate to zero to the table or spoiler board surface at a given location on the table. My suggestion was that this might be expanded to also have an XY touch-plate in this same are, although where the "touch" would occur at XY=0. I've seen it done both ways, auto zero XY and Z with a 90deg aluminum angle standing upright near 0,0 and a flat plate on the work surface to auto zero Z, or with the XY and Z plate moveable to anywhere your work 0,0,0 is to be. Although I do not use a stationary location to zero my XY or Z.

I use the Mach3 "Ref All Home" to zero to the table XYZ limit-switch limits (this homes the Z-axis to top of travel). And use the moveable XY angle touch-plate, flip it on a side if I'm also using it to zero Z or a separate, flat Z touch-plate for Z. I've got a number of posts on this forum on this I put up years ago.
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 3

I've always wanted to switch over to this reference block (see Attachment, but its inverted). I started using the alum angle not long after my first build and pretty much use it for setting x-y and z part zeroes. I don't have hard figure points on my table either.

my "reference All" setting for machine coordinates are X&Y -2.00, was setting z to +2.750 but have changed that z=0.000 to see if that was my troubles with safe-z.

to use the fixed touch, would we not need to touch/ find z part height than find and touch the fixed touch plate to set a tool offset so that once we encounter another M6, we would need or could find the fixed touch plate and calculate a different between the previous & new tool offset to have a new Z part height for continuation of the gcode.
Attachments
ReferenceBlock
kevinl

Posts: 886
Joined: Tue Feb 02, 2010 3:47 pm
Location: Birmingham, AL, USA
CNC Machine: Custom

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

Very nice! A one block touch "zone". Does this anchor on top, flush with the sacrificial board surface with the hole centered on 0,0?

I am still a bit uncertain how this works out for Z-touch in respect to work height's Z=0, especially where it concerns a tool change that does not have a reference collar on the tool bit shank.
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 3

the single block is shown upside down to it typical use direction, but that would not clearly have shown the machine work on the block.. it should be set on the stock top x-y corner and the part would have a small offset and would require a slightly larger stock than the part's outer profile.

and for the fixed z-touch plate, I need to sit down and think like the mach3 program and figure out just how the next longer and shorter bit length in the tool change would change the z zero point after each 'tool change / fixed plate touch off' combination sequence would need to add or subtract from Mach3 known z part reference point. But that's got to be how it's done or I'm not seeing the tree for the forest..
kevinl

Posts: 886
Joined: Tue Feb 02, 2010 3:47 pm
Location: Birmingham, AL, USA
CNC Machine: Custom

Previous