1. #1
    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

    Click image for larger version. 

Name:	1.jpg 
Views:	847 
Size:	229.4 KB 
ID:	9004


    Select the Offsets Tab indicated
    Click image for larger version. 

Name:	2.jpg 
Views:	1147 
Size:	228.4 KB 
ID:	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.

    Click image for larger version. 

Name:	3.jpg 
Views:	3230 
Size:	233.1 KB 
ID:	9006

    As we are assigning a function to a button select button script from the dropdown menu
    Click image for larger version. 

Name:	4.jpg 
Views:	1612 
Size:	234.8 KB 
ID:	9007

    This will cause all the buttons that can be assigned to flash, select the centering button indicated below.
    Click image for larger version. 

Name:	5.jpg 
Views:	933 
Size:	229.0 KB 
ID:	9008

    A code box for the selected button will appear, Copy the code at the bottom of the post into this box.

    Click image for larger version. 

Name:	6.jpg 
Views:	730 
Size:	225.0 KB 
ID:	9009
    And donít forget to save it as indicated in the picture
    Click image for larger version. 

Name:	7.jpg 
Views:	1743 
Size:	258.6 KB 
ID:	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..

    Click image for larger version. 

Name:	8.jpg 
Views:	938 
Size:	236.2 KB 
ID:	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
    Always bear in mind that your own resolution to succeed is more important than any other - Abe Lincoln

  2. The Following 2 Users Say Thank You to Ricardoco For This Useful Post:


  3. #2
    Hey Ricardoco!

    Long shot you may see this as it's been just about a year since you did this! but anyway,

    In your code, does it have anywhere to specify the diameter of the probe being used? So say I have a 5mm probe, then the software knows that the centre of the probe is actually 2.5mm offset from the edge that has just touched?

    Thanks

  4. #3
    Quote Originally Posted by halfpenny View Post
    Hey Ricardoco!

    Long shot you may see this as it's been just about a year since you did this! but anyway,

    In your code, does it have anywhere to specify the diameter of the probe being used? So say I have a 5mm probe, then the software knows that the centre of the probe is actually 2.5mm offset from the edge that has just touched?

    Thanks
    The post is 3 years old but.

    This is the line (A tutorial to show the configuration of Mach3 (with standard screens) to find the center of a hole or pipe.)

    So the diameter of the tool is irreverent as the tool (probe) will touch BOTH sides of the hole and then divide by two and thus cancel out.
    ..Clive
    The more you know, The better you know, How little you know

  5. #4
    Correct but if he's not probing a bore then he needs the info, he did say edge


    Now the proud owner of my own personal CNC machine happy days.

  6. #5
    Quote Originally Posted by Dean jeffery View Post
    Correct but if he's not probing a bore then he needs the info, he did say edge


    Now the proud owner of my own personal CNC machine happy days.
    The way I have read it is that the code (in this case) is only as stated and been setup to find the centre of a hole and not an edge finder. But I stand to be corrected if I have miss read it.

    Of course if you want to find an edge then you will need the diameter of the tool stroke probe
    Last edited by Clive S; 02-07-2016 at 09:25 AM.
    ..Clive
    The more you know, The better you know, How little you know

  7. #6
    Clives correct the basic code below doesn't need tip Dia to work.! . . . But this code is not safe and only has basic error checking.?

    For instance it doesn't check to see if set to machine coordinates and warn the user or at least change on the fly and return when done.
    The code gets the current value from WORK coordinate DRO and then adds +/- 75mm travel distance to variable which it then uses this value for G31 probe command.
    If control set to G90 absolute coordinates before the probe is activated then will try to go to the value but in machine coordinates which could and will be very different to WORK coordinates.!! . . . . CRASH BANG SNAPPPPPP.

  8. #7
    Well said Dean I had not read the code in that detail and you are correct the code does need changing but to be fair to Ricardoco he does state run at your own risk.
    ..Clive
    The more you know, The better you know, How little you know

  9. #8
    ...and this is one reason why soft limits are useful? Although I guess you will snap the probe first anyway!
    Last edited by Neale; 02-07-2016 at 04:55 PM.

  10. #9
    Quote Originally Posted by Neale View Post
    ...and this is one reason why soft limits are useful? Although I guess you will snap the probe first anyway!
    In my opinion PROVIDING you have homed the machine soft limits are well worth having.
    ..Clive
    The more you know, The better you know, How little you know

  11. #10
    Quote Originally Posted by Clive S View Post
    Well said Dean I had not read the code in that detail and you are correct the code does need changing but to be fair to Ricardoco he does state run at your own risk.
    There's more wrong with it than just this and to me with no disrepect to anyone but people shouldn't post Code unless they know it's safe.! . . . Saying use at own risk isn't acceptable to me.

  12. The Following User Says Thank You to JAZZCNC For This Useful Post:


Similar Threads

  1. Tool Height Setting Probe - Mach3 - solution
    By HiltonSteve in forum Tool & Tooling Technology
    Replies: 18
    Last Post: 12-11-2013, 06:23 PM
  2. BobCad-Cam 3D tutorial
    By craigrobbo in forum Computer Software
    Replies: 0
    Last Post: 21-09-2012, 06:20 PM
  3. Spindle probes for centering
    By maritimesbob in forum Probing, Digitizing & Scaning
    Replies: 4
    Last Post: 02-09-2012, 11:22 PM
  4. Co axial centering indicator
    By Robin Hewitt in forum Tool & Tooling Technology
    Replies: 13
    Last Post: 03-02-2012, 07:49 PM
  5. Touch Probe
    By luke11cnc in forum Probing, Digitizing & Scaning
    Replies: 28
    Last Post: 31-01-2012, 01:16 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •