Ricardoco
02-06-2013, 06:56 PM
A tutorial to show the configuration of Mach3 (with standard screens) to find the center of a hole or pipe.
the code is IN MILLIMETERS if you wish to use Imperial measurements you will have to edit the code accordingly.
You must get this right or you could damage your machine or probe or worse!!
I was not able to find a tutorial that started at the beginning for the novice, so why not have one here.
This tutorial assumes you have fitted a probe on your system, and assigned it to an input, and that the large digitise led on the diagnostics tab in Mach3 lights when you activate it.
Some of the buttons in Mach3, although shown on the screens do not do anything when pressed, this is because they have no code or script assigned to them.(Great idea that)
In the few steps to follow, we will assign some code to a button for center finding, this procedure can be used with other buttons as well, as long as you can find the code for the button you wish to assign it too. The script/code we will be using is not mine, it has several authors as it has evolved over time and I’m sure it will evolve further in the future.
Ok first things first.
There may be a better way to do this but as nobody seems to have done it as a tutorial I’m having a go. if you have a better way then submit it as a tutorial of your own and by all means pop a link to it in this thread, after all the more views the better, but let’s not make this any more complicated than it needs to be. If you have clever dick comments then keep them to yourself as this is not a debate, or pm me :)
Of course if you have constructive comments then please don’t be shy and at the end of this we should have a nice little tutorial for the site.. (That’s why we are members isn’t it)
The Main screen in Mach3
9004
Select the Offsets Tab indicated
9005
This screen has a number of functions that can be performed using a probe/edge finder this tutorial will be using a touch probe, select the operator button in the file menu bar indicated below.
9006
As we are assigning a function to a button select button script from the dropdown menu
9007
This will cause all the buttons that can be assigned to flash, select the centering button indicated below.
9008
A code box for the selected button will appear, Copy the code at the bottom of the post into this box.
9009
And don’t forget to save it as indicated in the picture
9010
And that’s it!!
Assuming the probe is fitted and working, using jog, move the probe down (5mm or more will do) into the hole or pipe you wish to have the machine centered to. And hit the Red circled button..
9011
The Code
Rem VBScript To center probe inside a pipe
If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty
Code "(Probe plate is grounded, check connection and try again)"
Else
FeedCurrent = GetOemDRO(818) 'Get the current settings
XCurrent = GetDro(0)
YCurrent = GetDro(1)
Code "G4 P1" 'Pause 1 second to give time to position probe plate
Code "F100" 'slow feed rate to 4 ipm 100mm
Rem Probe Left
XNew = Xcurrent - 75 'probe 3 inches to left 75mm
Code "G31 X" &XNew
While IsMoving() 'wait for the move to finish
Wend
XPos1 = GetVar(2000) 'get the probe touch location
Code "G0 X" &XCurrent 'rapid move back to start point
Rem Probe Right
XNew = XCurrent + 75 'probe 3 inches to right 75mm
Code "G31 X" &XNew
While IsMoving()
Wend
XPos2 = GetVar(2000)
XCenter = (XPos1 + XPos2) / 2 'center is midway between XPos1 and XPos2
Code "G0 X" &XCenter 'rapid move to the x center location
Rem Probe up
YNew = YCurrent + 75
Code "G31 Y" &YNew
While IsMoving()
Wend
YPos1 = GetVar(2001)
Code "G0 Y" &YCurrent
Rem Probe down
YNew = YCurrent - 75
Code "G31 Y" &YNew
While IsMoving()
Wend
YPos2 = GetVar(2001)
YCenter = (YPos1 + YPos2) / 2
Rem move To the center
Code "G0 Y" &YCenter
While IsMoving ()
Wend
Code "F" &FeedCurrent 'restore starting feed rate
DoOEMButton ( 1008 )
DoOEMButton ( 1009 )
End If
The Code
Just copy this code into the box when prompted this version will zero the X,Y when Finished.
I always run it twice
this tutorial works on my machine...but use it at your own risk!!
Rick
the code is IN MILLIMETERS if you wish to use Imperial measurements you will have to edit the code accordingly.
You must get this right or you could damage your machine or probe or worse!!
I was not able to find a tutorial that started at the beginning for the novice, so why not have one here.
This tutorial assumes you have fitted a probe on your system, and assigned it to an input, and that the large digitise led on the diagnostics tab in Mach3 lights when you activate it.
Some of the buttons in Mach3, although shown on the screens do not do anything when pressed, this is because they have no code or script assigned to them.(Great idea that)
In the few steps to follow, we will assign some code to a button for center finding, this procedure can be used with other buttons as well, as long as you can find the code for the button you wish to assign it too. The script/code we will be using is not mine, it has several authors as it has evolved over time and I’m sure it will evolve further in the future.
Ok first things first.
There may be a better way to do this but as nobody seems to have done it as a tutorial I’m having a go. if you have a better way then submit it as a tutorial of your own and by all means pop a link to it in this thread, after all the more views the better, but let’s not make this any more complicated than it needs to be. If you have clever dick comments then keep them to yourself as this is not a debate, or pm me :)
Of course if you have constructive comments then please don’t be shy and at the end of this we should have a nice little tutorial for the site.. (That’s why we are members isn’t it)
The Main screen in Mach3
9004
Select the Offsets Tab indicated
9005
This screen has a number of functions that can be performed using a probe/edge finder this tutorial will be using a touch probe, select the operator button in the file menu bar indicated below.
9006
As we are assigning a function to a button select button script from the dropdown menu
9007
This will cause all the buttons that can be assigned to flash, select the centering button indicated below.
9008
A code box for the selected button will appear, Copy the code at the bottom of the post into this box.
9009
And don’t forget to save it as indicated in the picture
9010
And that’s it!!
Assuming the probe is fitted and working, using jog, move the probe down (5mm or more will do) into the hole or pipe you wish to have the machine centered to. And hit the Red circled button..
9011
The Code
Rem VBScript To center probe inside a pipe
If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty
Code "(Probe plate is grounded, check connection and try again)"
Else
FeedCurrent = GetOemDRO(818) 'Get the current settings
XCurrent = GetDro(0)
YCurrent = GetDro(1)
Code "G4 P1" 'Pause 1 second to give time to position probe plate
Code "F100" 'slow feed rate to 4 ipm 100mm
Rem Probe Left
XNew = Xcurrent - 75 'probe 3 inches to left 75mm
Code "G31 X" &XNew
While IsMoving() 'wait for the move to finish
Wend
XPos1 = GetVar(2000) 'get the probe touch location
Code "G0 X" &XCurrent 'rapid move back to start point
Rem Probe Right
XNew = XCurrent + 75 'probe 3 inches to right 75mm
Code "G31 X" &XNew
While IsMoving()
Wend
XPos2 = GetVar(2000)
XCenter = (XPos1 + XPos2) / 2 'center is midway between XPos1 and XPos2
Code "G0 X" &XCenter 'rapid move to the x center location
Rem Probe up
YNew = YCurrent + 75
Code "G31 Y" &YNew
While IsMoving()
Wend
YPos1 = GetVar(2001)
Code "G0 Y" &YCurrent
Rem Probe down
YNew = YCurrent - 75
Code "G31 Y" &YNew
While IsMoving()
Wend
YPos2 = GetVar(2001)
YCenter = (YPos1 + YPos2) / 2
Rem move To the center
Code "G0 Y" &YCenter
While IsMoving ()
Wend
Code "F" &FeedCurrent 'restore starting feed rate
DoOEMButton ( 1008 )
DoOEMButton ( 1009 )
End If
The Code
Just copy this code into the box when prompted this version will zero the X,Y when Finished.
I always run it twice
this tutorial works on my machine...but use it at your own risk!!
Rick